Forum Moderators: coopster

Message Too Old, No Replies

PHP MySQL Disyplay error

PHP MySQL Disyplay error

         

ssixx

5:10 am on May 8, 2009 (gmt 0)

10+ Year Member



Ok I am still pretty new at this and cant figure out what is wrong. Here is the code for the SQL display

<?php
mysql_connect("localhost","root","") or die (mysql_error());
echo "Connected to MySQL<br><hr>";
mysql_select_db("bikeorder") or die(mysql_error());
echo "Connected to Datebase<br><hr>";
$query = "SELECT * FROM bikeorder:";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
echo $row['field_1'] , $row['field_2'];
echo "<br>";
}
?>

When I view it this is what I get

Connected to MySQL
Connected to Datebase
You have an error in your SQL syntax near ':' at line 1

Any Suggestions?

dreamcatcher

5:59 am on May 8, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi ssixx, welcome to WebmasterWorld. :)

Well, the clue is in the error. This is the problem line because of the semi colon:

$query = "SELECT * FROM bikeorder:";

You cannot have a semi colon after a table name. Should be:

$query = "SELECT * FROM bikeorder";

dc