I am doing a query on a table as follows:
function get_chapter_details(){
return mysql_query("
SELECT
city,
state,
leader,
membership,
mission_count,
creation_date
FROM
chapters
WHERE
id = " . addslashes($_GET['id']));
}
this works fine, but now I want to add another requirement in the WHERE section.
I am doing the following:
function get_chapter_details(){
return mysql_query("
SELECT
city,
state,
leader,
membership,
mission_count,
creation_date
FROM
chapters
WHERE
id = " . addslashes($_GET['id']) AND state = '". addslashes($_GET['state'])."');
}
And I'm getting the error:
Parse error: parse error, unexpected '=' in /xxx/includes/users.php on line 26
Of course, line 26 is
id = " . addslashes($_GET['id']) AND state = '". addslashes($_GET['state'])."');
Any ideas as to how I can make this work?
Thank you in advance.
function get_chapter_details(){
return mysql_query("
SELECT
city,
state,
leader,
membership,
mission_count,
creation_date
FROM
chapters
WHERE
id = " . addslashes($_GET['id']));
}
this works fine, but now I want to add another requirement in the WHERE section.
I am doing the following:
function get_chapter_details(){
return mysql_query("
SELECT
city,
state,
leader,
membership,
mission_count,
creation_date
FROM
chapters
WHERE
id = " . addslashes($_GET['id']) AND state = '". addslashes($_GET['state'])."');
}
And I'm getting the error:
Parse error: parse error, unexpected '=' in /xxx/includes/users.php on line 26
Of course, line 26 is
id = " . addslashes($_GET['id']) AND state = '". addslashes($_GET['state'])."');
Any ideas as to how I can make this work?
Thank you in advance.
Comment