sunziun Posted August 8, 2012 Share Posted August 8, 2012 Hello everyone, I've a table which looks like this: id | name | description1 | some name | some descriptions. Now, I want based on the name to be able to select the description from the database. Would that be possible? Thanks for your time. Link to comment Share on other sites More sharing options...
birbal Posted August 8, 2012 Share Posted August 8, 2012 http://w3schools.com/php/php_mysql_intro.asphttp://dev.mysql.com/doc/en/select.htmlhttp://w3schools.com/php/php_mysql_select.asphttp://w3schools.com/php/php_mysql_where.asp Link to comment Share on other sites More sharing options...
sunziun Posted August 8, 2012 Author Share Posted August 8, 2012 (edited) I had this code $name=$_GET['name']; $query=mysql_query("SELECT * FROM $templates_table WHERE name='$name'"); the dollar sign was missing at name='$name' and that's why it didn't work. thanks anyways! Edited August 8, 2012 by sunziun Link to comment Share on other sites More sharing options...
birbal Posted August 8, 2012 Share Posted August 8, 2012 what do you mean it does not work? is there any errors? if you are unsure how is your query is geting built you can echo $query to see it. Link to comment Share on other sites More sharing options...
sunziun Posted August 8, 2012 Author Share Posted August 8, 2012 its working now, a dollar sign was missing at name='$name' to get the name from the address bar! Link to comment Share on other sites More sharing options...
birbal Posted August 8, 2012 Share Posted August 8, 2012 $name is variable (with '$' sign) which will evaluate value in the double quoted string. and that value is coming from $_GET['name']. $_GET['name'] is populated from the query string you used to get the page. variable names always stars with '$' sign in php Link to comment Share on other sites More sharing options...
Net123 Posted August 8, 2012 Share Posted August 8, 2012 (edited) i am also a newbie i mostly working with php/mysqlwhen i am working with db i am using output the query for solve all my problems now i can solve all my mysql problems without others help.................. Edited August 8, 2012 by Net123 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now