PDA

View Full Version : Beast attack



Demonicman
10-25-2007, 04:10 AM
fixed!

djr33
10-25-2007, 04:17 AM
The problem may lie here: $User[ID]
That syntax doesn't look right, as in double quotes only simple variables are parsed, and ID would be a constant there, which has not been defined; however, 'ID' would be a valid index in the array. (ID, by itself, is a constant, like $ID, but having been set with define().)

In the end, the error itself is because the query returned no results.

Embedding mysql_fetch_array(mysql_query($query)) all in one makes troubleshooting and error compensation tough; separate them to make things easier.
$query = 'stuff here'; //then you can echo it to check
$result = mysql_query($query); //now you can use $result
//you could use mysql_num_rows to see if there was any match
THEN, $row = mysql_fetch_array($result);

Demonicman
10-25-2007, 04:34 AM
wow, i appreciate your help, thx

Demonicman
10-25-2007, 04:41 AM
Nvm Fixed

djr33
10-25-2007, 04:55 AM
I'm not sure what's confusing.

ID by itself would be a constant, which is similar to a variable in PHP but simply stores a constant value. Just like "3" represents the numerical value of 3, ID could represent a set numerical value of "5", if set as such. (Though it can store any type of data, not just numbers.)

The difference between a constant and a variable is that a variable is easily accessible and changed; a constant is set once with the define() function.

So... the point... you AREN'T using this, especially if you don't understand it.

You want to use an index, which is a name for a part of an array.

$array[a] would be using the constant a, and that's just not what you want.
$array['a'] would give the 'a' element of the array.


As for splitting it up, that should be self explanatory. As per the comments above, error check to see where the problem lies. Is it the query? Does it return rows (checked with mysql_num_rows)?

Twey
10-25-2007, 03:49 PM
It would be preferable to leave the question there for future readers.
$array[a] would be using the constant a, and that's just not what you want.It should be noted that undefined constants are automatically interpreted as strings (here, for example, $array[a] is interpreted as $array['a']). However, relying on this is a bad idea, since if someone does define a constant 'a' it will muck everything up (and it's deprecated, and will throw a warning).

djr33
10-25-2007, 06:15 PM
Removing the question is quite annoying. It's important to leave this as a resource for others who have the same question so they can search and so we can link to this as a solution.