Member Avatar

Hello people,

When I call my function ReadMyTable::readAdmin(); i get an error where it says I have not the right to use self::admin within that function, please, help me to fix this problem !

here is my code :


class ReadMyTable{
	public static $admin="admin";
	public static $presentation="presentation";
	public static function getAdmin(){
		return self::$admin;
	public static function getPresentation(){
		return self::$presentation;		
	public static function readAdmin(){
   	  $radmin="SELECT * FROM self::$admin";
   	  $qadmin=mysql_query($radmin)or die(mysql_error());
   	  return $rowadmin;


$radmin="SELECT * FROM ".self::$admin;
Member Avatar

thank you, but it says :

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROMadmin' at line 1

Based on error it seems you haven't provide space after FROM.
There must be a space after FROM for proper query.

Member Avatar

it works !!!!
thank you very much vibha !!!!

Member Avatar

i mean i added the space you asked after FROM and it works !!!
than you again very much

Welcome :)
Make thread solved.