Jump to content

Recommended Posts

close...looks like you're mixing up some JS style coding in there.

 

$data = mysql_query("SELECT worth FROM onlinegm");
$info = mysql_fetch_row($data);
$dataArray = array ();
for ($var =0; $var< count($info)-1; $var++){
$dataArray[]=$info[$var];
}

 

 

Main thing to remember is that php doesn't have the OOP syntax for things like var.length etc... instead it has predefined functions that you pass arguments to (the variable/array name, etc...).  That's why despite the fact that you can make custom objects/classes/interfaces/properties/methods etc.. a lot of people don't feel php is truly an OOP language.

Understood.

 

I actually thought that the mysql_fetch_row($data) would return an array. Is that not correct? There are only 2 rows. The worth values are 25 and 35.

 

I can update a field by setting it = '$data[0]' which enters 25.

 

but setting it = '$data[1]' enters 0.

 

$data = mysql_query("SELECT worth FROM onlinegm");
$info = mysql_fetch_row($data);
if ($destination == ""){
} else {
$query = "UPDATE gmData SET possible = '$info[1]'  WHERE user = '$user'";
$result = mysql_query($query) or die(mysql_error());
}

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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