richie19rich77 Posted June 7, 2009 Share Posted June 7, 2009 Hi Eveyone, Sorry I have looked now for the last hour or so, but am stuck on this very simple priblem. I am pulling data via the $_POST command and inserting into a mysql table. The output of the post command is "11-1". I wan to insert it into the table as "11-1" but it keeps converting it to "9". I have tried "settype", "intval", "intstr" but nothing. Sorry very basic. Thanks Link to comment https://forums.phpfreaks.com/topic/161264-11-1-converting-to-9/ Share on other sites More sharing options...
Daniel0 Posted June 7, 2009 Share Posted June 7, 2009 How are you storing it in the database (field type), and how are you inserting it? Link to comment https://forums.phpfreaks.com/topic/161264-11-1-converting-to-9/#findComment-850961 Share on other sites More sharing options...
richie19rich77 Posted June 7, 2009 Author Share Posted June 7, 2009 Field type is "TinyText". evan if I do $Leg1 = "11-1" if converts it. Does not work $Leg1 = $_POST['AX1']; mysql_query("INSERT INTO scores (Leg1) VALUES (".$Leg1.")"); Link to comment https://forums.phpfreaks.com/topic/161264-11-1-converting-to-9/#findComment-850962 Share on other sites More sharing options...
Daniel0 Posted June 7, 2009 Share Posted June 7, 2009 Put it in quotes and do remember to use mysql_real_escape_string. Link to comment https://forums.phpfreaks.com/topic/161264-11-1-converting-to-9/#findComment-850964 Share on other sites More sharing options...
richie19rich77 Posted June 7, 2009 Author Share Posted June 7, 2009 Tried that but still no luck. $Leg1 = mysql_real_escape_string($_POST['AX1']); Link to comment https://forums.phpfreaks.com/topic/161264-11-1-converting-to-9/#findComment-850970 Share on other sites More sharing options...
Daniel0 Posted June 7, 2009 Share Posted June 7, 2009 Forgot the quotes... $Leg1 = mysql_real_escape_string($_POST['AX1']); mysql_query("INSERT INTO scores (Leg1) VALUES ('".$Leg1."')"); Link to comment https://forums.phpfreaks.com/topic/161264-11-1-converting-to-9/#findComment-850980 Share on other sites More sharing options...
richie19rich77 Posted June 7, 2009 Author Share Posted June 7, 2009 You are a star, thank you for your help. Link to comment https://forums.phpfreaks.com/topic/161264-11-1-converting-to-9/#findComment-850981 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.