PHP Edit Function Database Form

Hey guys I am seeking help yet again I am stumped I am not sure what is going wrong here minus I am still a novice at PHP lol. Anyways I am working on my edit form and I got some of it to work in the function statement. Here are the codes I use the issue I have is that it will now show the value in edit field when I click on that ID. Also I do not know if it saves any data. Here are the codes I use.

Function
[php] function editScreenShot($id) {
global $DB;

    $status = 'error';
    $message = 'You are not authorized to delete that image';
    
    
    if($this->isLoggedin()) {
        //$id = 454;
        // Verify the screenshot belongs to us
        $image = $DB->getScreenshotById($id);
        
        if(isset($image['id'])) {
            if($image['uid'] == $this->user['steamid']) {
                // We have verified this is our screenshot, lets delete it.
                $DB->update('screenshots', "`id`='{$image['id']}',`name`='{$image['name']}',`type`='{$image['type']}',`description`='{$image['description']}'");
                
                // Edit the images
                $name = $image['name'];
                $type = $image['type'];
	    $description = $image['description'];
                
                $status = 'success';
                $message = 'Image has been updated';
            }
        }
		
    }
    return array('status' => $status, 'message' => $message);		
}   [/php]

URL that calls the id
[php]Edit[/php]

This is the profile page it is actually calling the delete function and works.
[php]if(isset($_GET[‘delete’]) && is_numeric($_GET[‘delete’])) {
$delete_response = $steam->deleteScreenShot($_GET[‘delete’]);
dump($delete_response);
}[/php]
-Note this code above is actually working with the delete function. The dump call is calling for a debug just have not removed it.

EDIT.PHP page this code is at the top suppose to call the function.
[php]if(isset($_GET[‘name’]) && $steam->isLoggedin()) {
$result = $steam->editScreenShot();
echo $result[‘message’];
}
//Tell SteamShots that if the id is not there
//to display the echo
if (!$id) {
echo “Sorry this does not seem to be a valid ID!”;
}[/php]

How I call the value
[php]value="<?php echo $screenshot['name']; ?>"[/php]

If anyone thinks they can help that would be great if not I will try to figure it out.

Thanks

Is the function editScreenShot inside a class? If not, then $this in your function has no value, making your if() return false. Do you have error_reporting turned on? You should during development. Put this at the top of your page, most likely it will give you undefined index errors.
[php]
ini_set(‘display_errors’,1);
error_reporting(E_ALL);
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service