PDA

View Full Version : Whats wrong, please help.


jakx12
01-26-2009, 11:09 AM
Here's the code, it gives me this error: Parse error: syntax error, unexpected T_LNUMBER in /home/a8896310/public_html/searchresult.php on line 22

And the code:
<html>
<head>
<link rel=stylesheet type=text/css href=style.css>
<title>
Search Results
</title>
</head>
<body>
<?php include("header.php"); ?>
<center>
<div class=indexboxlarge2>
<?php
SESSION_start();
include("dbcon.php");
$searchresult = $_POST['result'];
dbcon();
$sql = 'SELECT * FROM user_info WHERE 1_name LIKE '%$searchresult%' OR WHERE 2_name LIKE '%$searchresult%';
$query = mysql_query($sql) or die(mysql_error());
$total = mysql_num_rows($query);
if ($total>0) {
while ($row = mysql_fetch_array($query)) {
echo $row['1_name'];
echo " ";
echo $row['2_name'];
echo "<br>";
echo "<br>";
}
}
else
{
echo "Sorry there results to display.";
}

?>
</div>
</center>
</body>
</html>


Any help will be much appreciated, thanks.

Steven
01-26-2009, 07:23 PM
Please do not post your thread twice. :) Thanks.

Papeh
01-28-2009, 12:20 AM
I'm not an expert on PHP errors, but I am one to mess things up. Error messages that look like yours, in my experience, means you put a character where you were not supposed to.

Take this :

$sql = 'SELECT * FROM user_info WHERE 1_name LIKE '%$searchresult%' OR WHERE 2_name LIKE '%$searchresult%';

You started the statement with an apostrophe, yet use the same character throughout to identify table names. I think that may be something gone wrong with the script.

I'd say go through your script and see that you didn't do any errors like that- forgetting to put quotes, braces, parentheses, etc.