troubleshooting Question

PHP - select - where statement

Avatar of Ricky Nguyen
Ricky NguyenFlag for Australia asked on
PHP
6 Comments1 Solution221 ViewsLast Modified:
HI experts,

I'm having troubles getting my code to select a specific piece of information.

Here is my code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test 1</title>
</head>
<?php
$con = mysql_connect("localhost","warehouse21","tld3");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("warehouse", $con);

$result = mysql_query("SELECT * FROM product 
WHERE productCode='HT400DVA'");

while($row = mysql_fetch_array($result))
  {
  <?php echo $row['productCode'];?>
  <?php echo $row['name'];?>
  <?php echo $row['price'];?>
 "<br />";
  }
?> 
<?php }
mysql_close($conn); ?>
</table></body></html>

Open in new window


I'm trying to get my code to display the following.

Product Code  |  Name   |   Price
HT400DVA         Bike           $50

Thanks in advance,

Rick
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros