NameSilo

Having a undifine index id error help

Spacemail by SpaceshipSpacemail by Spaceship
Watch

co.ador

New Member
Impact
0
Notice: Undefined index: id in C:\wamp\www\shoes\menu2prueba.php on line 148

I am getting this error can any body help

PHP:
$query = "SELECT * FROM menu WHERE id IN ( 1, 2, 3, 4)";  

// execute query 
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); 

// see if any rows were returned 
if (mysql_num_rows($result) > 0) { 
    // yes 
    // print them one after another 
   echo '<table  class="felo">'; 
   echo "<tr>";
echo'<td width="800" height="100%" bgcolor="#FFFFFF" class="quelo">'; 

while($row3 = mysql_fetch_row($result)) { 
echo '
<table class="trelo" >
 <tr>
 <td width="152" rowspan="2" class="cebo">
  <h3 align="center"><a href="itemdetails.php?id=',$row3['id'],'"> ',$row3[3],'</a> </h3><p> //  line 148
<a href="itemdetails.php?id[]=1&id[]=2&id[]=3&id[]=4"><img src="',$row3[0],'" width="140" height="160" alt="product" style=" border-color:#FF6600; border:thin; border-style:solid;"/></a></p></td>
                  <td class="pricegif"><img src="../../../Users/joe/AppData/Local/images/price.gif" alt="we" width="53" height="21" hspace="10" align="middle" /></td>
                  <td class="price"><a href="#">$',$row3[4],'</a></td>

echo "</td>";
echo"</tr>";
echo"</table>";
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
.US domains.US domains
That's not an error, it's a notice. It basically means there's something in your code that isn't perfect.
"Undefined Index" means that in one of your mysql results, there is a lack of the 'id' row.

You can stop this from being reported in php.ini or using PHP: error_reporting - Manual


Bruce
 
0
•••
mysql_fetch_row returns an array with numerical keys (so $row3['id'] will never be defined). You might want to use mysql_fetch_array instead. This returns an array with numerical and MySQL column names by default.
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back