Hi

i hav tbl_search table in my advocate_lawyer database

it contain following field:

name,city,view_details,websilte

in tat view details and website im add html link…also im insert tat link in my database…

then i want to search tat table…

im use this code for search:

<?php

/*set varibles from form */
$city=$_REQUEST[‘city’];
$name=$_REQUEST[‘name’];

trim ($city);
trim ($name);

require_once(“dbcon.php”);
/query the database/

$query = “select * from tbl_su where city=‘$city’ and name=‘$name’”;
$result =mysql_query($query);
/number of rows found/
$num_rows = mysql_num_rows($result);
echo ‘<p>Lawyer Information: ‘.$num_rows.’</p>’;
/loops through results/
echo “<table border=‘1’>
<tr>
<th>S.No</th>
<th>Name</th>
<th>City</th>
<th>View Details</th>
<th>Website</th>
</tr>”;

while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo “<tr>”;
echo “<td>” . $row[‘sno’] . “</td>”;
echo “<td>” . $row[‘name’] . “</td>”;
echo “<td>” . $row[‘city’] . “</td>”;
echo ‘<a href=“<?php echo $row[‘view_details’];?>”>’ . $row[‘view_details’] . ‘</a>’;
echo ‘<a href=“<?php echo $row[‘website’];?>”>’ . $row[‘website’] . ‘</a>’;
echo “</tr>”;
}
echo “</table>”;

/free database/
/$result->free();/

?>

but its shows following error:

Parse error: parse error, expecting ','' or ‘;’’ in D:\wamp\www\2-07-10\searchnew.php on line 135

pls solve this pbm…i need urs help…

well the good thing about errors is that they show you where the error is and guido2004 was nice enough to show you.

Sorry if i am sound like a jerk but i have a terrible headache…

You could always try googling the error because the fact that it is an error means the problem is known to exist.
Also spell-checking and using the forums’ tags to select and high-light syntax to encase you PHP code would be nice. :slight_smile:

Ill try to do some searching as soon as i can and will get back to you on what i find

Regards,
Team 1504


echo '<a href="<?php echo $row['view_details'];?>">' . $row['view_details'] . '</a>';
echo '<a href="<?php echo $row['website'];?>">' . $row['website'] . '</a>';

These are the lines with an error. Can you see it?

Edit: See guido2004’s post. (:

i saw it…but i cant able to find tat parse error…

pls can you help me…

You’re using single quotes inside a string delimited by single quotes. This makes the parser think the string ends there. If you need single quotes inside the string, you have to escape them.
But in this case, there’s no need for them. You don’t need to use an echo statement inside an echo statement :slight_smile:
Try this


echo '<a href="' . $row['view_details'] . '">' . $row['view_details'] . '</a>';
echo '<a href="' . $row['website'] . '">' . $row['website'] . '</a>';