Mixed Up Values
| From: | Mark Sargent | Date: | Tue, 26 Apr 2005 04:47:53 +0000 |
| Subject: | Mixed Up Values | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-213853@lists.php.net to get a copy of this message | ||
Hi All,
with the below code, $myrow[1] should = product_name's value, $myrow[2] should = product_model_number's value and $myrow[3] should = product_serial_number's value, but, product_name's value is not being displayed, and the values are being moved to the left 1. Meaning product_model_number is being displayed as product_name and so forth. What is wrong with the code.? Cheers.
Mark Sargent.
$result = mysql_query("SELECT product_name, product_model_number,
23 product_serial_number FROM Products",$db);
24
25
26
27 echo "<table border=1>\n";
28
29
30
31 echo "<tr><td>Product Name</td><td>Product Model Number</td><td>Product
32 Serial Number</td></tr>\n";
33
34
35
36 while ($myrow = mysql_fetch_row($result)) {
37
38
39
40 printf("<tr><td>%s</td><td>%s</td><td>%s</td></tr>\n",
41 $myrow[1], $myrow[2], $myrow[3]);