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 > Database Server Software > MySQL > Assign a variable to multiple queries

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-06-06, 03:08
snakez snakez is offline
Registered User
 
Join Date: Sep 2006
Posts: 4
Assign a variable to multiple queries

Ey im just a newbie to php/mysql... i just like to ask a question regarding the sample queries below if i can assign/store a single variable to all of it and how to do it.


Insert Into Mytable1(fname,lname) values('nick','smith')
Insert Into Mytable2(ProdID,ProdName) values('01','PC')
Insert Into Mytable3(ORno,Date) values('01','01/01/01')
Reply With Quote
  #2 (permalink)  
Old 09-06-06, 07:58
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
please elaborate -- what does "assign/store a variable" mean?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 09-06-06, 21:00
snakez snakez is offline
Registered User
 
Join Date: Sep 2006
Posts: 4
Oh... Im sorry for that... What I really mean is that id like to assign a single php variable and store the 3 queries on it if it is possible...
Reply With Quote
  #4 (permalink)  
Old 09-06-06, 23:09
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
well, i think i know what you mean

make a string and just concatenate the three query statements but be sure to separate them with semi-colons

if you're going through ODBC there might be a problem but mysql itself has no difficulty running multiple statements (e.g. a mysqldump script)
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 09-11-06, 03:50
snakez snakez is offline
Registered User
 
Join Date: Sep 2006
Posts: 4
ok... i already get it... tnx so much... =)
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