Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
UPDATE query not working.
Old 05-13-2010, 12:58 AM UPDATE query not working.
Average Talker

Posts: 22
Name: john
Trades: 0
alright i'm trying to UPDATE my data but i can't seem to find out what's wrong. i mean... everything is working correctly meaning it doesn't give me any errors, it even redirects me back to the page but nothing changes....

here is my code

PHP Code:
<?php
include('connect.php');

$id $_POST['id'];
$setname $_POST['setname'];
$hacker $_POST['hacker'];
$abuser $_POST['abuser'];
$ban $_POST['ban'];

$Query mysql_query("UPDATE members SET 
`setname`='
$setname',
`hacker`='
$hacker',
`abuser`='
$abuser',
`ban`='
$ban'
WHERE `id`='
$id'") or die(mysql_error());
header("Location: tagging.php");
?>
microsoftx is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-13-2010, 02:15 AM Re: UPDATE query not working.
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
Try sanitizing your data and this code
PHP Code:
<?php
include('connect.php');

$id $_POST['id'];
$setname $_POST['setname'];
$hacker $_POST['hacker'];
$abuser $_POST['abuser'];
$ban $_POST['ban'];

$Query mysql_query("UPDATE members SET 
`setname`='
$setname',
`hacker`='
$hacker',
`abuser`='
$abuser',
`ban`='
$ban'
WHERE `id`='
$id'") or die(mysql_error());
if (
mysql_errno() > 0) {echo mysql_error();} else {echo 'No errors found in MySQL';}
header("Location: tagging.php");
?>
That will tell you if the database is having a problem with the command.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 05-13-2010, 04:37 AM Re: UPDATE query not working.
Average Talker

Posts: 22
Name: john
Trades: 0
after applying that this is what i got

Quote:
No errors found in MySQL
Warning: Cannot modify header information - headers already sent by (output started at /home1/dangmnne/public_html/connect.php:49) in /home1/dangmnne/public_html/adminuserupdate.php on line 17
microsoftx is offline
Reply With Quote
View Public Profile
 
Old 05-14-2010, 10:18 PM Re: UPDATE query not working.
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
You'll need to see why there's output on line 49 of connect.php.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 05-18-2010, 08:15 AM Re: UPDATE query not working.
Phunk Rabbit's Avatar
Ultra Talker

Posts: 255
Name: John Nerush
Location: Milton Keynes, UK
Trades: 0
It looks like you have a header function in adminuserupdate.php, probally a header redirect once the info has been updated in the database.

To get around this you could use output buffering ( http://uk2.php.net/manual/en/ref.outcontrol.php ).

It is as simple as popping this at the top of the file:
PHP Code:
<?php 
ob_start
();
However you should read into it.
Phunk Rabbit is offline
Reply With Quote
View Public Profile Visit Phunk Rabbit's homepage!
 
Reply     « Reply to UPDATE query not working.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.29570 seconds with 12 queries