Dayo Posted March 24, 2011 Posted March 24, 2011 basicly what i did was make a db table called rates with TopicID | User | TS (timestamp) i would then enter the rating into the database then upon them rating again i would look for the user and the topic if it returned a row i wouldent let them rate Also i added the TS so that i could run a query to deleted any records over 24 hours Quote
iseeyou94056 Posted March 26, 2011 Author Posted March 26, 2011 dame it i still cant get it to work right :/ Quote
GregFest Posted March 26, 2011 Posted March 26, 2011 MySQL queries 1 ALTER TABLE `forum_topics` ADD `ft_like` INT (11) DEFAULT 0; MySQL queries 1 ALTER TABLE `forum_topics` ADD `ft_dislike` INT (11) DEFAULT 0; i used these and not one problem Quote
iseeyou94056 Posted March 27, 2011 Author Posted March 27, 2011 thats not the problem i have this right now You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. and its not working :/ Quote
GregFest Posted March 27, 2011 Posted March 27, 2011 This what i am using and works on all my sites forum2.php <?php $i=('globals.php'); include "$i"; $_GET['LID'] = abs((int) $_GET['LID']); $_GET['DID'] = abs((int) $_GET['DID']); if($_GET['LID']) { global $ir, $userid, $h, $db; $p = $db->query("SELECT ft_id, ft_name FROM forum_topics WHERE ft_id = ".$_GET['LID']); $r = $db->fetch_row($p); if ($r['ft_id'] == $ir['fr_like']) {echo "You already voted on this topic";} else { echo "You have liked the topic"; $db->query("UPDATE forum_topics SET ft_like=ft_like+1 WHERE ft_id={$r['ft_id']}"); $db->query("UPDATE users SET fr_like=concat('{$r['ft_id']}') WHERE userid=$userid"); } } else if($_GET['DID']) { global $ir, $userid, $h, $db; $p = $db->query("SELECT ft_id, ft_name FROM forum_topics WHERE ft_id = ".$_GET['DID']); $r = $db->fetch_row($p); if ($r['ft_id'] == $ir['fr_dislike']) {echo "You already voted on this topic";} else { echo "You have disliked the topic"; $db->query("UPDATE forum_topics SET ft_dislike=ft_dislike+1 WHERE ft_id={$r['ft_id']}"); $db->query("UPDATE users SET fr_dislike=concat('{$r['ft_id']}') WHERE userid=$userid"); } } else { echo "Invalid use of file"; } ?> Quote
iseeyou94056 Posted March 27, 2011 Author Posted March 27, 2011 Notice: Undefined index: fr_dislike in /home/iseeyou9/public_html/forum.php on line 24 You have disliked the topicQUERY ERROR: Unknown column 'fr_dislike' in 'field list' Query was UPDATE users SET fr_dislike=concat('14') WHERE userid=1 Quote
iseeyou94056 Posted March 27, 2011 Author Posted March 27, 2011 i fixed that error but that dont work either can anyone tell me how to make it work so i dont have to remove it :/ Quote
iseeyou94056 Posted April 3, 2011 Author Posted April 3, 2011 :/ thanks any ways i guess i will just delete it from my game Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.