PHP and MySQL echoing out a Table

Posted by user1631702 on Stack Overflow See other posts from Stack Overflow or by user1631702
Published on 2012-08-29T03:33:34Z Indexed on 2012/08/29 3:38 UTC
Read the original article Hit count: 234

Filed under:
|
|

Okay, so I've done this before, and it worked. I am trying to echo out specific rows on my database in a table. Here is my code:

<?php

$connect = mysql_connect("localhost", "xxx", "xxx") or

die ("Hey loser, check your server connection.");

mysql_select_db("xxx");

$quey1="select * from `Ad Requests`";

$result=mysql_query($quey1) or die(mysql_error());

?>

<table border=1 style="background-color:#F0F8FF;" >

<caption><EM>Student Record</EM></caption>

<tr>

<th>Student ID</th>

<th>Student Name</th>

<th>Class</th>

</tr>

<?php

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

echo "</td><td>";

echo $row['id'];

echo "</td><td>";

echo $row['twitter'];

echo "</td><td>";

echo $row['why'];

echo "</td></tr>";

}

echo "</table>";

?>

It gives me no errors, but It just shows a blank table with none of these rows.

My Question: How come this wont show any rows in the table, what am I doing wrong?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql