Jump to content

mikosiko

Members
  • Posts

    1,327
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by mikosiko

  1. if you header file is complete and correct (you are showing just one line) that should work, add this lines at the begin of any of your php files to see if you catch any error error_reporting(E_ALL); ini_set("display_errors", 1);
  2. I'm more confused ... the code that you posted works in the way it is (tested)... but ... you said: and I don't see any form.. so... how do you expect to get help?... show the code that is NOT working
  3. so please clarify for me how do you know that your UPDATE code (below) is not working ? mysql_query("UPDATE users SET missiononeraces='0' WHERE username='$username'") or die ("Error - Query : Line 83 : " . mysql_error());
  4. WHAT?.... I think you missed the point completely... are you saying that is BETTER to write 3 UPDATES instead of JUST ONE... I don't think so... now... if you are referring to the way that I did indent it .. that is something totally different and as you said is just a matter of style and personal preferences and coding habits... so please next time clarify exactly what are you disagreeing to do not gave rest of users wrong ideas/examples. thanks
  5. my first comment for you... all this: mysql_query ("UPDATE users SET money='$newmoney' WHERE username='$username'"); mysql_query ("UPDATE users SET rep='$newrep' WHERE username='$username'"); mysql_query ("UPDATE users SET missions='2' WHERE username='$username'") or die ("Error - Query : Line 27 : " . mysql_error()); should be written in this way: mysql_query ("UPDATE users SET money='$newmoney' , rep='$newrep' , missions='2' WHERE username='$username'") or die ("Error - Query : Line 27 : " . mysql_error()); now... regarding to your "missiononeraces" ... where are you increasing it value to allow it to reach 25? also, what datatype are "missions" and "missiononeraces" in the table?... numbers or strings?
  6. and what is the difference between FirstName = 'Peter' and uname = $uname
  7. no clear what you want to do.... do you want to update your table or your array? post your relevant code
  8. wow.... this is not clear enough? :-\ hint uname=$uname
  9. my bad... if my memory doesn't fail you can't use a subquery alias in a where clause (I couldn't find the specific paragraph in the manual) this is one way to solve it:
  10. my.total_count
  11. this error is very clear and you should be able to fix it for yourself. for this warning: try deleting the blank line before "header"
  12. post your full code again. nothing is impossible if your code is wrong
  13. Depending on your PHP version ... (in case you recently upgrade PHP) HTTP_POST_VARS was deprecated long time ago and you should use $_POST instead. if you include this lines at the begining of your code you should see a notice/warning message. error_reporting(E_ALL); ini_set("display_errors", 1);
  14. Picachu2000's code should work.... this one below is just my personal preference <?php if($continue == "yes"){ $query = "DELETE FROM ".$prefix."user_inventory WHERE item_owner = '$loggedinname' AND item_name = '$item_name' AND (item_amount - $quantity) <= 0"; mysql_query($query) or die( '<br>Query: ' . $query . '<br>Error: ' . mysql_error() . '<br>'); if (mysql_affected_rows() == 0) { $query = "UPDATE ".$prefix."user_inventory SET item_amount = (item_amount - $quantity) WHERE item_owner = '$loggedinname' AND item_name = '$item_name'"; mysql_query($query) or die( '<br>Query: ' . $query . '<br>Error: ' . mysql_error() . '<br>'); } } ?>
  15. mikosiko

    mysqli

    read away http://php.net/manual/en/book.mysqli.php
  16. pseudo-code: $OLD-Classid = ""; // Create the contents of the table. for( $i = 0; $i < $row = mysql_fetch_array($result); $i++){ if ($row['Class'] != $OLD-Classid) { // Here Print $row['Class'] in the way you want $OLD-Classid = $row['Class']; } // Print the rest of fields
  17. @shawn int mysql_affected_rows ([ resource $link_identifier ] )
  18. :'( read last paragraph in answer #2.... maybe three times... :-\
  19. read answer #1 again... preferably twice
  20. To complement my previous answer... this is the reason to use the additional $db->next_result(): pay attention to the last paragraph source: http://dev.mysql.com/doc/refman/5.0/en/c-api-multiple-queries.html
  21. First a suggestion... you are mixing OO coding style as in this line if ($db->multi_query($query)) { and Procedural style as in this line (and the rest of your code) if ($result = mysqli_store_result($db)) { is always better to stick only with one coding style (I will re-write your second line and some other lines in this way: if ($result = $db->store_result()) { ... now... after your first $result->free() line add this: $result->free(); // But I rather prefer to user $result->close() instead // Procedures return always an additional result sets (status)... // Here I dump the status result set from the first called procedure. $db->next_result(); try
  22. http://php.net/manual/en/language.oop5.decon.php
  23. look here: ...... '$thisday', $thismonth' ...... and then here ....... '28', October' ........ is not the error obvious?
×
×
  • 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.