note 93017 added to language.basic-syntax
| From: | (somewhat) | Date: | Wed, 19 Aug 2009 19:39:36 +0000 |
| Subject: | note 93017 added to language.basic-syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159649@lists.php.net to get a copy of this message | ||
What is wrong in this code. When I run it is says: "Parse error: syntax error, unexpected $end
in /home/a3487048/public_html/search.php on line 48"
<?php
//get data
$button = $_GET['submit'];
$search = $_GET['search'];
if (!$button)
echo "You didn't submit a keyword.";
else
{
if (strlen($search)<=2)
echo "Search term too short.";
else
{
echo "You searched for $search<hr size'1'>";
}
}
//connect to database
mysql_connect("dbhost","user","password");
mysql_select_db("dbname");
$search_exploded = explode(" ",$search);
foreach($search_exploded as $search_each)
{
$x++;
if ($x==1)
$construct .= "keywords LIKE '%$search_each%'";
else
{
$construct .= " OR keywords LIKE '%$search_each%'";
}
$construct = "SELECT * FROM searchengine WHERE $construct";
$run = mysql_query($construct);
$foundnum = mysql_num_rows($run);
if ($foundnum==0)
echo "Sorry no results found.";
else
echo "$foundnum results found! <p>";
?>
----
Server IP: 69.147.83.197
Probable Submitter: 24.31.177.37
----
Manual Page -- http://www.php.net/manual/en/language.basic-syntax.php
Edit -- https://master.php.net/note/edit/93017
Del: integrated -- https://master.php.net/note/delete/93017/integrated
Del: useless -- https://master.php.net/note/delete/93017/useless
Del: bad code -- https://master.php.net/note/delete/93017/bad+code
Del: spam -- https://master.php.net/note/delete/93017/spam
Del: non-english -- https://master.php.net/note/delete/93017/non-english
Del: in docs -- https://master.php.net/note/delete/93017/in+docs
Del: other reasons-- https://master.php.net/note/delete/93017
Reject -- https://master.php.net/note/reject/93017
Search -- https://master.php.net/manage/user-notes.php