Re: Still Working on The Script
| From: | Russell Barr | Date: | Thu, 02 Nov 2000 05:30:08 +0000 |
| Subject: | Re: Still Working on The Script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-23321@lists.php.net to get a copy of this message | ||
You don't say what the error is, but I can see a few problems:
all the queries are assigned to $sql
I can't find any loops in your code.
Try assigning each query and result to a different variable name
Then try something like
if(!$result=mysql_fetch_array($sql1)) die("aaaaaahhhhhhh!");
do{
print("// a nicely formatted table with instantiated $result
elements");
}
while($result=mysql_fetch_array($sql1);
The:
do {stuff} while(condition) is the loop
here is one I wrote to display table information for my first school
project(don't laugh). It's much simpler than what yu are trying to do, but
the control structure is one you can use.
$qstring="show tables";
$result=mysql_query($qstring) or die ("err1");
if(!$tNames=mysql_fetch_array($result)) die ("err2");
do{
print("<h3>$tNames[0]</h3>");
print("<TABLE border>");
print("<td>Field<td>Type<td>Null<td>Key<td>Default<td>Extra</tr>");
$explain="explain $tNames[0]";
$result2=mysql_query($explain) or die ("err3");
if($tFields=mysql_fetch_array($result2)){
do{
print("<tr><td>$tFields[0]<td>$tFields[1]<td>$tFields[2]<td>$tFields[3]<td>$
tFields[4]<td>$tFields[5]");
}
while($tFields=mysql_fetch_array($result2));
print("</TABLE>");
}
}
while($tNames=mysql_fetch_array($result));
?>
Keep after it and good luck
Russell
> Hi,
>
> Thanks to all that have helped so far. I am trying to make a loop that
> outputs an html block with variables from the database as many times as
> there are rows. It is outputting all the reviews. Sadly, it is not
> working. Here is the link to the code so far if you can please take a
> gander at it :) http://theplayspot.com/genericreviewshow.txt
>
> Thanks,
> Austin Carpenter
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at
> http://www.hotmail.com.
>
> Share information about yourself, create your own public profile at
> http://profiles.msn.com.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>