View Single Post
  #10 (permalink)  
Old October 6th, 2010, 05:48 PM
bopjo1 bopjo1 is offline
Authorized User
 
Join Date: Sep 2010
Posts: 20
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I isolated just the MySQL query exactly as written (without the AS) and put it in another file with an echo statement to see if it works like this:

Code:
<?php
require 'includes/db.inc.php'; 
$db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die ('Unable to connect');
mysql_select_db(MYSQL_DB, $db) or die(mysql_error($db));
         $query = 'SELECT 
       c.alias, c.real_name, c.alignment, 
       l.address, z.city, z.state, z.zipcode_id 
       FROM 
           comic_character c, comic_lair l, comic_zipcode AS z 
       WHERE 
           z.zipcode_id = l.zipcode_id AND 
           c.lair_id = l.lair_id AND 
           c.character_id = '. $character_id;

$result = mysql_query($query, $db) or die(mysql_error($db));

if (mysql_num_rows($result) > 0) {
	$action = 'Edit';
	$character = mysql_fetch_assoc($result);
	echo $character['alias'];
}
?>
And I keep getting this error:

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 9"

So there's something weird going on with that MySQL code...

If you have your version of edit_character.php handy I would appreciate it very much if you would post it. Thanks!
Reply With Quote