| | |
is there something wrong with my SQL statement?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2006
Posts: 35
Reputation:
Solved Threads: 1
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.
Parse error: parse error in ../../../../merchandise/testreg/results.php on line 21
Parse error: parse error in ../../../../merchandise/testreg/results.php on line 21
php Syntax (Toggle Plain Text)
@ $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 />";
Last edited by stymiee; Nov 16th, 2006 at 12:25 pm.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
•
•
Join Date: Nov 2006
Posts: 35
Reputation:
Solved Threads: 1
you're the man...
•
•
•
•
You are missing a ')'
die(mysql_error())
•
•
Join Date: Nov 2006
Posts: 35
Reputation:
Solved Threads: 1
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....
Table 'registry_DB.my_search_table' doesn't exist
my database name is 'registry_DB'. my table name is 'my_search_table'. what's the deal here?
Table 'registry_DB.my_search_table' doesn't exist
my database name is 'registry_DB'. my table name is 'my_search_table'. what's the deal here?
Last edited by boo_lolly; Nov 16th, 2006 at 1:49 pm.
That's just good error reporting. It helps that it is so specific as to avoid any confusion with similar table names in other databases.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
•
•
Join Date: Nov 2006
Posts: 5
Reputation:
Solved Threads: 0
•
•
•
•
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.
Parse error: parse error in ../../../../merchandise/testreg/results.php on line 21
php Syntax (Toggle Plain Text)
@ $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 />";
![]() |
Similar Threads
- Syntax error in "like" in sql statement (ASP.NET)
- Question about SQL statement (MS SQL)
- SQL statement error (ASP.NET)
- sql statement (Visual Basic 4 / 5 / 6)
- run sql statement in asp (ASP)
Other Threads in the PHP Forum
- Previous Thread: view employee info for the employee selected from the drop down list
- Next Thread: Image link in an email from php
| Thread Tools | Search this Thread |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search server sessions simple sms sockets source space spam sql syntax system table tutorial update upload url validator variable video web youtube






