-BRAIDZ- Posted June 1, 2015 Author Share Posted June 1, 2015 (edited) See this. Have you tried it?What went wrong? Was there an error message? Did you try and debug? If so, what did you do? The forum software is adding spaces randomly in the code, so here's a mirror I'm getting an error message $db->query("UPDATE users SET mail_new=mail_new+1 WHERE userid=$userid"); on this line Edited June 1, 2015 by -BRAIDZ- Quote Link to comment Share on other sites More sharing options...
sniko Posted June 1, 2015 Share Posted June 1, 2015 Ugh. I give up trying to help this guy. I tag [MENTION=68711]KyleMassacre[/MENTION], [MENTION=69670]Script47[/MENTION], [MENTION=70347]NonStopCoding[/MENTION] and everyone else in. Goodluck. Quote Link to comment Share on other sites More sharing options...
AdamHull Posted June 1, 2015 Share Posted June 1, 2015 Message me your full register file and I will add it and test it on my localhost and send you it back Quote Link to comment Share on other sites More sharing options...
Script47 Posted June 1, 2015 Share Posted June 1, 2015 (edited) [MENTION=68406]-BRAIDZ-[/MENTION] what [MENTION=65371]sniko[/MENTION] is asking is the exact error which might show up something like this: Undefined variable: user_location in C:\wamp\www\mypath\index.php on line 12 Then what did you try to do to fix the issue? Did you figure out what was causing the error? Did you use var_dump(); or anything else? A simple search produced this. Have a proper read, don't just disregard the link. An extract from the article. Nobody enjoys the process of debugging their code. If you want to build killer web apps though, it’s vital that you understand the process thoroughly. This article breaks down the fundamentals of debugging in PHP, helps you understand PHP’s error messages and introduces you to some useful tools to help make the process a little less painful. Edited June 1, 2015 by Script47 Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted June 1, 2015 Share Posted June 1, 2015 Change $userid to $i - that's why it's failing - you're using the wrong variable Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted June 1, 2015 Author Share Posted June 1, 2015 Change $userid to $i - that's why it's failing - you're using the wrong variable So like this? $db->query("UPDATE users SET mail_new=mail_new+1 WHERE userid=$i"); And would I change it from UPDATE to INSERT INTO? Quote Link to comment Share on other sites More sharing options...
AdamHull Posted June 1, 2015 Share Posted June 1, 2015 (edited) No you do not need to change UPDATE to INSERT, as UPDATE is for if a value is already in the database, by default it is going to be 0 so it already exsits in the database. So all you need to change is the $userid to $i so your code should look like this: $db->query("UPDATE `users` SET `mail_new` = `mail_new` +1 WHERE `userid` = $i"); Edited June 1, 2015 by adamhull Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted June 1, 2015 Author Share Posted June 1, 2015 No you do not need to change UPDATE to INSERT, as UPDATE is for if a value is already in the database, by default it is going to be 0 so it already exsits in the database. So all you need to change is the $userid to $i so your code should look like this: $db->query("UPDATE `users` SET `mail_new` = `mail_new` +1 WHERE `userid` = $i"); Thanks I understand now, will try it out shortly Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted June 2, 2015 Author Share Posted June 2, 2015 No you do not need to change UPDATE to INSERT, as UPDATE is for if a value is already in the database, by default it is going to be 0 so it already exsits in the database. So all you need to change is the $userid to $i so your code should look like this: $db->query("UPDATE `users` SET `mail_new` = `mail_new` +1 WHERE `userid` = $i"); QUERY ERROR: Unknown column 'mail_new' in 'field list' Query was UPDATE `users` SET `mail_new` = `mail_new` +1 WHERE `userid` = 60 Quote Link to comment Share on other sites More sharing options...
realmoflegends Posted June 2, 2015 Share Posted June 2, 2015 Try: $db->query("UPDATE `users` SET `new_mail` = `new_mail` +1 WHERE `userid` = $i"); The above wasn't named correctly, as far as I know. It's new_mail, not mail_new. Quote Link to comment Share on other sites More sharing options...
-BRAIDZ- Posted June 2, 2015 Author Share Posted June 2, 2015 Try: $db->query("UPDATE `users` SET `new_mail` = `new_mail` +1 WHERE `userid` = $i"); The above wasn't named correctly, as far as I know. It's new_mail, not mail_new. Thanks, that's what it was, working fine now, thank you everyone, appreciate it :) Quote Link to comment Share on other sites More sharing options...
krballard94 Posted June 2, 2015 Share Posted June 2, 2015 [MENTION=68406]-BRAIDZ-[/MENTION] Next time, dissect a few mod and try and help yourself first, that's how I learnt. Quote Link to comment Share on other sites More sharing options...
realmoflegends Posted June 2, 2015 Share Posted June 2, 2015 [MENTION=68406]-BRAIDZ-[/MENTION] Next time, dissect a few mod and try and help yourself first, that's how I learnt. That's how I learned my limited PHP knowledge was dissecting existing mods, seeing the methods they used. Having come from C+ and Fortran and the Visual Basic/RealBasic language gave me a decent grounding into function and variables and all of that, but PHP's syntax is so much more particular its taken me awhile to grab it. Practicing and reading will make it perfect, in this case. Quote Link to comment Share on other sites More sharing options...
NonStopCoding Posted June 2, 2015 Share Posted June 2, 2015 glad to see it got fixed had no internet for days damn its been a nightmare lol Quote Link to comment Share on other sites More sharing options...
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.