...

View Full Version : another problem



sahkan_dengran
10-13-2012, 01: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!!

abduraooft
10-13-2012, 02:27 PM
You may get it by having a look at the color difference in the string, highlighted by the PHP editor in your post.

PS: Please avoid the use bold tags for the entire text in your posts, which may make a tone of shout.

sahkan_dengran
10-13-2012, 04:01 PM
You may get it by having a look at the color difference in the string, highlighted by the PHP editor in your post.

PS: Please avoid the use bold tags for the entire text in your posts, which may make a tone of shout.

i dont understand.....................
can you give me the full fixed code?

Fou-Lu
10-13-2012, 07:36 PM
Look at your code above. PHP markup highlight strings in red. Where you see a red echo that indicates that you have a previously opened single or double quote that has not been closed. The error will indicate on which line it detects that a failure happened, so it will be somewhere <= the line number in the error for a T_CONSTANT_ENCAPSED_STRING error. It ignores anything out of <?php?> blocks for line numbering.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum