PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
shou0630
Forum Newbie
Posts: 3 Joined: Sun Nov 22, 2009 2:35 pm
Post
by shou0630 » Sun Nov 22, 2009 2:41 pm
I know
Code: Select all
SELECT * FROM Persons
WHERE LastName='peter'
works.But how do i make a var work like???
Code: Select all
SELECT * FROM Persons
WHERE LastName='$_POST[name]'
morris520
Forum Commoner
Posts: 60 Joined: Thu Sep 18, 2008 8:56 pm
Location: Manchester UK
Post
by morris520 » Sun Nov 22, 2009 3:01 pm
put your query as a string then pass to php func mysql_query
Code: Select all
$query = 'SELECT * FROM table WHERE id = ' . $_post['id'];
Hope this helps
Morris
shou0630
Forum Newbie
Posts: 3 Joined: Sun Nov 22, 2009 2:35 pm
Post
by shou0630 » Sun Nov 22, 2009 3:08 pm
oh ye i got it
Code: Select all
$result = mysql_query("SELECT * FROM games
WHERE name IN ('$_GET[search]')");
GET works POST doesn't,thanks anyway
morris520
Forum Commoner
Posts: 60 Joined: Thu Sep 18, 2008 8:56 pm
Location: Manchester UK
Post
by morris520 » Tue Nov 24, 2009 5:42 am
depends how you send parameters through the page.