TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
Advertisement
Associates
Associates
techtuts Darkmindz
CSS Tutorials Tutorialsphere.com - Free Online Tutorials
Boston PHP SurfnLearn
Reply
 
LinkBack Thread Tools Display Modes
Old 07-29-2008, 05:49 PM   #1 (permalink)
The Contributor
 
Evulness's Avatar
 
Join Date: Apr 2008
Location: Tampa, FL
Posts: 62
Thanks: 6
Evulness is on a distinguished road
Default syntax problem

this is my function. it takes post data from a form and is supposed to update the database with that information....
Code:
function DoUpdate(){
global $EvSystem, $EvDB, $guid;
$Cguid = $guid;
$id =$EvSystem->Clean($_POST['id']);
$username =$EvSystem->Clean($_POST['username']);
$email =$EvSystem->Clean($_POST['email']);
$fname =$EvSystem->Clean($_POST['first_name']);
$lname =$EvSystem->Clean($_POST['last_name']);
$packet1 =$EvSystem->Clean($_POST['packet1']);
$packet2 =$EvSystem->Clean($_POST['packet2']);
$comment =$EvSystem->Clean($_POST['comment']);

$sql = "UPDATE users
        SET username='".$username."',
        email='".$email."',
        first_name='".$fname."',
        last_name='".$lname."',
        packet1='".$packet1."',
        packet2='".$paket1."',
        comment='".$comment."'
        WHERE id = '".$Cguid."'
        ";

$result = $EvDB->query($sql)or die(mysql_error());
if($result){
echo 'Update Successful!';
}
else{
echo 'Update NOT successful!';
}
}
$guid is set to equal the$_GET of the incoming url, which in turn is supposed to be used in the where. but when i print my query, all the data shows except the where id... i have guid defined at the begining of the script, to be set when a get['guid'] was present.... this should be working shouldn't it?


Quote:
UPDATE users SET username='test', email='test1@nffsolutions.org', first_name='test', last_name='testie', packet1='sent on 7/25', packet2='', comment='Updated! vdfgfg' WHERE id = ''
the thing is... is i get no errors, no warnings, nothing.... it runs and says it was successful, but when i view the table, it isn't updated...



any ideas whats going on?
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
Send a message via AIM to Evulness
Evulness is offline  
Reply With Quote
Old 07-29-2008, 08:16 PM   #2 (permalink)
The Contributor
 
Evulness's Avatar
 
Join Date: Apr 2008
Location: Tampa, FL
Posts: 62
Thanks: 6
Evulness is on a distinguished road
Default

never mind... i wrote that before lunch and fixed it when i got back here...
it wasn't sending my ID, because i wasn't sending the id via post anymore, once it got to that point...
i had it to just echo the id, nor echo a hiden input with the id & number to be post.

works fine now :)
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
Send a message via AIM to Evulness
Evulness is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 09:06 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0