Jump to content

Select Description Based on Name


sunziun

Recommended Posts

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

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

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 by sunziun
Link to comment
Share on other sites

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

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

$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

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 by Net123
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...