I have two functions. One is delete_part($part_id) which deletes a video clip with the passed id from mysql db. The other one is delete_report($part_id). This one deletes a report with the given id from the mysql db. Both $part_id are same. Here are the functions.
function delete_part($part_id) { global $link, $page_name, $_GET; if ($part_id < 1) { display_header(); echo ("Error"); display_footer(); } display_header(); $sql = 'DELETE FROM parts WHERE part_id = ' . $part_id; $result = mysql_query($sql,$link); if ($result) { echo ("<br /><br /><b>Successfully deleted</b>"); } else echo ("Error: " . mysql_error()); display_footer();}
function delete_report ($part_id) { global $link,$db,$_GET,$_POST,$page_name; display_header(); if ($part_id < 1) { echo ("Invalid report!"); display_footer(); } $sql = "DELETE FROM report WHERE report_part = " . $part_id; $result = mysql_query($sql,$link); if (!result) { echo ("Error with deleting report: " . mysql_error()); display_footer(); } else $result; echo ("Report successfully deleted."); display_footer();}
Both work fine when called separately. But when I call them at the same time, the first function to be called work but the second one doesn't work. I tried placing both in different orders but only first one works. Anyone know why?