Hi
new to the forum and new to PHP, although not to SQL or programming.
I am about to kill myself over a simple query (my first one though):
I can access and query through phpadmin:
SELECT * FROM `Visitor` WHERE First_Name LIKE '%ri%'
give a perfect result.
But any attempt to get a result through php in a website has been without success (except the connection to the database (that works).
Here is the php code from the file on the web site:
$query = "SELECT * FROM 'visitor' WHERE First_Name Like '%ri%'";
echo "<p>Query: ".$query."</p>";
$result = $db->query($query) or die("A MySQL error has occurred.<br />Your Query: " . $query. "<br /> Error: (" . $db->errno . ") " . $db->error );
and the output is:
Query: SELECT * FROM 'visitor' WHERE First_Name Like '%ri%'
A MySQL error has occurred.
Your Query: SELECT * FROM 'visitor' WHERE First_Name Like '%ri%'
Error: (1064) 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 ''visitor' WHERE First_Name Like '%ri%'' at line 1
A slight variation (without the ' ) will give this:
Query: SELECT * FROM visitor WHERE First_Name Like '%ri%'
A MySQL error has occurred.
Your Query: SELECT * FROM visitor WHERE First_Name Like '%ri%'
Error: (1146) Table 'matchmyo_main.visitor' doesn't exist
I am sure I am doing something very stupid, but everybody who has attempted to learn a new language
will know the feeling.
Thanks for your help!



