You need another question mark after INET_ATON. Also instead of setting a PHP variable you can just use the mysql function NOW().
Printable View
You need another question mark after INET_ATON. Also instead of setting a PHP variable you can just use the mysql function NOW().
If I use the function NOW() then it returns:
I'm not concerned about that at the moment.Quote:
Fatal error: Call to undefined function NOW()
After adding in the question mark at the end (and removing one preceeding the INET_ATON), it now inserts data into mysql!
Yay!
However... :(
oddly enough, it's only inserting either 1 or 0 values across the board, as opposed to actual values.
I.E.:
Quote:
idnumber;"employeename";"employeeref";"weeksperyear";"montownfrom";"monpostcodefrom";"montownto";"mo npostcodeto";"monmiles";"tuetownfrom";"tuepostcodefrom";"tuetownto";"tuepostcodeto";"tuemiles";"wedt ownfrom";"wedpostcodefrom";"wedtownto";"wedpostcodeto";"wedmiles";"thutownfrom";"thupostcodefrom";"t hutownto";"thupostcodeto";"thumiles";"fritownfrom";"fripostcodefrom";"fritownto";"fripostcodeto";"fr imiles";"sattownfrom";"satpostcodefrom";"sattownto";"satpostcodeto";"satmiles";"suntownfrom";"sunpos tcodefrom";"suntownto";"sunpostcodeto";"sunmiles";"summiles";"moncheck";"tuecheck";"wedcheck";"thuch eck";"fricheck";"satcheck";"suncheck";"monhours";"tuehours";"wedhours";"thuhours";"frihours";"sathou rs";"sunhours";"sumhours";"montravel";"tuetravel";"wedtravel";"thutravel";"fritravel";"sattravel";"s untravel";"monmealcheck";"tuemealcheck";"wedmealcheck";"thumealcheck";"frimealcheck";"satmealcheck"; "sunmealcheck";"moneveningmealcheck";"tueeveningmealcheck";"wedeveningmealcheck";"thueveningmealchec k";"frieveningmealcheck";"sateveningmealcheck";"suneveningmealcheck";"monovernightcheck";"tueovernig htcheck";"wedovernightcheck";"thuovernightcheck";"friovernightcheck";"satovernightcheck";"sunovernig htcheck";"declarationcheck";"ip";"created"
2;"1";"1";"0000-00-00";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1"; "1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"0";"0";"0";"0";"0";"0";"1";"1";"1";"1";"1";"1"; "1";"0";"1";"1";"1";"1";"1";"1";"1";"1";"0";"0";"0";"0";"0";"0";"1";"0";"0";"0";"0";"0";"0";"0";"0"; "0";"0";"0";"0";"0";"1";"2140706433";"28"
3;"1";"1";"0000-00-00";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1"; "1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"1";"0";"0";"0";"0";"0";"0";"1";"1";"1";"1";"1";"1"; "1";"0";"1";"1";"1";"1";"1";"1";"1";"1";"0";"0";"0";"0";"0";"0";"1";"0";"0";"0";"0";"0";"0";"0";"0"; "0";"0";"0";"0";"0";"1";"2140706433";"28"
This last one is bugging the hell out of me :(
I can't figure out why it's posting 1's and 0's...
Don't suppose you have any ideas Derokorian?
Sounds like the "NOW()" is being interpreted as a PHP function call, which suggests it's not properly in your SQL string (you want it to be called as a MySQL function).
PHP Code:// correct
$sql = "INPUT INTO table_name (datetime_column) VALUES (NOW())";
// incorrect
$sql = "INPUT INTO table_name (datetime_column) VALUES (" . NOW() . ")";
DO you think that's what's causing it to insert 1's and 0's instead of data from the form?
If anyone would be able to take a look at the code and help me in figuring out why it seems to only insert 1's and 0's into the mysql server, i would be forever grateful.
I'm tearing my hair out at this point!
Hi Lazarix,
to understand why its inserting 1s and 0s try running this code:
What's happening is the TRUE and FALSE are constants that map to 1 and 0, respectively. So when you try to insert them into the database, you end up with 1 and 0.PHP Code:<?php
$var = "something";
echo "Variable isset: " . isset($var);
echo "Variable not isset: " . isset($fake);
Edit: I must be wrong about FALSE as its not outputting anything. But the true version is inputting 1.
When I run that code it says:
Variable isset: 1Variable not isset:
I'd really appreciate anyone's help at this point! i'm really stuck with this 1 and 0 problem :(