boo_lolly Posted November 16, 2006 Share Posted November 16, 2006 i don't see anything wrong with it... what's the deal? this is the results page that displays the results of a search query.[b]Parse error: parse error in ../../../../merchandise/testreg/results.php on line 21[/b][code=php] @ $db = mysql_connect("localhost", "apache", "R3GP@SS!"); if(!$db) { echo "Error: Could not connect to the database. Please try again later."; exit; } mysql_select_db("registry_DB, $db); $sql = mysql_query("SELECT brideLname, groomLname FROM my_search_table WHERE brideLname LIKE '%". $lname ."%' OR groomLname LIKE '%". $lname ."%'") or die(mysql_error();//<--- LINE 21 (entire SQL statement is on one line $result = mysql_query($sql); $num_result = mysql_num_rows($result); echo "Number of matches: ". $num_result ."<br />";[/code] Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 16, 2006 Share Posted November 16, 2006 Ah yes, the "Parse Error"!Many, many times that indicates that the error is actually on an earlier line - it's just that the interpreter doesn't know theres a mistake until it gets to a later line.Look at the line before line 21:[code]mysql_select_db("registry_DB, $db);[/code]You have no closing quote for the database name! Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted November 16, 2006 Author Share Posted November 16, 2006 i'm an idiot. i'm sorry i waste bandwidth with simple errors like this. but that wasn't the problem. it still doesn't work. it still gives me the same error. but i believe you are right, the problem is probably not on line 21... but earlier. Quote Link to comment Share on other sites More sharing options...
sford999 Posted November 16, 2006 Share Posted November 16, 2006 Look here[code]mysql_select_db("registry_DB, $db);[/code]It should be:[code]mysql_select_db("registry_DB", $db);[/code] Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted November 16, 2006 Author Share Posted November 16, 2006 THANKS. my 'or die' function was missing an extra ')' as well. thanks! Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted November 16, 2006 Author Share Posted November 16, 2006 the tables don't exist yet, but the database does... i get the following error when i click the submit button for a search. it seems to be combining my database name AND my table name....[b]Table 'registry_DB.my_search_table' doesn't exist[/b]my database name is 'registry_DB'. my table name is 'my_search_table'. what's the deal here? Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 16, 2006 Share Posted November 16, 2006 That is how it references a table - [i]DatabaseName.TableName[/i]Because you don't have the table yet it is generating an appropriate error message. Quote Link to comment 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.