mikosiko
Members-
Posts
1,327 -
Joined
-
Last visited
-
Days Won
1
Everything posted by mikosiko
-
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);
-
Page doesn't show any html after a PHP script.
mikosiko replied to membot's topic in PHP Coding Help
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 -
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());
-
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
-
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?
-
and what is the difference between FirstName = 'Peter' and uname = $uname
-
no clear what you want to do.... do you want to update your table or your array? post your relevant code
-
wow.... this is not clear enough? :-\ hint uname=$uname
-
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:
-
my.total_count
-
you'r right
-
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"
-
post your full code again. nothing is impossible if your code is wrong
-
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);
-
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>'); } } ?>
-
read away http://php.net/manual/en/book.mysqli.php
-
@shawn int mysql_affected_rows ([ resource $link_identifier ] )
-
:'( read last paragraph in answer #2.... maybe three times... :-\
-
read answer #1 again... preferably twice
-
mysqli_multi_query: Calling two stored procs to bind a grid + a dropdown
mikosiko replied to Arlington's topic in MySQL Help
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 -
mysqli_multi_query: Calling two stored procs to bind a grid + a dropdown
mikosiko replied to Arlington's topic in MySQL Help
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 -
http://php.net/manual/en/language.oop5.decon.php
-
look here: ...... '$thisday', $thismonth' ...... and then here ....... '28', October' ........ is not the error obvious?