SQL syntax error relating to line 12 of the code

Kingston12

New Member
Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1Thanks to bad weather I am down to the wire on my class project. Oddly enough I followed the class handouts on this and I am still getting the error.Here is my php so far:\[code\] <?php include 'inc/header.php'; include 'inc/database.php';?><?php$id = $_GET["id"];$SQL = "SELECT * FROM prod WHERE prod_id=$id";$result = mysql_query($SQL) or die('Error:'.mysql_error());while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $name = $row["prod_name"]; $price = $row["prod_price"]; $thumb = $row["prod_thumb"]; $large = $row["prod_img"]; $desc = $row["prod_desc"];}?><!-- Begin Content Editing --> <section id="content"> <article class="product"> <div class="product-image"> <p class="img-place"> <img src="http://stackoverflow.com/questions/15804767/<?php echo"$IMG_DIR"; ?>/prods/<?php echo "$thumb"; ?>" alt="<?php echo "$name" ?> Telescope" /> </p> </div> <div class="product-name"> <h1><?php echo "$name"; ?></h1> </div> <div class="product-desc"> <p class="desc"> <?php echo "$desc"; ?> </p> </div> <div class="product-price"> <h3><?php echo "$price"; ?></h3> </div> <div class="product-commands"> Edit / Delete </div> </article> </section><!-- End Content Editing --><?php include 'inc/footer.php'; ?>\[/code\]only change here is if I used the if statement instead of while I get a php error instead. I greatly appreciate any help I can get with this as it really stands in my way of finishing this project on time.oh and here is the database.php file as well (pword and uname has been stripped, but are correct, also the prefixes have been blocked as well, but again are correct.\[code\]<?php //Database settings $dbhostname = "localhost"; $dbusername = "xxxxxx_icomm"; $dbpassword = "removedforposting"; $databasename = "removedforposting"; //connecting to MySQL $conn = mysql_connect($dbhostname, $dbusername, $dbpassword); mysql_select_db($databasename);?>\[/code\]
 
Back
Top