PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
class play
{
var $user;
var $orders;
function fill()
{
$resulta = mysql_query("SELECT or1, -lost of stuff- or40 FROM Players WHERE user = '$user'");
$this->$orders = mysql_fetch_row($resulta);
echo "<br> $user <br>";
print_r($orders);
}
}
?>
ok my bad that was silly...
thing is now that i have put this-> infront of all the variables inside the function, the sql isnt working
i know the connection is live and good cos i use it just before i call the class... am i doing something glaringly wrong?
Sorry it's heredoc format that doesn't like dem $this->'s. But then it was only a suggestion. Of course mysql_error() is your best friend for when good queries go bad (but getting the SQL statement out of the mysql_query() call and into it's own variable is the first step 'cause otherwise you can't echo it out to check on what it thinks it looks like).
but it either isnt printing the array or the array doesnt exist...
so, does print_r have problems with objects? cos from what i can tell thats what is causing the trouble