$_GET Variable Question

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

Post Reply
User avatar
Stelios
Forum Commoner
Posts: 71
Joined: Fri Feb 06, 2004 6:25 am
Location: Surrey/UK

$_GET Variable Question

Post by Stelios »

Hi there, I've got a question that is been bothering me for very long.

I have got a table on my database which contains a field called 'bpm'. On the script am creating I want to be able to retrieve the value of this 'bpm' so that I include it to my query such as...

Code: Select all

$bpm=$_GETї'BPM'];


$query5 = "SELECT * FROM uploads WHERE mood = {$_GETї'mid']} AND BPM = '$bpm'";
Apparently I cant do this because am getting a message saying 'Undefined index : BPM'...Any ideas on that? :D
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

EDIT: sorry, misunderstood question
Last edited by John Cartwright on Sun Feb 06, 2005 6:06 pm, edited 1 time in total.
User avatar
Stelios
Forum Commoner
Posts: 71
Joined: Fri Feb 06, 2004 6:25 am
Location: Surrey/UK

Post by Stelios »

Am afraid it doesnt work...ok...let me put it in another way.

Ive got this script:

Code: Select all

<a href="similar.php?mid=&#123;$row&#1111;'mood']&#125;">BLABLA</a>
What I want to do is to get the values of 2 fields in order to proceed to the next link. How can I put a second row on the same line? I tried this but it doesn't work...

Code: Select all

<a href="similar.php?mid=&#123;$row&#1111;'mood']&#125; && &#123;$row&#1111;'BPM']&#125;">
djot
Forum Contributor
Posts: 313
Joined: Wed Jan 14, 2004 10:21 am
Location: planet earth
Contact:

Post by djot »

-
Hi,

Code: Select all

<a href="similar.php?mid=&#123;$row&#1111;'mood']&#125;&&#123;$row&#1111;'BPM']&#125;">
This is how to pass multiple values via GET.
foo.php?var1=value1&var2=value2

$query5 = "SELECT * FROM uploads WHERE mood = {$_GET['mid']} AND BPM = '$bpm'";
Put quotes around the user submitted input. Before, check if the user input is valid (and not some db-hacking code).
(Is the db field named 'bpm' or 'BPM'?)

Code: Select all

$query5 = "SELECT * FROM uploads WHERE mood='&#123;$_GET&#1111;'mid']&#125;' AND bpm='$bpm'";
djot
-
User avatar
Stelios
Forum Commoner
Posts: 71
Joined: Fri Feb 06, 2004 6:25 am
Location: Surrey/UK

Post by Stelios »

It is BPM
User avatar
Stelios
Forum Commoner
Posts: 71
Joined: Fri Feb 06, 2004 6:25 am
Location: Surrey/UK

Post by Stelios »

THANKS A LOT!!!IT WORKED JUST FINE!!! :D
Post Reply