stevedun Posted March 27, 2009 Share Posted March 27, 2009 Hello all! I have a MySQL DB set up, and I want to import data into a webpage. I'm having problems finding the right code. I need to: 1. Send a SELECT query that will get an entire row from my DB, based on the key column "B_id". 2. Put the info into variables based on the column names in the table ($name = "B_name", $IDnum = "B_id", etc). 3. Make the variables show up (echo '$name', etc). I am a major PHP n00b, and I'm really trying to figure this stuff out, but I could use a tutor ^^. Thank you so much community! Link to comment https://forums.phpfreaks.com/topic/151414-retrieve-db-row-contents-to-php-variables/ Share on other sites More sharing options...
mrMarcus Posted March 27, 2009 Share Posted March 27, 2009 in all of the WWW and the vast number of postings on this site alone, you haven't been able to find anything on extracting data from a database using php? just typing "extracting data from a database using php" into google and i get tons of great resources. 'cause you basically have it right in your post .. SELECT your data from your database (look up how to use the SELECT method using mySQL and PHP). learn by doing .. don't mean to be harsh, but it's the best way there is. Link to comment https://forums.phpfreaks.com/topic/151414-retrieve-db-row-contents-to-php-variables/#findComment-795331 Share on other sites More sharing options...
Silverado_NL Posted March 27, 2009 Share Posted March 27, 2009 i would suggest reading some basic php and mysql tutorials first like this one http://www.devshed.com/c/a/PHP/Website-Database-Basics-With-PHP-and-MySQL/ or this one http://phpsense.com/php/php-mysql.html Link to comment https://forums.phpfreaks.com/topic/151414-retrieve-db-row-contents-to-php-variables/#findComment-795334 Share on other sites More sharing options...
stevedun Posted March 27, 2009 Author Share Posted March 27, 2009 Thank you mrMarcus for putting me in my place.... and thanks Silverado for the useful links. Link to comment https://forums.phpfreaks.com/topic/151414-retrieve-db-row-contents-to-php-variables/#findComment-795357 Share on other sites More sharing options...
mrMarcus Posted March 27, 2009 Share Posted March 27, 2009 Thank you mrMarcus for putting me in my place.... and thanks Silverado for the useful links. anytime kiddo .. just a little frustrated here with some code i've been working on for a bit. honestly though, PHP is a very logical language .. always plan out beforehand what it is you are trying to accomplish, whether it be writing it out on paper or whatever. organization is crucial. so with what you are trying to do is get data from your database. so, break it down... first, we need to connect to the db. second, we need to access the data. third, figure out what to do with that data .. loop it, etc... fourth, display that data. breaking things down will not only help you learn more efficiently, but will save you many a'headaches in the future as your coding becomes more and more complex. Link to comment https://forums.phpfreaks.com/topic/151414-retrieve-db-row-contents-to-php-variables/#findComment-795363 Share on other sites More sharing options...
stevedun Posted March 27, 2009 Author Share Posted March 27, 2009 So far I've figured out how to get the table data out using print($variable['column']). That was the part I was missing before posting. Thanks for the links, they really helped. Link to comment https://forums.phpfreaks.com/topic/151414-retrieve-db-row-contents-to-php-variables/#findComment-795461 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.