Hi

Please see code below, when I query my db I am getting an unefined variable issue, any ideas?

I am quiet new to PHP so please help.

 mysql_connect("localhost","root","");
 mysql_select_db("db");

 $id = intval($_GET['id']);
 $res = "SELECT * FROM table WHERE id=$id";

 echo "<table>";
 echo "<tr>";

 echo "<td>"; echo "<h4>".$row['item']."</h4>"; echo "</td>";  echo "</tr>";
 echo "<td>";?> <img src ="<?php echo $row['image']; ?>" height ="100" width ="100"> <?php echo "</td>";
 echo "</tr>";

 echo "<td>"; echo $row['description']; echo "</td>"; echo "</tr>";
 echo "<td>"; echo $row['price']; echo "</td>";

 echo "</tr>";
 echo"</table>";
 ?>

Please post the full error message.

It could be that $_GET['id'] does not exist. To make sure it exists, do a check:

if(isset($_GET['id'])) {
    $id = intval($_GET['id']);
} else {
    // do something to handle the error
}

It would help much if you posted the exact error message (error message text including variable names, line number etc).

Ups, I just figured out that you did not send the query at all. Well, above still applies.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.