Jump to content

Recommended Posts

I am trying to build a yellowpages site that searches the database, and comes up with only a few fields (like name, address, phone) but gives a link to a more complete page with all the database fields echoed on to the page...Here is the code I have so far...(Please Note I am a total beginner php)... Right now I am just doing the MYsql part and then echoing that back, but it gives me an error!!

 

<?php

$con = mysql_connect("localhost","root","");

if (!$con)

{

die('Could not connect: ' . mysql_error());

}

 

mysql_select_db("general", $con);

 

$var = @$_POST['search'];

$trimmed = trim($var);

if ($trimmed == "")

{

echo "<p>Please enter a search...</p>";

exit;

}

 

 

$query = "SELECT * FROM gjbusinesses where name like \"%$trimmed%\" OR description like \"%$trimmed%\";

 

$result = mysql_query($query);

 

while($row = mysql_fetch_array($result))

{

echo $row['name'];

echo $row['phone'];

echo $row['address1];

echo $row['website'];

echo "Description:";

echo " ";

echo $row['description'];

echo "</strong>";

echo "<hr>";

echo "</hr>";

echo "<br />";

}

?>

 

Link to comment
https://forums.phpfreaks.com/topic/213305-please-help/
Share on other sites

 

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING (......on line 33)

 

Someone already told you the answer in your other post:

http://www.phpfreaks.com/forums/index.php/topic,309924.msg1463968.html#msg1463968

Link to comment
https://forums.phpfreaks.com/topic/213305-please-help/#findComment-1110685
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.