Current location: Hot Scripts Forums » Programming Languages » PHP » php mysql updating problem


php mysql updating problem

Reply
  #1 (permalink)  
Old 11-06-04, 02:50 PM
kevinb kevinb is offline
Newbie Coder
 
Join Date: Nov 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Post php mysql updating problem

I have a problem, I've been trying to make a script that shows members (gets from the database), I can get it to pull up the data.. Then I tryed making an admin page that has the same view of the members, but has links to add more, edit and delete them. All my scripts work, I can add, and delete. but I can't update. I made it so it stores the Username, Rank, Email, and Date they joined, but when I goto my update page, it puts all the right data in a form to edit but when I submit it, it doesn't update the data base. Here's the script that my update from points to

PHP Code:

<?php

$id 
$_REQUEST['id'];
$username $_REQUEST['username'] ;
$rank $_REQUEST['rank'] ;
$email $_REQUEST['email'] ;
$date $_REQUEST['date'];
include(
'includes/db.php');  //this connects to my database
$query="UPDATE `members` ( `id` , `username` , `rank` , `email` , `date` ) VALUES ('$id', '$username', '$rank', '$email', '$date') WHERE id='$id'";

$result=mysql_query($query)
    or die(
mysql_error());

$numrows=mysql_affected_rows();
echo 
"Records updated: $numrows";

?>
I don't have a clue how to get it to update my database. I've tried millions of things, I've looked at tutorials of how to do it, all I haven't been able to get one to work.. Help Please

Thanks
Reply With Quote
  #2 (permalink)  
Old 11-06-04, 03:12 PM
kevinb kevinb is offline
Newbie Coder
 
Join Date: Nov 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
never mind, I figure it out, thanks anyway
Reply With Quote
  #3 (permalink)  
Old 11-06-04, 03:15 PM
Romeo Romeo is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Try this...
$query="UPDATE `members` ( `id` , `username` , `rank` , `email` , `date` ) VALUES (" .$id .", '" .$username ."', " .$rank .", '" .$email ."', '" .$date ."') WHERE id=" .$id;

Aiby@hotmail.com
Reply With Quote
Reply

Bookmarks


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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 02:22 AM
php and mysql problem AccelEric PHP 1 10-20-04 07:37 PM
another php search mysql problem sumogray PHP 6 06-28-04 08:03 AM
question about updating a page or database for an, php and mysql updating mikewooten PHP 1 02-12-04 12:11 AM
Problem with adding content to mysql from php HasansWeb PHP 3 01-10-04 05:26 PM


All times are GMT -5. The time now is 05:13 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.