I am trying to create a script that use the variable passed to it from an HTML form to search 2 tables in my database and display the results from both tables, i have created the script but each time i run i always get this error message:
Parse error: parse error in /var/www/html/search.php on line 545
I think its a problem with the query PHP is passing to mysql, i've looked through the code but can't figure it our, please help
Code: Select all
<?php
//Create short variable names
$search = $HTTP_POST_VARS['search'];
$search= trim($search);
if (!$search)
{
echo '<p style= "font-size: 15pt color: red"><strong>You have not specified a search term. Please go back and try again.</strong></p>';
exit;
}
$search = addslashes($search);
$session = mysql_connect('localhost', '', '') or die(mysql_error());
if (!$session)
{
echo 'Error: Could not connect to database. Please try again later.';
exit;
}
mysql_select_db('xplosive')or die(mysql_error());
$query = "select *
from movies, music
where movies.Title like '%".$search."%'", && music.Title like '%".$search.'%";
$result = mysql_query($query) or die(mysql_error());
$num_results = mysql_num_rows($result);
echo '<p style= "font-size: 10pt"><strong>Search hits: '.$num_results.'></strong></p>';
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo '<p style= "font-size:14pt; color: blue"><strong>'. ($i+1). ':';
echo htmlspecialchars (stripslashes($row['Title']));
echo '<p style= "font-size: 12pt; color: black"<br />Genre: ';
echo stripslashes($row['Genre']);
echo '<br/> Synopsis: ';
echo stripslashes ($row['Synopsis']);
echo'<br> Price: ';
echo stripslashes ($row['Price']);
echo '<br> Cat Number: ';
echo stripslashes ($row['Cat_No']);
echo '</p>';