messy Posted August 22, 2009 Share Posted August 22, 2009 I am very new to all of this but maybe someone could put my on the right track - thanks a mill ERROR IN FIREFOX AFTER SEARCH You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM AllData where 1=1 AND AllData.Restaurant = 1' at line 1 CODE - SEARCH RESULTS PAGE <?php require_once('connections/testing.php'); ?> <?php //search value $searchByCounty = $_POST['county']; $searchByCategory = $_POST['category']; mysql_select_db($database_Testing, $Testing); $query_Recordset1 = "SELECT AllData.Restaurant, AllData.Producer, AllData.Cookery_School, AllData.Caterer, AllData.Consultant, AllData.Accomodation, AllData.Patron, AllData.Freelance, AllData.Lecturer, AllData.Name, AllData.Address1, AllData.Address2, AllData.Address3, AllData.County, AllData.Tel, AllData.Fax, AllData.Email, AllData.Website, AllData.Proprietor, AllData.Chef, AllData.Member1, AllData.Location, AllData.Description, AllData.Additional_Info, AllData.Wheelchair_Access, AllData.OH_Lunch, AllData.OH_Dinner, AllData.Closed, FROM AllData where 1=1"; if($searchByCounty !="All" && $searchByCounty !="") { $query_Recordset1 = $query_Recordset1 . " AND AllData.County Like '%" . $searchByCounty . "%'"; } if ($searchByCategory =="Restaurant") { $query_Recordset1 = $query_Recordset1 . " AND AllData.Restaurant = 1"; } else if ($searchByCategory == "Producer") { $query_Recordset1 = $query_Recordset1 . " AND AllData.Producer = 1"; } else if($searchByCategory == "Cookery_School") { $query_Recordset1 = $query_Recordset1 . " AND AllData.Cookery_School = 1"; } else if($searchByCategory == "Caterer") { $query_Recordset1 = $query_Recordset1 . " AND AllData.Caterer = 1"; } else if($searchByCategory == "Consultant") { $query_Recordset1 = $query_Recordset1 . " AND AllData.Consultant = 1"; } else if($searchByCategory == "Accomodation") { $query_Recordset1 = $query_Recordset1 . " AND AllData.Accomodation = 1"; } else if($searchByCategory == "Patron") { $query_Recordset1 = $query_Recordset1 . " AND AllData.Patron = 1"; } else if($searchByCategory == "Freelance") { $query_Recordset1 = $query_Recordset1 . " AND AllData.Freelance = 1"; } else if($searchByCategory == "Lecturer") { $query_Recordset1 = $query_Recordset1 . " AND AllData.Lecturer = 1"; } $Recordset1 = mysql_query($query_Recordset1, $Testing) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> Quote Link to comment https://forums.phpfreaks.com/topic/171396-error-in-your-sql-syntax-please-help-thanks/ Share on other sites More sharing options...
corbin Posted August 22, 2009 Share Posted August 22, 2009 AllData.Closed, FROM Should be AllData.Closed FROM Quote Link to comment https://forums.phpfreaks.com/topic/171396-error-in-your-sql-syntax-please-help-thanks/#findComment-904085 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.