MySQL Forums
Forum List  »  InnoDB

UPDATE statement not working.
Posted by: DTangent st102jd4
Date: February 19, 2005 01:10PM

Can someone take a look at this and tell me whats up? I get no errors, everything looks ok, but the update doesn't happen. I can run the same sql statement in MySQL Query browser and it works fine.

::here is the code snipit::
echo 'Moving<br>';

$sql = "SELECT FolderID FROM " . FL_FOLDERS_TBL . " WHERE ParentID = $nID AND UserID = $UserID";
echo "$sql <br>";
$result = @mysql_query($sql, $db->db_connect_id);//$db->sql_query($sql);
while($row = @mysql_fetch_assoc($result))//$db->sql_fetchrow($result))
{
$sql = "UPDATE " . FL_FOLDERS_TBL . " SET ParentID = $nParentID WHERE FolderID = " .
$row['FolderID'];

echo "$sql <br>";

if(!@mysql_query($sql, $db->db_connect_id))//$db->sql_query($sql))
{
echo @mysql_error();
return PostErrorBlock('Failed to move folders to parent');
}
}

::here is what is being echoed::
Moving
SELECT FolderID FROM LSCMS_fl_folders WHERE ParentID = 7 AND UserID = 2
UPDATE LSCMS_fl_folders SET ParentID = 2 WHERE FolderID = 9


::here is what is in the db - before and after the query::
FolderID - UserID - FolderType - ParentID - FolderName - ItemOrder - Hidden
9, 2, 1, 7, 'Loser2', 0, 0

::here is the table layout::
CREATE TABLE `LSCMS_fl_folders` (
`FolderID` int(11) NOT NULL auto_increment,
`UserID` int(11) NOT NULL default '0',
`FolderType` int(11) NOT NULL default '0',
`ParentID` int(11) NOT NULL default '0',
`FolderName` varchar(255) NOT NULL default '',
`ItemOrder` int(11) NOT NULL default '0',
`Hidden` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`FolderID`)
) TYPE=InnoDB;

Options: ReplyQuote


Subject
Views
Written By
Posted
UPDATE statement not working.
4284
February 19, 2005 01:10PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.