Forum Moderators: coopster
The error is
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 'notes_work LIKE '%box%'' at line 1
My code is:
<?php
include('Connections/immapp.php');
// set your infomation.
// connect to the mysql database server.
mysql_connect ($hostname_immapp, $username_immap, $password_immapp);
//select the database
mysql_select_db($database_immapp) or die('Cannot select database');
if(isset($_GET['search']))
{
$search = $_GET['search'];
}
$keywords = explode(" ", $search);
$query = "SELECT id_work, name_work, worktype_work, notes_work, artistID_work FROM work " .
"WHERE notes_work LIKE '%".$keywords['0']."%' OR worktype_work LIKE '%".$keywords['0']."%' OR name_work LIKE '%".$keywords['0']."%' ";
for ($i=1; $i<count($keywords); $i++) {
$query = $query." notes_work LIKE '%".$keywords[$i]."%'";
}
$result = mysql_query($query) or die(mysql_error());
$totalRows_result = mysql_num_rows($result);
?>
Can anyone help?
Regards
Milo