By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,046 Members | 1,244 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,046 IT Pros & Developers. It's quick & easy.

unknown parse error

P: n/a
I get a strange parse error in the following lines.
Can anyone see what I don't.

//Query the Database
$query = "SELECT type FROM `map`
WHERE map_file = " . $_SESSION['new_map'] . "
AND col = " . $_SESSION['new_col'] . "
AND row = " . $_SESSION['new_row']
$db_result = mysql_query($query);
$db_cell_type = mysql_fetch_array($result);

Any help is greatly appreciated.
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Ph47f3" <bt**@snowhill.com> wrote in message
news:14**************************@posting.google.c om...
I get a strange parse error in the following lines.
Can anyone see what I don't.

file://Query the Database
$query = "SELECT type FROM `map`
WHERE map_file = " . $_SESSION['new_map'] . "
AND col = " . $_SESSION['new_col'] . "
AND row = " . $_SESSION['new_row']
$db_result = mysql_query($query);
$db_cell_type = mysql_fetch_array($result);


You forget to write ';' at the end of AND row = " .
$_SESSION['new_row']

--
Wishes, Rostik Kerey
Jul 17 '05 #2

P: n/a
Ph47f3 wrote:
I get a strange parse error in the following lines.
Can anyone see what I don't.

//Query the Database
$query = "SELECT type FROM `map`
WHERE map_file = " . $_SESSION['new_map'] . "
AND col = " . $_SESSION['new_col'] . "
AND row = " . $_SESSION['new_row']
$db_result = mysql_query($query);
$db_cell_type = mysql_fetch_array($result);

Any help is greatly appreciated.


I betcha you're getting an "Unknown column 'x'" error, right? Try
surrounding your variables in quotes like so:

$query = "SELECT type from `map`
WHERE map_file = '$_SESSION[new_map]'
AND col = '$_SESSION[new_col]'
AND row = '$_SESSION[new_row]'";

-Jay

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.