Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Use variables in a MySQL query

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 25-04-2009
Member
 
Join Date: Apr 2009
Posts: 79
Use variables in a MySQL query
  

hello my friends ...
I have a problem during the creation of my site .. the idea is to use a PHP variable in a query Mysql. possible or not?! and how?
thank you ...

Reply With Quote
  #2  
Old 25-04-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: Use variables in a MySQL query

Hi,
you can save your variables between single quotes if I remember correctly, style

$ ta_variable = 'ab';

"SELECT * FROM ta_base WHERE = '$ ta_variable"
Reply With Quote
  #3  
Old 25-04-2009
Member
 
Join Date: Apr 2009
Posts: 79
Re: Use variables in a MySQL query

thank you, but you can do: $ ta_variable = $ _POST [ 'variable'];??
Reply With Quote
  #4  
Old 25-04-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: Use variables in a MySQL query

Hi,
If your variable has a form, you can directly integrate your $ _POST variable in the request for the concatenation in your application:

mysql_query ( "UPDATE` `tabase. taTable` SET `tonChamp = '". $ variableChamp. "' WHERE tonChamp = '". $ _POST [' variable ']. "'") or die (mysql_error ());
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Use variables in a MySQL query"
Thread Thread Starter Forum Replies Last Post
MySQL query in a query Rail racer Software Development 3 21-07-2009 08:06 PM
Turn on MySQL query cache to speed up query performance DMA2Superman Software Development 3 07-07-2009 11:26 AM
MySQL Query Cache Ryder Software Development 3 16-04-2009 04:05 PM
MySQL IF ELSE in Query Ryder Software Development 3 27-03-2009 06:24 PM
Passing variables in SQL Query Braze Software Development 2 01-01-2009 08:52 PM


All times are GMT +5.5. The time now is 06:19 PM.