Shoutbox

Delete entry from MySQL Database - Failing - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Delete entry from MySQL Database - Failing (/showthread.php?tid=30282)

Delete entry from MySQL Database - Failing by matty on 08-22-2004 at 06:33 AM

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;

?>

RE: Delete entry from MySQL Database - Failing by WDZ on 08-22-2004 at 06:40 AM

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.


RE: Delete entry from MySQL Database - Failing by matty on 08-22-2004 at 06:42 AM

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?
RE: Delete entry from MySQL Database - Failing by Mippo on 08-22-2004 at 06:45 AM

Add another

code:
$result = mysql_query($query, $link);
in the end and then it should work. :)
RE: Delete entry from MySQL Database - Failing by matty on 08-22-2004 at 06:54 AM

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.
RE: Delete entry from MySQL Database - Failing by bach_m on 08-22-2004 at 02:25 PM

the $link in't actually necesary, unless you have more than one connection open


RE: Delete entry from MySQL Database - Failing by WDZ on 08-23-2004 at 12:01 AM

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