Jump to content

value not being stored in db


rbragg

Recommended Posts

The problem: Why isn't my table being updated with $details??

 

During testing, I successfully echo $old, $new, and $details ... yet, $details is not updating my table.

 

<?php
# select old details for appending
$queryDetails = " 
SELECT details, time_update
FROM call
WHERE call_num = '$callID'
";
$detailsResults = mysql_query($queryDetails);
$oldDetails = mysql_fetch_assoc($detailsResults);
$old = $oldDetails['details'];

# get new details
$new = mysql_real_escape_string($_SESSION['tDetails']);
$newTime = date('M j, y @ h:i a' );

if ( empty($old) ) # if no old details
{
  $details = $new;
}
else
{
  $details = $old . "<br><br>" . $newTime . ": " . $new;
}

# only if new details were entered, then update; if not then do not update
if ( !empty($details) )
{			
  $queryUpdateDetails = " 
  UPDATE call
  SET details = '$details'
  WHERE call_num = '$callID'
  ";
  $updateDetails = mysql_query($queryUpdateDetails);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/63575-value-not-being-stored-in-db/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.