Need Help for this error

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!

Moderator: General Moderators

Post Reply
gogetthealok55
Forum Newbie
Posts: 3
Joined: Tue Jan 13, 2009 3:10 am

Need Help for this error

Post by gogetthealok55 »

Call to a member function exec() on a non-object


all i have done is this

$idno = $_REQUEST['company_idno'];
$sql = "select * from tbl_category where fld_int_compid= '$idno'";
$result = $ado->exec($sql);
$row = $ado->fetch($result);

any help releated to this will be appriciated
gogetthealok55
Forum Newbie
Posts: 3
Joined: Tue Jan 13, 2009 3:10 am

Re: Need Help for this error

Post by gogetthealok55 »

i have created exec() function and fetch() function and created ado object...which i have used here... i have used the same process the query in other case which works pretty well but i m getting the above error here.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Need Help for this error

Post by jaoudestudios »

NB: I would strongly recommend putting protection on your code! (MySql & shell). Also REQUEST is very sloppy!
jthayne
Forum Newbie
Posts: 5
Joined: Fri Jan 09, 2009 10:51 am

Re: Need Help for this error

Post by jthayne »

You will need to post the code for your exec() function.
gogetthealok55
Forum Newbie
Posts: 3
Joined: Tue Jan 13, 2009 3:10 am

Re: Need Help for this error

Post by gogetthealok55 »

this is code for exec()

function exec($sql)
{
$result = mysql_query($sql,$this->connection);
if($result)
{
return $result;
}
else
{
echo "<br>Error in Query.<br>";
exit;
}
}
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Need Help for this error

Post by jaoudestudios »

Sorry I thought we were talking about dropping into the shell with the exec function...http://uk3.php.net/function.exec.

You should call your function something else. PHP does not have namespaces yet, you'll have to wait until php6 is released :)...
http://uk.php.net/manual/en/language.na ... ionale.php
Post Reply