Jump to content

help with this code


corillo181

Recommended Posts

why isn't this code working?
[code]
<?

$see=mysql_query("SELECT today,user_id FROM tra_music_voted WHERE user_id='".$artist['artist_id']."' AND user_id='$user_id'")or die(mysql_error());

$getdate=mysql_fetch_array($see);

$today=date("F j, Y");

$yesterday=$getdate['date'];

$id=$getdate['user_id'];

if(($yesterday==$today) && ($id==$user_id) ){
echo "thank you for voting";
}else{?>
      <li><a href="cu.php?vote=<?=$artist['artist_id']?>">vote</a>  </li>
<?
}
?>

[/code]
Link to comment
Share on other sites

but this code i'm still having problem with.. if ther eis no record to update it wont insert a new record..

[code]
$updvoted=mysql_query("UPDATE tra_music_voted SET today='$today' WHERE artist_id='".$_GET['voted']."' AND user_id='$user_id'");
if(!$updvoted){

$today=date("F j, Y");
$insertuser=mysql_query("INSERT into tra_music_voted(artist_id,user_id,today)VALUE('".$_GET['vote']."','$username','$today')")or die(mysql_query());
}
[/code]
Link to comment
Share on other sites

i think part of the reason why the code si not working is because it says that the code ahs takena ction even when there is no record to update it says tha tit has updated the record i found out but using this code..

[code]
$updvoted=mysql_query("UPDATE tra_music_voted SET today='$today' WHERE artist_id='".$_GET['voted']."' AND user_id='$user_id'");
if($updvoted){
echo "done";
}else{
echo "not done";
}
[/code]
it echos out done.
when there is no record at all in the tables..

any one knows how i could fix this?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.