Need correct format to print table from MySQL database

[php]<?php require_once(“db_connx.php”);
// Connect to the database and insert the new artist
$sql = "SELECT * FROM paintings;
$recordset = (mysql_query( $sql )or die(mysql_error()));
?>

Art List

Painting NameArtist NameOriginal PricePrint or Giclee PriceThumbnail <?php while( $row=mysql_fetch_assoc($recordset) ) { print " $row['paint_name'] . $row['artist_name'] .$row['original_price']. $row['print_giclee_price'] . $row['thumbnail']\n"; } ?> <?php include("admin_footer.php") ?> [/php]

I get the following error that I don’t understand:

Parse error: syntax error, unexpected '>' in C:\FTP_ROOT\LocalUser\jhwindham\am_paintings_list.php on line 13; the while statement is line 13.

Would love some help. John

First this line: $sql = "SELECT * FROM paintings;
does not have an ending double-quote…

Should be : $sql = “SELECT * FROM paintings”;

And, This line: $recordset = (mysql_query( $sql )or die(mysql_error()));
should be:
$recordset = mysql_query( $sql )or die(mysql_error());
(no extra () needed!)

Start with that and see if it fixes the code… If not repost the current version… Good luck!

you also have a extra ‘n’ after the in the php while loop, i believe that is the problem behind the error that you are getting

Sponsor our Newsletter | Privacy Policy | Terms of Service