List Info

Thread: Parsing from string to int




Parsing from string to int
user name
2006-11-10 20:48:20
I am attempting to insert data from a HTML form into a MySQL
table
using PHP. Here is the command:

$query="INSERT INTO review_registration()
VALUES('$FName', '$LName',
'$Company', '$Title', '$Address', '$Apt','$City', '$State',
$Zip,
$Phone, $Fax, '$Email', '$Var1', '$Var2', '$Var2', '$Var3',
'$Var3')";

The query works fine, if I put $Zip, $Phone and $Fax in
single quotes.
However, the data doesn't get entered into the table
correctly. Without
the quotation marks it views $Zip, $Phone and $Fax as column
ids.

It was mentioned elsewhere that I need to parse these. I am
guess that
I need to parse them into int from string.  I parsed $Var1
into a date
using gmdate() but haven't been able to locate other parsing
functions
for converting into an int. Is this the correct way to go?
Should I
throw some PHP code over into the HTML form to parse the
variable
before test.php is called?


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "PHP & MySQL" group.
To post to this group, send email to phpmysqlgooglegroups.com
To unsubscribe from this group, send email to
phpmysql-unsubscribegooglegroups.com
For more options, visit this group at ht
tp://groups-beta.google.com/group/phpmysql?hl=en
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )