473,473 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

MySQL query changes depending on $_GET

348 Contributor
Hi all. I have what is to me, a challanging question that I am totally lost on.

I have a form that contains multiple records from a db. I have an edit button that is just sitting there. I want to use this edit button to edit a record in the db but I can't for the life of me figure out how I am going to tie a particular record to this floating edit button.

I suppose if I had to diagram it for clarity I would do something like this:

customer:
1
2
3
4
5

That would be in a dropdown box. The user selects the customer number and the form posts to itself and populates the form with that customers data. The url would look something like:

?id=3&dk=34

I suppose what I need is a way to use that string using the $_GET method for my update sql. I know how to use $_GET but since the dropdown is dynamic the above url will change as the user changes the customer. I need to assign the posted values to the edit button to edit the proper record.

I'm sorry if I am not making much sense here. Can somebody please give me a hand?

Thanks,

Frank
Sep 1 '07 #1
3 1551
Weisbartb
36 New Member
If I am understanding you correctly, simply set the option value to the ID of the row. For instance if the rowid is 10
Expand|Select|Wrap|Line Numbers
  1. <option value="10">Whatever text you want</option>
  2.  
On the receiving end of the script

[php]
<?php
$id = $_GET['fieldname'];
$sql = 'UPDATE your_table WHERE id='.$id.' SET do=update';
mysql_query($sql);
?>
[/php]
If this isn't what you are looking for can you please provide some additional information about what you are doing.
~
Brian W.
Sep 1 '07 #2
fjm
348 Contributor
If I am understanding you correctly, simply set the option value to the ID of the row. For instance if the rowid is 10
Expand|Select|Wrap|Line Numbers
  1. <option value="10">Whatever text you want</option>
  2.  
On the receiving end of the script

[php]
<?php
$id = $_GET['fieldname'];
$sql = 'UPDATE your_table WHERE id='.$id.' SET do=update';
mysql_query($sql);
?>
[/php]
If this isn't what you are looking for can you please provide some additional information about what you are doing.
~
Brian W.
Hi Brian,

Thanks for the reply. What you have provided is exactly what I was wanting to do. I was playing around with my script and came to the same conclusion and wanted to post back.

I'm sorry that I am not clear sometimes as to what I need. I am a nubie. :)

Thanks again,

Frank
Sep 1 '07 #3
Weisbartb
36 New Member
Glad I could be of help.
~
Brian W.
Sep 2 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Krista | last post by:
Hi, Hope you guys can help me out~~ I have a config.php file. I want to conncet to my own mysql version. When i run the config.php file as below, i get all successful message. However, when i take...
2
by: JDJones | last post by:
Using PHP and MySQL. Trying to put a list of categories into a drop down select option of a form like: <form name="form" action="<? print $_SERVER?>" method="get"> <select name="subject">...
3
by: Mike Cocker | last post by:
Hello, I'm quite weak at PHP, so I was hoping to get some help understanding the below code. First off, I'm trying to create a "query form" that will allow me to display the results on my...
9
by: JT | last post by:
I am working on a basic webpage in PHP connecting to a mySQL database, here is my query... //query 1 $query_rs_staff = "SELECT * FROM jtStaff WHERE locationID=".$_GET; $rs_staff =...
10
by: eholz1 | last post by:
Hello Members, I am setting up a photo website. I have decided to use PHP and MySQL. I can load jpeg files into the table (medium blob, or even longtext) and get the image(s) to display without...
1
by: jenson | last post by:
<?php /* * Created on Apr 13, 2007 * * To change the template for this generated file go to * Window - Preferences - PHPeclipse - PHP - Code Templates */ require_once 'init.php'; ...
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
4
by: John | last post by:
Hello All, Can someone help me with a problem I am having? I have a form which has a multi-select list where the user can select more than one company name from a list and I need to pass those...
9
by: chromis | last post by:
Hi, I've never coded in ASP before and I'm trying to port a couple of simple PHP files to ASP.NET. The first file addScores.php takes form data and a hash and inserts the data into the db, it...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.