943,186 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 726
  • PHP RSS
Jul 2nd, 2010
0

php variable in mysql query

Expand Post »
Hi everybody
I am very new to PHP and MYSQL
How can I implement :
PHP Syntax (Toggle Plain Text)
  1. $q=$_GET["q"];
  2. $CMY=$get["CMY"];
  3. ...
  4. $query=("INSERT INTO the_array($CMY, model)
  5. VALUES('$q','dddd')");

$q and $CMY are results I get from AJAX, and I think the only way to save the results
is using the DB.
Last edited by Ezzaral; Jul 2nd, 2010 at 4:55 pm. Reason: Added code tags. Please use them to format any code that you post.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kukie is offline Offline
3 posts
since Jul 2010
Jul 2nd, 2010
0
Re: php variable in mysql query
PHP Syntax (Toggle Plain Text)
  1. $Name=$_GET["name"];
  2. $Email=$_GET["email"];
  3. ...
  4. $sql="INSERT INTO tablename(db_field1, db_field2)
  5. VALUES('$Name','$Email');
  6.  
  7. mysql_qyery($sql)
  8.  

This is the most simplest way to insert data into database.
Last edited by Ezzaral; Jul 2nd, 2010 at 4:55 pm. Reason: Added code tags. Please use them to format any code that you post.
Reputation Points: 10
Solved Threads: 4
Light Poster
kamran_FrizCon is offline Offline
33 posts
since Jul 2009
Jul 3rd, 2010
0
Re: php variable in mysql query
Thank you Kamran.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kukie is offline Offline
3 posts
since Jul 2010

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Going back from child to parent page
Next Thread in PHP Forum Timeline: Can't seem to get this If statement working...





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC