Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display query using $_GET var.

Status
Not open for further replies.

dugen

Programmer
Jun 16, 2003
59
US
I would like to display the following query in a table.

$query = "SELECT * from enter_mini where id=".$_GET['id'].";

Below is the code i currently have. I have never done this before with a $_Get var before. How do i display the info below?



$query_string = sprintf("SELECT id, name, last, city, state, ss, phone, division where id=".$_GET['id']." FROM enter");

$result_set = mysql_db_query($db_name, $query_string, $link);


print("<table border=2 width=850 align=center>");
print("<tr align=center valign=top>");
print("<td align=center valign=top><font size=3 type=arial><a href='detail.php?id=".$row[id]."'> $row[id] </a> </font></td>");
print("<td align=center valign=top><font size=4><b>First Name</b></font></td>");
print("<td align=center valign=top><font size=4><b>Last Name</b></font></td>");
print("</tr>");

while ($row = mysql_fetch_array($result_set))
{



print("<tr align=center valign=top>");
print("<td align=center valign=top><font size=3 type=arial> $row[id] </font></td>");
print("<td align=center valign=top><font size=3 type=arial> $row[name] </font></td>");
print("<td align=center valign=top><font size=3> $row[last] </font></td>");
print("</tr>");



}
 
change this line
$result_set = mysql_db_query($db_name, $query_string, $link);


to
$result_set = mysql_query($db_name, $query_string, $link);

and put quotes around your array keys in the while loop. I'd also change mysql_fetch_array to mysql_fetch_assoc.

and don't forget to finish the table after the while loop.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top