What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Delete entry from MySQL Database - Failing

Delete entry from MySQL Database - Failing
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. Delete entry from MySQL Database - Failing
ok short and sweet. The following code will not delete the entry from the database and nor Dane or myself can figure it out. Help me please :)

code:
<?

    $pid = ($post);

    $link=mysql_connect ("localhost", "izayne_admin", "matty") or die ('I cannot connect to the database because: ' . mysql_error());
    mysql_select_db ("izayne_news");

    $query = "SELECT * FROM IzzNews";
    $result = mysql_query($query, $link);
    $num = mysql_numrows($result);
    $query = "DELETE FROM IzzNews WHERE NewsNum=".$pid;

?>

This post was edited on 08-22-2004 at 06:34 AM by matty.
08-22-2004 06:33 AM
Profile E-Mail PM Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: Delete entry from MySQL Database - Failing
That's not the complete code, is it? Because the DELETE query is just stored in a string and not executed... :-/

The next thing that comes to mind is making sure that $pid actually contains a valid value.
08-22-2004 06:40 AM
Profile PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. RE: Delete entry from MySQL Database - Failing
quote:
Originally posted by WDZ
That's not the complete code, is it? Because the DELETE query is just stored in a string and not executed... :-/

The next thing that comes to mind is making sure that $pid actually contains a valid value.
pid does contain a value how would i execute it?
08-22-2004 06:42 AM
Profile E-Mail PM Find Quote Report
Mippo
Elite Member
*****

MJBZ!

Posts: 568
Reputation: 26
33 / Male / –
Joined: Apr 2003
RE: Delete entry from MySQL Database - Failing
Add another
code:
$result = mysql_query($query, $link);
in the end and then it should work. :)
08-22-2004 06:45 AM
Profile PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. RE: Delete entry from MySQL Database - Failing
quote:
Originally posted by Mippo
Add another
code:
$result = mysql_query($query, $link);
in the end and then it should work. :)
--> insert MSN Messenger conversation here <--
Thanks very much I really appreciate it, now I dont have to wreck my brain anymore trying to figure this out.
08-22-2004 06:54 AM
Profile E-Mail PM Find Quote Report
bach_m
Veteran Member
*****

Avatar
4837 :P

Posts: 2863
Reputation: 7
37 / Male / –
Joined: Feb 2003
RE: Delete entry from MySQL Database - Failing
the $link in't actually necesary, unless you have more than one connection open
08-22-2004 02:25 PM
Profile E-Mail PM Web Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: Delete entry from MySQL Database - Failing
quote:
Originally posted by bach_m
the $link in't actually necesary, unless you have more than one connection open
If we're gonna be picky, then you don't need the "$result = " on the second query either, since a DELETE query will only return true or false, and you probably don't care about checking that. :p
08-23-2004 12:01 AM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On