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
https://forums.phpfreaks.com/topic/32804-help-with-this-code/
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
https://forums.phpfreaks.com/topic/32804-help-with-this-code/#findComment-152759
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
https://forums.phpfreaks.com/topic/32804-help-with-this-code/#findComment-152773
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.