michaelk46 Posted October 29, 2009 Share Posted October 29, 2009 Can't figure this out... I keep getting this error: "Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\wamp\www\Work\Storage\index.php on line 36" Line 36 is $sql .= "'searchid' = ($_POST['searchid'])"; Anyone have any ideas why? if ($_SERVER['REQUEST_METHOD'] != "POST") { include "search.html.php"; } else { if(isset($_POST['searchid']) || (isset($_POST['pagename']))) { $sql = "SELECT * FROM `pages` WHERE "; } if(isset($_POST['searchid'])) { $sql .= "'searchid' = ($_POST['searchid'])"; } if(isset($_POST['searchid']),(isset($_POST['pagename'])) { $sql .= " and "; } if(isset($_POST['pagename'])) { $sql .= "'pagename' = ($_POST['pagename']) "; } else{ $sql .= "You must enter search terms"; } include "searchres.html.php"; } Link to comment https://forums.phpfreaks.com/topic/179548-solved-parse-error/ Share on other sites More sharing options...
MadTechie Posted October 29, 2009 Share Posted October 29, 2009 Found 3 syntax errors (see comments) <?php if ($_SERVER['REQUEST_METHOD'] != "POST") { include "search.html.php"; }else{ if(isset($_POST['searchid']) || (isset($_POST['pagename']))) { $sql = "SELECT * FROM `pages` WHERE "; } if(isset($_POST['searchid'])) { $sql .= "'searchid' = (".$_POST['searchid'].")"; //ADD ".." } if(isset($_POST['searchid']) && (isset($_POST['pagename']))) //ADDED ) { $sql .= " and "; } if(isset($_POST['pagename'])) { $sql .= "'pagename' = (".$_POST['pagename'].") ";//ADD ".." }else{ $sql .= "You must enter search terms"; } include "searchres.html.php"; } ?> EDIT: cleaned up formatting Link to comment https://forums.phpfreaks.com/topic/179548-solved-parse-error/#findComment-947449 Share on other sites More sharing options...
michaelk46 Posted October 29, 2009 Author Share Posted October 29, 2009 Thank You very much, that fixed it... Link to comment https://forums.phpfreaks.com/topic/179548-solved-parse-error/#findComment-947474 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.