954,190 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

is there something wrong with my SQL statement?

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

@ $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 ."";
boo_lolly
Light Poster
35 posts since Nov 2006
Reputation Points: 10
Solved Threads: 1
 

You are missing a ')'

die(mysql_error()<strong>)</strong>
stymiee
He's No Good To Me Dead
Moderator
3,360 posts since May 2006
Reputation Points: 161
Solved Threads: 38
 

you're the man...
You are missing a ')'

die(mysql_error()<strong>)</strong>
boo_lolly
Light Poster
35 posts since Nov 2006
Reputation Points: 10
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?

boo_lolly
Light Poster
35 posts since Nov 2006
Reputation Points: 10
Solved Threads: 1
 

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.

stymiee
He's No Good To Me Dead
Moderator
3,360 posts since May 2006
Reputation Points: 161
Solved Threads: 38
 

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

@ $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 ."";



you have no text box... how would you search and your html form?

hazel_0821
Newbie Poster
5 posts since Nov 2006
Reputation Points: 10
Solved Threads: 0
 

The form may be on another page!

You can then use $_REQUEST['TBOXNAME']; to get the information.

phper
Posting Whiz in Training
213 posts since Nov 2006
Reputation Points: 22
Solved Threads: 19
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You