Forum Moderators: coopster
I have a script based on smarty template. After I corrected one mistake in the file chatmsgs.php I got this error:
Fatal error: Call to a member function on a non-object in /usr/home/chatmsgs.php on line 77
I don't know what is the problem, because before and after that line there are many object functions:
[line 75] $query = $db -> Execute("SELECT id FROM chat");
[line 76] $numchat = $query -> RecordCount();
[line 77] $query -> Close();
What the problem may lie?
As I can see it could be anywhere... :(
Help! - I need that chat :)
Michal Cibor
session_start();
require_once('libs/Smarty.class.php');$smarty = new Smarty;
$smarty -> compile_check = true;
$stat = $db -> Execute("SELECT id, rank, lang, seclang, style, graphic FROM players WHERE email='".$_SESSION['email']."' AND pass='".MD5($_SESSION['pass'])."'");
...
$chat = $db -> SelectLimit("SELECT * FROM chat WHERE lang='".$stat -> fields['lang']."' OR lang='".$stat -> fields['seclang']."' AND ownerid=0 OR ownerid=".$stat -> fields['id']." OR senderid=".$stat -> fields['id']." ORDER BY id DESC", 15);
...
while (!$chat -> EOF)
{
$text = wordwrap($chat -> fields['chat'],30,"\n",1);
$arrtext[$i] = $text;
$arrauthor[$i] = $chat -> fields['user'];
$arrsenderid[$i] = $chat -> fields['senderid'];
echo "6d";
$chat -> MoveNext();
echo "6e";
$i = $i + 1;
}
...
PS. This is chunk from Vallheru code under GNU
Moreover the file chat.php works fine, however the chatmsgs.php which is run in a frame doesn't work. Horrible!
$pass = MD5($_SESSION['pass'];
$stat = $db -> Execute("SELECT id, rank, lang, seclang, style, graphic FROM players WHERE email='".$_SESSION['email']."' AND pass='$pass'");
and it works fine...
I found the problem after remaking everything to plain mysql_fetch_array which returned error - not a valid identifier, and mysql_num_rows was 0. So then I checked the query and the md5 of pass wasn't the same as what's stored in the db.
To say the truth my solution is veery baad! I just got rid of pass in one file (very bad indeed).
So it was more of a logic problem. However it's strange that object fetching didn't raise any errors, just empty object. But maybe that's how adodb fetches data.
Thanks for your fast response!
Michal Cibor