Jiraiya Posted November 24, 2008 Share Posted November 24, 2008 this script isnt working could someone help me fix it please? $username = $_COOKIE['ID_my_site']; $sql = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); while($row = mysql_fetch_array($sql)) { $result = mysql_query("SELECT skill FROM users") $result = mysql_query("SELECT health FROM users") or die(mysql_error()); $new_a = ($d - ($a * .1)); $new_c = ($a - ($c * .1)); while ((($new_a) && ($new_c)) > '0') { $new_a = ($d - ($new_a * .1)); $new_c = ($d - ($new_c * .1)); } if ($new_a > '0') { $new_a = ($new_a + '10'); } if ($new_c > '0') { $new_c = ($new_c + '0'); } Link to comment https://forums.phpfreaks.com/topic/134071-solved-php-mysql-fetch-data-and-math-function-script-fix-help/ Share on other sites More sharing options...
manny Posted April 1, 2009 Share Posted April 1, 2009 this script isnt working could someone help me fix it please? $username = $_COOKIE['ID_my_site']; $sql = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); while($row = mysql_fetch_array($sql)) { $result = mysql_query("SELECT skill FROM users") $result = mysql_query("SELECT health FROM users") or die(mysql_error()); $new_a = ($d - ($a * .1)); $new_c = ($a - ($c * .1)); while ((($new_a) && ($new_c)) > '0') { $new_a = ($d - ($new_a * .1)); $new_c = ($d - ($new_c * .1)); } if ($new_a > '0') { $new_a = ($new_a + '10'); } if ($new_c > '0') { $new_c = ($new_c + '0'); } You have an error in the SQL Syntax Here is the fix try this <? $username = $_COOKIE['ID_my_site']; $sql = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); while($row = mysql_fetch_array($sql)) { $result = mysql_query("SELECT `skill`,`health` FROM users") or die(mysql_error()); $new_a = ($d - ($a * .1)); $new_c = ($a - ($c * .1)); while ((($new_a) && ($new_c)) > '0') { $new_a = ($d - ($new_a * .1)); $new_c = ($d - ($new_c * .1)); } if ($new_a > '0') { $new_a = ($new_a + '10'); } if ($new_c > '0') { $new_c = ($new_c + '0'); } } ?> even i don't understand why do you ren the SELECT health,skill query i don't see you are using it... Link to comment https://forums.phpfreaks.com/topic/134071-solved-php-mysql-fetch-data-and-math-function-script-fix-help/#findComment-798708 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.