Jump to content

[SOLVED] php mysql fetch data and math function script fix help


Jiraiya

Recommended Posts

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');

}

  • 4 months later...

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...

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.