josh dismukes wrote:[color=blue]
> //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);[/color]
What if your query fails?
You will never know about it until later, when your script fails for
some reason that can have little relation to the failed query.
Try inserting here:
if (!$db_result) die('query failed because ' . mysql_error());
I suspect not all of $_SESSION['new_map'], $_SESSION['new_col'], and
$_SESSION['new_row'] are integers. If they are strings they need quotes
around them.
[color=blue]
> $db_cell_type = @mysql_fetch_array($result);[/color]
$db_cell_type is an array!
[color=blue]
> //Evaluate the Cell Type
> if ($db_cell_type=='W'){[/color]
When you use it in comparisons with string it will be automagically
converted to "Array" (and "Array" != "W" always)
Probably you want
if ($db_cell_type['type'] == 'W') {
[color=blue]
> $_SESSION['new_col']=$_SESSION['old_col'];
> $_SESSION['new_row']=$_SESSION['old_row'];
> $_SESSION['new_map']=$_SESSION['old_map'];
> $_SESSION['celltype']='W';}
> elseif($db_cell_type=='T'){[/color]
same mistake as before
[color=blue]
> $query2 = "SELECT townID FROM map WHERE map_file = " .
> $_SESSION['new_map'] . " AND col = " . $_SESSION['new_col'] . " AND
> row = " . $_SESSION['new_row'];
> $db_result2 = @mysql_query($query2);
> $db_townid = mysql_fetch_array($db_result2);
> $_SESSION['townID'] = $db_townid;[/color]
and again
[color=blue]
> $_SESSION['is_town'] = 1;
> $_SESSION['celltype']='T';}
> else {
> $_SESSION['old_col']=$_SESSION['new_col'];
> $_SESSION['old_row']=$_SESSION['new_row'];
> $_SESSION['old_map']=$_SESSION['new_map'];
> $_SESSION['celltype']='L';}[/color]
HTH
--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :