Hello. I have a MySQL database with 2 columns (column, and column2 for argument’s sake). column values are 1 word, short, and column2 is the content.
When using this PHP script:
[code=php]<?php
mysql_connect(“localhost”, “admin”, “password”) or die(mysql_error());
mysql_select_db(“database”) or die(mysql_error());
$id=$_GET[‘p’];
$result = mysql_query(“SELECT * FROM table WHERE column=’$id'”) or die(mysql_error());
$row = mysql_fetch_array( $result );
echo $row[‘column2’];
?>
I get the following error (when filling in ?p=report)
[quote]
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 column=’report” at line 1
I have used this method before without any problems but in that case the values in ‘column’ were integers, as opposed to single words now.
What am I doing wrong? I appreciate any help.