I haven't posted here in a year or so, so I'm a little rusty with my php. I am currently making a facebook game. The facebook aspect is not relevant here because my php coding is not even outputting the code. The class is meant to do two things: put all user data from the database into variables like $user->$email etc... The second is to output a string not from the database like $user->_fn where "fn" is a string. Here is the user class:
PHP Code:
class user
{
public function getuser($fbuid)
{
$sql="SELECT * FROM users WHERE fbuid='$fbuid'";
$result = mysql_query($sql) or die(mysql_error());
$u=mysql_fetch_array($result);
if($u)
{
foreach($u as $title=> $value)
{
$this->${title} = $value;
}
}
else
{
return FALSE;
}
$this->_en ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"false\" capitalize=\"true\" linked=\"false\" possessive=\"false\"></fb:name>";
$this->_enp ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"false\" capitalize=\"true\" linked=\"false\" possessive=\"true\"></fb:name>";
$this->_enl ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"false\" capitalize=\"true\" linked=\"true\" possessive=\"false\"></fb:name>";
$this->_enpl ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"false\" capitalize=\"true\" linked=\"true\" possessive=\"true\"></fb:name>";
$this->_fnl ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"false\" capitalize=\"true\" firstnameonly=\"true\" linked=\"true\"></fb:name>";
$this->_fnpl ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"false\" capitalize=\"true\" firstnameonly=\"true\" linked=\"true\" possessive=\"true\"></fb:name>";
$this->_fn ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"false\" capitalize=\"true\" firstnameonly=\"true\" linked=\"false\"></fb:name>";
$this->_fnp ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"false\" capitalize=\"true\" firstnameonly=\"true\" linked=\"false\" possessive=\"true\"></fb:name>";
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$this->_yen ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"true\" capitalize=\"true\" linked=\"false\" possessive=\"false\"></fb:name>";
$this->_yenp ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"true\" capitalize=\"true\" linked=\"false\" possessive=\"true\"></fb:name>";
$this->_yenl ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"true\" capitalize=\"true\" linked=\"true\" possessive=\"false\"></fb:name>";
$this->_yenpl ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"true\" capitalize=\"true\" linked=\"true\" possessive=\"true\"></fb:name>";
$this->_yfnl ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"true\" capitalize=\"true\" firstnameonly=\"true\" linked=\"true\"></fb:name>";
$this->_yfnpl ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"true\" capitalize=\"true\" firstnameonly=\"true\" linked=\"true\" possessive=\"true\"></fb:name>";
$this->_yfn ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"true\" capitalize=\"true\" firstnameonly=\"true\" linked=\"false\"></fb:name>";
$this->_yfnp ="<fb:name uid=\"".$this->$fbuid."\" useyou=\"true\" capitalize=\"true\" firstnameonly=\"true\" linked=\"false\" possessive=\"true\"></fb:name>";
$this->test ="test";
}
}
$user = new user;
On my library document:
PHP Code:
include_once("lib/classes.php");
$db=new database();
$db->connect();
$user->getuser($fb_user);
I have tested my database connection, and it is valid. The problem is that the page only loads if $fb_user is null. When it's not null say I set $user->getuser("12345678"); the page is just blank. No error messages or anything. Why is it doing this and how can I solve it?
Bookmarks