Help with a PHP and mySql 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
bos45430
Forum Newbie
Posts: 12
Joined: Sun Jul 08, 2007 11:11 am

Help with a PHP and mySql question.

Post by bos45430 »

I am trying to search the ALBUMS database to see if there is already and album with the same name with the current logged in user. Why wont this work? sorry such an amateur question. Im learning :) All help appreciated.

$query_albumcheck = "SELECT * FROM albums WHERE owner = '$_COOKIE[email]' & name = '$_POST[albumname]'";
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

try

Code: Select all

$query_albumcheck = "SELECT * FROM albums WHERE owner = '$_COOKIE[email]' & name = '$_POST[albumname]'";
echo '<div>Debug: ', htmlentities($query_albumcheck), "</div>\n";
Does $query_albumcheck contain what you expect?
renatopedigoni
Forum Newbie
Posts: 1
Joined: Sun Jul 08, 2007 4:02 pm
Location: franca, sp, brazil

Re: Help with a PHP and mySql question.

Post by renatopedigoni »

bos45430 wrote:$query_albumcheck = "SELECT * FROM albums WHERE owner = '$_COOKIE[email]' & name = '$_POST[albumname]'";
try

Code: Select all

$query_albumcheck = "SELECT * FROM albums WHERE owner = '".$_COOKIE['email']."' AND name = '".$_POST['albumname']."'";
bos45430
Forum Newbie
Posts: 12
Joined: Sun Jul 08, 2007 11:11 am

Post by bos45430 »

THANKS! That worked! You guys kick gerbal ass.
Post Reply