FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


mysql wont delete [solved]





devroom
hi

mysql should change a message, but it doesnt. I does delete the message if i have changed the " trash='0' " to " trash='1' " manually. But it should be done by script.

Please take a look. I just cant find the wrong code.

PS. the error is not #__cpms_inbox and pls take also a look at http://www.frihost.com/forums/vt-40869.html (an other error)

Code:
$deletemessage = "SELECT id,trash FROM #__cpms_inbox WHERE id='$message_id' and username='$my->username'";
$database->setQuery($deletemessage);
$result = $database->query();
$field = mysql_fetch_assoc($result);
if (empty($field['id'])) {
mosRedirect($base_url."&func=msg&id=err1");
exit;}
if ($field['trash']==0) {
$totrash = "UPDATE FROM #__cpms_inbox SET trash='1' WHERE id='$message_id'";
$database->setQuery($totrash);
$changed = $database->query();
mosRedirect($base_url."&func=msg&id=del1");
} else {
$delete = "DELETE FROM #__cpms_inbox WHERE id='$message_id'";
$database->setQuery($delete);
$deleted = $database->query();
mosRedirect($base_url."&func=msg&id=del2"); }


Evil or Very Mad OMG it just had to be "UPDATE #__cpms_inbox SET trash='1' WHERE id='$message_id'"
And ive been trying things for years. But it works now
bladesage
Have you tried to add a die message to all the database functions?

Code:
mysql_query([your query]) or die("ERROR<br /><br />[your query]<br /><br />".mysql_error())


Using this nice little piece of code, you can find out exactly what's going into the mysql engine. This makes it much easier, as you can see what, if any, flaws there are in the script, and it can also report how the mysql engine responded.

If this doesn't work, I don't know what to tell you.
Related topics
New Install of XP instructions please
Is my web will be delete, if no action for a long time ?
name server??
cpanel is no good
SQL error on my site
I need Linux Installation Help:: PLEASE HELP ME!!!
Apache-created file is not deleting.
My site is noob site. I need pointers.
Resetting account question.
Mysql wont connect Hmmm
My Introduction - Saurav
Cheap XHTML and CSS services
MySQL wont let me connect.
Can't Delete files from my site
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.