Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simply edit a field in the DB

    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?

    Code:
    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.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •