- Joined
- Sep 10, 2002
- Messages
- 5,834
- Reaction score
- 75
I have the following mysql table structures.
field1 - int
field2 - int
field3 - varchar(100)
To insert data through MySQL:
INSERT INTO `table` (`field1`, `field2`, `field3`) VALUES
(0-1234567, 1350841806, 0xC02E1B43BA78800200),
I run a query.
SELECT * FROM `table`
the field1 out is -1234567, omitting the prefix 0
the field3 output show a 'unreadable data' but that's fine because I can use Hex(field3) to show me the hex value.
To insert data through PHP script:
When I create a php insert.php with the following code?
$sql="INSERT INTO table (field1, field2, field3) VALUES ('$field1','$field2','$field3')";
I run a query.
SELECT * FROM `table`
the field1 output is 0-1234567, this the actual data retaining the beginning 0 (zero).
the field3 output is 0xC02E1B43BA78800200, not the 'unreadable data'
Why the field1 and field3 is not the same value when I insert through MySQL (phpAdmin) and using PHP script?
Thank you,
em @ king.net
field1 - int
field2 - int
field3 - varchar(100)
To insert data through MySQL:
INSERT INTO `table` (`field1`, `field2`, `field3`) VALUES
(0-1234567, 1350841806, 0xC02E1B43BA78800200),
I run a query.
SELECT * FROM `table`
the field1 out is -1234567, omitting the prefix 0
the field3 output show a 'unreadable data' but that's fine because I can use Hex(field3) to show me the hex value.
To insert data through PHP script:
When I create a php insert.php with the following code?
$sql="INSERT INTO table (field1, field2, field3) VALUES ('$field1','$field2','$field3')";
I run a query.
SELECT * FROM `table`
the field1 output is 0-1234567, this the actual data retaining the beginning 0 (zero).
the field3 output is 0xC02E1B43BA78800200, not the 'unreadable data'
Why the field1 and field3 is not the same value when I insert through MySQL (phpAdmin) and using PHP script?
Thank you,
em @ king.net