Jump to content

[SOLVED] for loop and Array


XJTRy

Recommended Posts

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());
}

 

 

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.