sahkan_dengran
10-13-2012, 12:52 PM
Hii i have another problem.
it is write to me:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/****/public_html/search.php on line 23
and i dont know why.
(i do the ***** because there was wroten the username and i dont wanna to be hacked)
this is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Search</title>
</head>
<body>
<?php
if(isset($_POST['submited']))
{
function my_err($my_msg)
{
global $failed;
global $err_msg;
if ($failed == FALSE)
{
$failed=TRUE;
$err_msg .="Error(s): <br /> \n";
}
$err_msg .= "$my_msg <br /> \n";
}
$start=mysql_query("SELECT `link`, `username` FROM `users` WHERE `username` LIKE '%".$_POST['searchTXT']."%' LIMIT ".$_GET['page'] * 10 - 10.", ".$_GET['page'] * 10);
if(mysql_num_rows($start) == 0)
{
my_err('User not found');
}
else
{
while($info=mysql_fetch_array($start))
{
$info['username'] = str_replace($info['username'], '<b>'.$info['username'].'</b>;
echo '<div>';
echo $info['username'].'<br />';
echo '<a href="'.$info['link'].'">Go to profile</a>';
echo '</div>';
echo '<br />';
}
$start=mysql_query("SELECT `id` FROM `users` WHERE `username` LIKE '%".$_POST['searchTXT']."%'");
$rows=round(mysql_num_rows($start));
for($i = 1; $i <= $rows; $i++);
{
if($i == $_GET['page'])
{
echo '<a href="search.php?page='.$i.'"><b>'.$i.'</b></a>';
continue;
}
echo '<a href="search.php?page='.$i.'">'.$i.'</a>';
}
echo '</span>';
echo '</body>
</html>';
exit;
}
?>
<?php
if($failed)
echo '<span>'.$err_msg.'</span>';
?>
<form action="search.php" method="post">
<span>Search :</span><input type="text" name="searchTXT" />
<input type="submit" name="submited" value="TRUE" />
</form>
</body>
</html>
And i check and the db have all the fields.
PLEASE HELP ME!!
it is write to me:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/****/public_html/search.php on line 23
and i dont know why.
(i do the ***** because there was wroten the username and i dont wanna to be hacked)
this is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Search</title>
</head>
<body>
<?php
if(isset($_POST['submited']))
{
function my_err($my_msg)
{
global $failed;
global $err_msg;
if ($failed == FALSE)
{
$failed=TRUE;
$err_msg .="Error(s): <br /> \n";
}
$err_msg .= "$my_msg <br /> \n";
}
$start=mysql_query("SELECT `link`, `username` FROM `users` WHERE `username` LIKE '%".$_POST['searchTXT']."%' LIMIT ".$_GET['page'] * 10 - 10.", ".$_GET['page'] * 10);
if(mysql_num_rows($start) == 0)
{
my_err('User not found');
}
else
{
while($info=mysql_fetch_array($start))
{
$info['username'] = str_replace($info['username'], '<b>'.$info['username'].'</b>;
echo '<div>';
echo $info['username'].'<br />';
echo '<a href="'.$info['link'].'">Go to profile</a>';
echo '</div>';
echo '<br />';
}
$start=mysql_query("SELECT `id` FROM `users` WHERE `username` LIKE '%".$_POST['searchTXT']."%'");
$rows=round(mysql_num_rows($start));
for($i = 1; $i <= $rows; $i++);
{
if($i == $_GET['page'])
{
echo '<a href="search.php?page='.$i.'"><b>'.$i.'</b></a>';
continue;
}
echo '<a href="search.php?page='.$i.'">'.$i.'</a>';
}
echo '</span>';
echo '</body>
</html>';
exit;
}
?>
<?php
if($failed)
echo '<span>'.$err_msg.'</span>';
?>
<form action="search.php" method="post">
<span>Search :</span><input type="text" name="searchTXT" />
<input type="submit" name="submited" value="TRUE" />
</form>
</body>
</html>
And i check and the db have all the fields.
PLEASE HELP ME!!