Query Select within a function

Codes here !

Moderators: egami, macek, gesf

Post Reply
NigelRen
php-forum Fan User
php-forum Fan User
Posts: 622
Joined: Fri Aug 05, 2011 9:53 am

Tue Sep 11, 2012 11:53 pm

In short - you can't do it that way.

You will have to use something like...

Code: Select all

$query = $this->query("SELECT username FROM ".DBTBLE." WHERE id = '$id'");
foreach ($query as $row) {
        return $row['username'] ." was deleted.";
}
Although I'm not sure how selecting a row and finding it will indicate it's deleted - but that's or you to decide.

NigelRen
php-forum Fan User
php-forum Fan User
Posts: 622
Joined: Fri Aug 05, 2011 9:53 am

Wed Sep 12, 2012 5:07 am

The code you posted shows exactly the same problems as before - so if you follow the same suggestion as before, changing the appropriate parts, then you can get at the e-mail address.

If you look at the manual, you should see that query returns some form of result set - not an individual columns value.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests