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
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 11-15-2008, 05:00 AM   #1 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default You are subscribed to this thread mysql update with multi fields

if i have something like this

Code:
status:  
<select name="status">
<option value="pending">pending</option>
<option value="complete">complete</option>
<option value="declined">declined</option>
</select>

<br>

deadline: <input type="text" name="deadline">

<br>

status: &nbsp;
<select name="status">
<option value="pending">pending</option>
<option value="complete">complete</option>
<option value="declined">declined</option>
</select>

<br>

deadline: <input type="text" name="deadline">

<br>

status: &nbsp;
<select name="status">
<option value="pending">pending</option>
<option value="complete">complete</option>
<option value="declined">declined</option>
</select>

<br>

deadline: <input type="text" name="deadline">

<br>
how do i update each field with mysql update if the table structure looks something like this

Code:
id -- primary key, auto_increment
hash - varchar(100)
status -- varchar(25)
deadline -- date
and the values in this table looks something like this

Code:
id (1)
hash (90j23d093209jk309j3)
status (pending)
deadline(10/10/2008)

id (2)
hash (90j23d093209jk309j3)
status (pending)
deadline(10/10/2008)

id (3)
hash (90j23d093209jk309j3)
status (pending)
deadline(10/10/2008)
just a note the purpose of hash is an md5 or sha1 conversion of the users name to track the users information from table to table. and if i have like 100 people each with a different hash value i can track their information. but the problem i'm having is how do i update the fields if i have being displayed on the page?? u would it it would probably be with the id value but how or where do i display that to track that.??

Code:
this is what the sql update query looks like that im using

$status = mysql_real_escape_string($_POST['status']);
$deadline = mysql_real_escape_string($_POST['deadline'];
$user = $_GET['user']; 
mysql_query("update tbl_userpackage set status = '$status', deadline = '$deadline' where hash = '$user'");
but when i do the update the onyl value that comes in is the last item which is in id 3 all the other stuff doesnt go through
__________________
no signature set
sarmenhb is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 12:14 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design