lollabelt Posted September 13, 2010 Share Posted September 13, 2010 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 Share on other sites More sharing options...
Maq Posted September 13, 2010 Share Posted September 13, 2010 What's the error? Link to comment Share on other sites More sharing options...
lollabelt Posted September 13, 2010 Author Share Posted September 13, 2010 Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING (......on line 33) Link to comment Share on other sites More sharing options...
fenway Posted September 13, 2010 Share Posted September 13, 2010 That's nota mysql error. Link to comment Share on other sites More sharing options...
Maq Posted September 13, 2010 Share Posted September 13, 2010 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 Share on other sites More sharing options...
fenway Posted September 15, 2010 Share Posted September 15, 2010 Other post? Topic locked -- and don't double-post next time; that's a violation of the ToS. Link to comment Share on other sites More sharing options...
Recommended Posts