If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > very strange problem with insert command

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-15-03, 09:24
pelegk2 pelegk2 is offline
Registered User
 
Join Date: Nov 2003
Posts: 26
very strange problem with insert command

i am working php+mySql
i am trying to do a simple insert command :
$query2="INSERT INTO tblPrint (OrderNum,PrinterNum,DateTimeVal) Values('$order_num','$radio','$tmpDateTimeVal')";

when i havethis values :
$order_num=313.517;
$radio=1;
$tmpDateTimeVal=date("Y-m-d H:i:s");

when i check the mysql i see that the order_num value
is for some reason 3.517 ?!?!?!?!?!
why is that?any idea????
the more intresting if i do the same line with the same values it tels me its a duplicate key!!!!!!
but if i chek it from php with a select it tells m that that vakue dosent exist!!!!!!!!
help dont know what else to do!
Reply With Quote
  #2 (permalink)  
Old 12-16-03, 15:03
ika ika is offline
Registered User
 
Join Date: Oct 2003
Location: Slovakia
Posts: 482
Re: very strange problem with insert command

Quote:
Originally posted by pelegk2
i am working php+mySql
i am trying to do a simple insert command :
$query2="INSERT INTO tblPrint (OrderNum,PrinterNum,DateTimeVal) Values('$order_num','$radio','$tmpDateTimeVal')";

when i havethis values :
$order_num=313.517;
$radio=1;
$tmpDateTimeVal=date("Y-m-d H:i:s");

when i check the mysql i see that the order_num value
is for some reason 3.517 ?!?!?!?!?!
why is that?any idea????
the more intresting if i do the same line with the same values it tels me its a duplicate key!!!!!!
but if i chek it from php with a select it tells m that that vakue dosent exist!!!!!!!!
help dont know what else to do!
Check the SQL which was creted the table. Possible you was wrong with column order_num
Reply With Quote
  #3 (permalink)  
Old 12-18-03, 01:53
i4u_dev4 i4u_dev4 is offline
Registered User
 
Join Date: Oct 2003
Posts: 13
i am working php+mySql
i am trying to do a simple insert command :
$query2="INSERT INTO tblPrint (OrderNum,PrinterNum,DateTimeVal) Values('$order_num','$radio','$tmpDateTimeVal')";

when i havethis values :
$order_num=313.517;
$radio=1;
$tmpDateTimeVal=date("Y-m-d H:i:s");

when i check the mysql i see that the order_num value
is for some reason 3.517 ?!?!?!?!?!
why is that?any idea????
the more intresting if i do the same line with the same values it tels me its a duplicate key!!!!!!
but if i chek it from php with a select it tells m that that vakue dosent exist!!!!!!!!
help dont know what else to do!
-----------------------------------------------------------------------------------------------------------------

first thing try to number_format the $order_num http://au.php.net/manual/en/function.number-format.php

secondly check in mysql what is the datatype of the field if its float , and try to increase the digits like ( float(7,3)

and please explain with some more code


thanks
__________________
Manish Khanna
manish@i4u.com.au
Reply With Quote
  #4 (permalink)  
Old 12-18-03, 02:02
pelegk2 pelegk2 is offline
Registered User
 
Join Date: Nov 2003
Posts: 26
ok i have found the problem

i was reciving from ERP (its like SAP)
unvisible chars that did all the messs
thanks for r all the help
peleg
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On