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
https://forums.phpfreaks.com/topic/122511-insert-record-field-empty-on-insertion/
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());

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.