זה לא עובד זה נותן תשגיעה:
PHP קוד:
Mysql 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 'table WHERE id='1'' at line 1
זה הקוד של השליפה:
PHP קוד:
<?
$id="1";
$link = mysql_connect('localhost' , 'root' , '') or die('Mysql Error: ' . mysql_error());
mysql_select_db('bar_manor' , $link) or die('Mysql Error: ' . mysql_error());
$query = "SELECT * FROM table WHERE id='$id'";
$Result = mysql_query($query) or die('Mysql Error: ' . mysql_error());
$N = mysql_num_rows($Result);
if($N === false)
die('Mysql Error: ' . mysql_error());
if ($N < 1)
echo 'NO RESULTS';
else
{
while($Liner = mysql_fetch_assoc($Result))
{
echo $Liner["text"];
}
}
mysql_free_result($Result) or die('Mysql Error: ' . mysql_error());
// סוגר את החיבור לבסיס הנתונים
mysql_close($link) or die('Mysql Error: ' . mysql_error());
?>