Skip navigation links

MySQL Forums :: PHP :: mysql_fetch_array()


Advanced Search

mysql_fetch_array()
Posted by: rand badran ()
Date: August 29, 2011 09:00AM

hello,

i'm trying to use mysql_fetch_array to print the result of my query in an html table

the problem is, i can't specify 'where' in my query

this is my code

<?php

mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("ajyal") or die(mysql_error());

$chicksName = $_POST['customerName'];
$result = mysql_query("SELECT chicksDate, chicksQuantity, chicksPrice FROM chicks WHERE chicksName=?")
or die(mysql_error());
echo "<table border='1'>
<tr>
<th>date</th>
<th>quantity</th>
<th>price</th>
</tr>";
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['chicksDate'];
echo "</td><td>";
echo $row['chicksQuantity'];
echo "</td><td>";
echo $row['chicksPrice'];
echo "</td></tr>";
}
echo "</table>";

?>


i get this error message:
'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 1'

can anyone help me plz??

Options: ReplyQuote


Subject Written By Posted
mysql_fetch_array() rand badran 08/29/2011 09:00AM
Re: mysql_fetch_array() Peter Brawley 08/29/2011 09:19AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.