bryanosaurus Posted July 25, 2009 Share Posted July 25, 2009 I will preface this by saying I am not very familiar with MYSQL at all, but need it for the current project I am working on. What I want to do is, I have a variable coming into a php page, which is the name of a row in my DB. This variable is specifically defined from the page before, so it's choosing a row based on the link previously clicked. Now what I need is for mysql to read that row, and then define a variable from another column in that row, so that I can use it later -- further down in the script I am using php to send an email. Maybe I can explain it better... example if a user clicks a certain product, i need to look for that product in the db, find the inventory value of it, and then insert that value in a script that is sending out an e-mail. I don't know if this makes any sense, or is even possible, any help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/167362-defining-a-variable-in-php-from-mysql/ Share on other sites More sharing options...
onedumbcoder Posted July 25, 2009 Share Posted July 25, 2009 I imagine the value is being pass over via url. $name= $_GET['name']; $result mysql_query("SELECT current_value FROM inventory WHERE name='" . $name . '"); $list = mysql_fetch_array($result); $value= $list['current_value']; if you are posting it then you simple change it to $_post $name = $_POST['name']; Quote Link to comment https://forums.phpfreaks.com/topic/167362-defining-a-variable-in-php-from-mysql/#findComment-882603 Share on other sites More sharing options...
abazoskib Posted July 26, 2009 Share Posted July 26, 2009 to furthur explain, the main difference between GET and POST variables is that a GET variable will be displayed in the address bar i.e.: http://example.com?var1=xxx&var2=yyy whereas a POST variable is not as public and does not appear in the address bar. Quote Link to comment https://forums.phpfreaks.com/topic/167362-defining-a-variable-in-php-from-mysql/#findComment-883500 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.