Hey people,
Looking for help again! Ok here goes. I'm trying to clear a value from a table. That works fine but when I try to redisplay what I had, my select query doesn't work anymore since the value has been changed and is no longer existing in one table. Now here is what I'm trying to do in more detailed:
I have a php page that has the following code:
$SESSION['ABS_ID'] = $GET['Abstract_ID'];
$SESSION['current_page'] = "show_abstract.php?Abstract_ID=".$SESSION['ABS_ID'];
$SESSION['abstract_array'] = get_abstract_details($GET['Abstract_ID']);
display_abstract_details($_SESSION['abstract_array']);
I have a button on this page that is linked to: clear_link_author.php?Abstract_ID=2
Now here is the code for the get_abstract_details function:
function get_abstract_details($Abstract_ID)
{
if (!$Abstract_ID || $Abstract_ID=="")
return false;
$conn = db_connect();
$query = "select Abstract_ID, Title, Topic_ID, Other_Topic, Presentation_Type_ID, AV_ID, AV_Length, Language_ID, Notes, Doc_ID, Date_Received, Abstract_Information.Author_ID, Last_Name, First_Name from Abstract_Information, Authors where Abstract_ID='$Abstract_ID' and Abstract_Information.Author_ID = Authors.Author_ID";
$result = @($query);
if (!$result)
return false;
$result = @mysql_fetch_array($result);
return $result;
}
Here is part of my clear_link_author.php page:
if (clear_linked_author($GET['Abstract_ID']))
{
$SESSION['abstract_array'] = get_abstract_details($GET['Abstract_ID']);
display_abstract_details($SESSION['abstract_array']);
}
Here is the coding for the clear_linked_author function:
function clear_linked_author($abstract_id)
{
$conn = db_connect();
$query = "update Abstract_Information
set Author_ID =''
where Abstract_ID = '$abstract_id'";
$result = @($query);
if (!$result)
return false;
else
return true;
}
Now If I click on the clear button, it puts the Author_ID value to it's default value "0". If I recall the function get_abstract_details($_GET['Abstract_ID']);
it no longer picks up anything since the Author_ID value is no longer available in my table entitled "Authors". I was wondering what I should change in the following query to make it work even though the Author_ID doesn't exist anymore.
$query = "select Abstract_ID, Title, Topic_ID, Other_Topic, Presentation_Type_ID, AV_ID, AV_Length, Language_ID, Notes, Doc_ID, Date_Received, Abstract_Information.Author_ID, Last_Name, First_Name from Abstract_Information, Authors where Abstract_ID='$Abstract_ID' and Abstract_Information.Author_ID = Authors.Author_ID";
$result = @($query);
Can someone help? :bemused: