Jump to content

Insert record field empty on insertion


geroido

Recommended Posts

Hi

Can anyone see what the problem might be with this sql. The record is being inserted but the recipientid field is empty. I know that $_SESSION['indwho']." contains a value because I've echoed it. The value is a string and the field is varchar. It remains empty for every record. Any ideas?

$insert = mysql_query("INSERT INTO `deliver`.`comments` (`userid` ,`recipientid` ,`comment` ,`date` ,`time` ,`forwho` ,`viewed`)
VALUES ('".$_SESSION['userid']."', '".$_SESSION['indwho']."', '".$_SESSION['content']."', '".$date."', '".$time."', 'ind', 'no')")
or die("Could not insert data because ".mysql_error());

Link to comment
Share on other sites

This ones killing me. I even assigned the session variable to a normal variale and it's still not working. The echos are showing that the string is held in the variable but it is still the only field that remains empty in the database after insertion. Help?

 

$_SESSION['indwho'] = $_GET['id'];
$type = $_SESSION['indwho'];


echo $_SESSION['indwho'];
echo $type;

$insert = mysql_query("INSERT INTO `deliver`.`comments` (`userid` ,`recipientid` ,`comment` ,`date` ,`time` ,`forwho` ,`viewed`)
VALUES ('".$_SESSION['userid']."', '".$type."', '".$_SESSION['content']."', '".$date."', '".$time."', 'ind', 'no')")
or die("Could not insert data because ".mysql_error());

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.