PDA

View Full Version : Simply edit a field in the DB



baked
10-28-2009, 04:56 AM
I'm trying to edit the advertisement field in this database using Celerondude's upload script. However, it doesnt seem to work and I can't figure it out. Would anyone care to take a look?


elseif ( $action == 'editadvert' )
{
if ( $task == 'save' )
{
$ad_id = gpc ( 'ad_id', 'P');

$mysqlDB->query ( sprintf ( "UPDATE uploader_users SET advert_id='$ad_id' WHERE userid=%d;", (int)$ad_id, $UPL['USER']['userid'] ) );

// back to preferences
header ( 'Location: ' . $_SERVER['HTTP_REFERER'] );
}
else
{
// show form
$inf = array
(
'ad_id' => $UPL['USER']['advert_id'],
);
$tpl_usercp->set ( 'user', $inf);
$tpl_uploader->set ( 'content', $tpl_usercp, '$ad_id' );
}
}


All I'm getting for the output is "0"..

thank you.

Fumigator
10-28-2009, 04:42 PM
Do your variables in the UPDATE query contain the values you expect them to have? To find out, echo them.

Does your database class catch query errors?