Jump to content

help on a debugging message

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
Confidence

Confidence

    Newbie

  • Members
  • Pip
  • 2 posts
i have following code

	public static function delete_seminar_with_users($id) {
		#Jetzt muessen auch alle User (Teilnehmer dieser Seminar geloescht werden)
		User::delete_all_users_in_seminar ( $id );
		$this->delete ();
	}
	
	public function delete() {
		global $database;
		
		#Und jetzt Record im seminars table auch loeschen
		$sql = "DELETE FROM " . self::$table_name;
		$sql .= " WHERE id=" . $database->escape_value ( $this->id );
		$sql .= " LIMIT 1";
		$database->query ( $sql );
		return ($database->affected_rows () == 1) ? true : false;
	
	}

now when from my test.php file i call
$seminar_delete = Seminar::delete_seminar_with_users(2); 

i get the error about the line
$this->delete ();

[php] Using $this when not in object context in <b>seminar.php</b> on line <b>140</b><br />

how can i replace it, so it runs well in combination with the delete() function?

thanks in advance.

#2
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
$this needs an object referencing (->) when running, not a static referencing (::) as you do.

you need to call your function via the object...
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall