Jump to content


closer but no cigar. PHP and mySQL

  • Please log in to reply
1 reply to this topic

#1 tet3828

  • Members
  • PipPipPip
  • Advanced Member
  • 107 posts
  • Locationfort myers, FL

Posted 26 October 2006 - 08:12 AM

Thanks for the responses so far people. I appreacieate you all bearing with me as I reduce the broad nature of my questions by grasping the mysql/PHP concept. Ill admit the last response made very little sense to me prior to my recent trip to the library and some practice coding....Moving right along.

here goes:

I have a table in mySQL it contains

roughly 20 rows or "items" with the following values as columns: NAMEs, CATAGORYs, DESCRIPTIONs , PRICEs and HTTP:// reference to a thumbnail

how should I approach displaying the NAME PRICE AND THUMBNAIL in a borderless table when an item's catagory is selected from a dropdown?

[ Enter Your Signature Here ]
Always take caution when using other peoples work.

#2 Orio

  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 26 October 2006 - 11:06 AM


die("<html><body><form action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">
<select name=\"cat\">
<option value=\"cat1\">Cat1</option>
<option value=\"cat2\">Cat2</option>
<input type=\"submit\" name=\"submit\" value=\"Search!\">

//Make sure you are connected to the database
$qry = "SELECT NAME,PRICE,HTTP:// FROM `Table_Name` WHERE CATAGORY='".$_POST['cat']."'";
$result = mysql_query($qry) or die(mysql_error());

echo "<table border=\"0\"><tr><td>Name</td><td>Price</td><td>Thumbnail</td></tr>";

while($row = mysql_fetch_array($result))
 echo "<tr>";
 echo "<td>".$row['NAME']."</td>";
 echo "<td>".$row['PRICE']."</td>";
 echo "<td><img src=\"".$row['HTTP://']." /></td>";
 echo "</tr>";

echo "</table>";


Think you're smarty?

(Gone until 20 to November)

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users