Author Topic: Retrieve from the database...  (Read 679 times)

0 Members and 1 Guest are viewing this topic.

Offline Adika

  • Enthusiast
  • Posts: 84
  • Gender: Male
  • You are not a God!
    • View Profile
Re: Retrieve from the database...
« Reply #15 on: July 04, 2009, 03:46:07 PM »
Sorry, but I can't fix big things for free because it's time consuming, and time is money. :) But what I can do is put you in the right direction, so you can find the solution yourself. :)

So, open the func.php, and find the line where it says
Code: [Select]
function user($some_variable_will_be_here) {That line is feeding your $usr with data. Follow that function line by line, and found out what he does. For functions or words that you don't know what they mean, go to the www.php.net and "search for" box write in the word that you don't understand. And then click the arrow. Then it will show you the function that you didn't know, and how it's built and for what it is. That way you can understand your code. Hey, no pain no game! :) And if you are not here to learn php, than what are you doing here? :) And learning php is not just asking questions in the forums, but trying to find answers yourself. And php.net is the best way to find answers, since that's all you need (mostly). And since php is the easiest language to learn, spend some time, and learn it. My first language was also php and I learned everything by myself from php.net and by analyzing the script. If you have some questions, I will be happy to ask or to direct you to the right direction. And let me tell you one more thing: If you spend some time to completely understand this script that you are working on, you will gain instant knowledge of php, and after that you will see how easy this language is, and how good you can be in it in no time. Trust me, I was there where you are now before. :)

Offline DarkpowerTopic starter

  • Irregular
  • Posts: 22
    • View Profile
Re: Retrieve from the database...
« Reply #16 on: July 04, 2009, 04:12:18 PM »
SOLVED!

Haha, solved it in a easy way  ;D
You need an IF statement around sql^^


Code: [Select]
if($usr[7]>=10){
 if (isset($antal) && !empty($antal)) {
 foreach($_POST{'siffra'} as $tal) {

 
  if(is_numeric($tal)) {
   $gissningar .= ' '.$tal;
   if($tal==$slump) {
   $poang = $userrow['points']+100;
   $query = "UPDATE users SET points=points+$poang WHERE id='".mysql_real_escape_string($_SESSION["user"]["0"])."' LIMIT 1";
   mysql_query($query, $db_id);
   }
   else {
   $poang = $userrow['points']-10;
   $query = "UPDATE users SET points=points+$poang WHERE id='".mysql_real_escape_string($_SESSION["user"]["0"])."' LIMIT 1";
   mysql_query($query, $db_id);
   }
  }
 }
 }
 }else{
 echo '<b>You need at least 10 points to play!</b>';
 }

Offline Adika

  • Enthusiast
  • Posts: 84
  • Gender: Male
  • You are not a God!
    • View Profile
Re: Retrieve from the database...
« Reply #17 on: July 05, 2009, 03:54:45 AM »
Great to hear that you solved it. :-)