Ok I'm having trouble with submitting an integer value into MySQL
I've also tried
and
I get
I've been entering 5 as my number in the input box and I get the value num from the form and I've tried the following for the POST variable
I've even changed type on the input box to integer o.O but text/integer both have same result
anybody can help?
I started learning PHP a week ago and I can't get the INSERT for MySQL to work for an integer. I can submit text and such, but the integer I'm having trouble with :/
| Code: |
|
$add=mysql_query("INSERT INTO testtable SET num=$num"); |
I've also tried
| Code: |
|
$add=mysql_query("INSERT INTO `testtable` SET `num`=`$num`"); |
and
| Code: |
|
$add=mysql_query("INSERT INTO testtable SET num='$num'"); |
I get
| Quote: |
| Error adding entry: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'num=5' at line 1 |
I've been entering 5 as my number in the input box and I get the value num from the form and I've tried the following for the POST variable
| Code: |
|
$num=$_POST['num']; $num=intval($_POST['num'], 10); $num=(int)$_POST['num']; |
I've even changed type on the input box to integer o.O but text/integer both have same result
| Code: |
| <input type="integer" name="num" value="" /> |
anybody can help?
I started learning PHP a week ago and I can't get the INSERT for MySQL to work for an integer. I can submit text and such, but the integer I'm having trouble with :/
