Jump to content

Funtion won't run from link


BrettCarr

Recommended Posts

Hi people, I've written a real simple class call User, wich has the most  basic of functions in it

The one called output returns some data from the database along with a delete link wich should call the delete function from the same class

I have no idea why it won't run..... I'm stumped as to what i'm doing wrong  PLEASE SHOW ME WHERE MY STUFF UP IS...

 

This is the class called user

<?php
class User extends Database
{
    function read()
    {
        $this->query("SELECT * FROM sales_peepl;");
    }
    function delete($id)
    {
        $this->query("DELETE * FROM sales_peepl WHERE salesid = {$id};");
    }
    function output()
    {
        return $this->_row->sales_person ." - ". $this->_row->access . " " . '<a href="?=action=$this->delete&id='.$this->_row->salesid.'">delete</a>' . "<br/>";
    }
}
?>

and this is the output page wich shows the data and link

<?php
include_once($_SERVER['DOCUMENT_ROOT'] . '/sales/includes/global.php');
$t = new User();
$t->connect(HOST, USERNAME , PASSWORD, DATABASE);
$t->read();
?>
<html><head><title></title> </head>
    <body>
        <?php
        while ( $t->next())
        {
        echo $t->output() . "   ";
        }
        ?>
    </body>
</html>

 

As you can see its very basic...... But the bloody link won't work :'(

 

Link to comment
https://forums.phpfreaks.com/topic/212522-funtion-wont-run-from-link/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.