I don't understand mysql_fetch_query

wxdqz

New Member
Hi,

I'm messing with PHP's sql functions for the first time and I'm quite baffled. From searching through this forum and a couple of others, I've been able to piece something together that works, but it's kludgy and I'm not sure WHY it works. Here's the code:

mysql_connect("localhost", "sam", "phpbuilderbbsnono")
or die ("Could not connect to MySQL server. SQL SERVER DOOD!");

$display = "2";
$db="johnson";
$qentry = "SELECT body FROM entries WHERE numba='$display'";
$qhtml = "SELECT html FROM capsule";
mysql_select_db($db);

$hquery = mysql_query( $qhtml );
for($i=0;$i<3;$i++){
$html[$i]=mysql_fetch_array( $hquery );
}

//$harray = mysql_fetch_array( $hquery );
print(stripslashes($html[0][0]));
print(stripslashes($html[1][0]));


$eresult = mysql_query( $qentry );
$earray = mysql_fetch_array($eresult);
$result = stripslashes( $earray[0]);
print($result);
print(stripslashes($html[2][0]));

What this code does: Pulls 3 bits of HTML from a database named capusule and the beef of the content from a database named entries.

My question is this: how can I avoid creating a multi-dimentional array durring that while?
 
Back
Top