Parsing strings
Posted: Thu Jun 26, 2008 8:07 pm
I am having a problem with a simple query that i cant work out. I havent done php for a while so its like basic stuff.
I am trying to pass a simple piece of info from a form into a database but there is something wrong with the way i am passing.
The query below works but I get a 0 value for intered as $cost_price
[/color]
BUT I had no luck
Can any one help
thanks
I am trying to pass a simple piece of info from a form into a database but there is something wrong with the way i am passing.
The query below works but I get a 0 value for intered as $cost_price
Code: Select all
[color=#400040]echo $cost_price =$_POST['bookCostPrice'];
$sql = 'INSERT INTO `price` (`book_ISBN`, `cost_price`, `cost_currancy`, `us_mrp`, `uk_mrp`, `can_mr`) VALUES (\'0750687770\','".$cost_price."', NULL, NULL, NULL, NULL)';
mysql_query($sql) or die('Error' . mysql_error());[/color]
['/code']
I also tried
[color=#0000FF]Code: Select all
$sql = 'INSERT INTO `price` (`book_ISBN`, `cost_price`, `cost_currancy`, `us_mrp`, `uk_mrp`, `can_mr`) VALUES (\'0750687770\', \'".$cost_price."\', NULL, NULL, NULL, NULL)';
mysql_query($sql) or die('Error' . mysql_error());
BUT I had no luck
Can any one help
thanks