Rune
05-14-2003, 04:58 AM
I know very little about MySQL and PHP ... but I'm trying. I'm working on something and have one last hurdle that I can't figure out. I'm assuming it's just the lack of MySQL knowledge and some guru can probably point me in the right direction without hesitation, so here goes.
Something's wrong with this code. I'm trying to grab data from a single table to see if these two values exist in any field together. I want to see if there's any occurance of X and Y in one field together, if so, give a comment and exit the rest of the code ... if not, execute the rest of the code. Where am I going wrong here?
//--------START CHECK FOR PREVIOUS BANVOTE BY THIS VOTER AGAINST THIS POSTER-------->
// check if banvote was already placed
$sql = "SELECT *
FROM " . BANVOTE_VOTERS_TABLE . "
WHERE banvote_user_id = $banvote_user_id
AND banvote_banner_id = $banvote_banner_id;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain banvote data for these users', '', __LINE__, __FILE__, $sql);
}
if ( $banvote_user_id=$poster_id && $banvote_banner_id=$user_id )
{
message_die(GENERAL_ERROR, 'You have already placed a ban vote against this user', '', __LINE__, __FILE__, $sql);
}
//--------END CHECK FOR PREVIOUS BANVOTE BY THIS VOTER AGAINST THIS POSTER-------->
P.S. The rest of the code not shown works perfectly ... this is the only part that doesn't.
Something's wrong with this code. I'm trying to grab data from a single table to see if these two values exist in any field together. I want to see if there's any occurance of X and Y in one field together, if so, give a comment and exit the rest of the code ... if not, execute the rest of the code. Where am I going wrong here?
//--------START CHECK FOR PREVIOUS BANVOTE BY THIS VOTER AGAINST THIS POSTER-------->
// check if banvote was already placed
$sql = "SELECT *
FROM " . BANVOTE_VOTERS_TABLE . "
WHERE banvote_user_id = $banvote_user_id
AND banvote_banner_id = $banvote_banner_id;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain banvote data for these users', '', __LINE__, __FILE__, $sql);
}
if ( $banvote_user_id=$poster_id && $banvote_banner_id=$user_id )
{
message_die(GENERAL_ERROR, 'You have already placed a ban vote against this user', '', __LINE__, __FILE__, $sql);
}
//--------END CHECK FOR PREVIOUS BANVOTE BY THIS VOTER AGAINST THIS POSTER-------->
P.S. The rest of the code not shown works perfectly ... this is the only part that doesn't.