JasonLewis Posted September 14, 2008 Share Posted September 14, 2008 You're breaking out of the query incorrectly. $query = "select * from items where Category = '.$_POST['searchtype'].'"; See how you open the string with " but then when you get the the = you break out using '. Try this: $query = "select * from items where Category = ".$_POST['searchtype'].""; Link to comment https://forums.phpfreaks.com/topic/124099-not-that-urgent-offer-your-free-help-at-any-time-you-wish/page/2/#findComment-640820 Share on other sites More sharing options...
sabo86 Posted September 14, 2008 Author Share Posted September 14, 2008 Thanks for that.. I am trying to re structure my code because i am not getting results.. what's the problem in this code: if($_POST['searchtype']="Accessories") {$field="Accessories";} else if ($_POST['searchtype']="Seatings") {$field="Seatings";} else if ($_POST['searchtype']="Local Office Furniture") {$field="Local Office Furniture";} else if ($_POST['searchtype']="European Office Furniture") {$field="European Office Furniture";} $query = "select * from items where Category = $field; The error i am getting is : Parse error: parse error, unexpected '>' in C:\Program Files\EasyPHP 2.0b1\www\test fleifel\results.php on line 55 and line 55 is : echo "<p>Number of records found: ".$num_results."</p>"; Link to comment https://forums.phpfreaks.com/topic/124099-not-that-urgent-offer-your-free-help-at-any-time-you-wish/page/2/#findComment-640840 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.