Jump to content


Photo

variable and mysql


  • Please log in to reply
1 reply to this topic

#1 tecdesign

tecdesign
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 05 October 2006 - 04:17 AM

In a Mysql statement I want to read the variable as part of the mysql statement in the php coding. Is this possible? E.g

$sql = mysql_query("
INSERT INTO `transactions` ( `transid` , `username` , `trans_type` , `trans_name` , `trans_method` , `ref` , `code` , `amount` , `date` )
VALUES (
NULL , 'asdf', '."$new_string".')");

#2 Hi I Am Timbo

Hi I Am Timbo
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 05 October 2006 - 04:19 AM

it is possible but you have to have the same number of fields in into and value.  And, your "'s and concatenation are messed up.  it should look like this:

INSERT INTO `transactions` ( `transid` , `username` , `trans_type` , `trans_name` , `trans_method` , `ref` , `code` , `amount` , `date` )
VALUES (
NULL , 'asdf', '".$new_string."')");




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users