What's being invisibley entered here?
Posted: Sat Jan 12, 2008 8:23 am
Something that has been puzzling me and I wonder if anybody can let me know what’s happening.
In my MySQL database I have the values in a specific field set to ‘null’ so that if an entry is made without a value sent to the database is will automatically set this to ‘null’. However when I run the following code my database shows a ‘blank’ field when I view this under phpMyAdmin when I expect to see ‘Null’ in italics. The field in phpMyAdmin looks empty when I click to view it and I cannot see any white space that might have been added by the query below.
Can anyone point out what’s invisible being sent to the database?
Thanks
In my MySQL database I have the values in a specific field set to ‘null’ so that if an entry is made without a value sent to the database is will automatically set this to ‘null’. However when I run the following code my database shows a ‘blank’ field when I view this under phpMyAdmin when I expect to see ‘Null’ in italics. The field in phpMyAdmin looks empty when I click to view it and I cannot see any white space that might have been added by the query below.
Can anyone point out what’s invisible being sent to the database?
Thanks
Code: Select all
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO news (details) VALUES ('%s')",
$_POST['details']);
<form enctype="multipart/form-data" method="post" name="form1" action="<?php echo $editFormAction; ?>">
Details:<textarea name="details" cols="50" rows="5"></textarea>
<input type="submit" value="Insert record">
<input type="hidden" name="MM_insert" value="form1">
</form>