View Full Version : What characters define an auto number format
Dog-Boy
01-21-2004, 06:20 AM
I'm very new to SQL and I'm trying to write a simple UPDATE query
in FrontPage that will allow an online participant to update a
CompletionDate field of a record that has been filtered to through a
hyperlink.
Each record has a unique ID field named MedID which is an auto
number field.
The table that contains the Info is named 020_Med
Here is the SQL statement ... (Please, What's wrong with it?)
UPDATE 020_Med
SET CompletionDate = '::CompletionDate::'
WHERE MedID = ::MedID::
Welcome here!
What are the :: for?
Your statemens should look like
UPDATE `020_Med`
SET CompletionDate = 'yyyy-mm-dd'
WHERE MedID = MedID
i've added backticks around the tablename, just to be sure. But they are probably not necesary. The 'yyyy-mm-dd' needs to be a datevalue. For today, that would be '2004-01-21' . If it is a datetime column, the value should be in the format 'yyyy-mm-dd hh:mm:ss' like '2004-01-21 09:25:00'
If you want to set the datetime to the current datetime, then you can use
... SET CompletionDate = Now() ...
Check the sticky at the top of this forum for more info and relevant links.
Dog-Boy
01-22-2004, 02:04 AM
Thanks for replying, but I don't think I explained exactly what I'm trying to do. I'm building a web page in FrontPage to hold an Access database that will allow diffrent user groups access to view or manipulate User PID's, scheduled dates and completion dates.
I've set up a page that has three regions lables that hyperlink to a page that filters the records to only the PID's in that region. From that page each PID is a hyperlink to another page that shows all of the records for that particular PID (this table was built with FrontPage's Database Results Wizard). Each record has a unique auto numbered field labled MedID . This MedID field is also a hyperlink to a page that displayes that particular record.
The record consists of four fields...
PID (which comes from the participants table)
ScheduledDate (which was input from a cooridinators user group)
MedID (that was automaticly created when the scheduled date was entered - The primary key)
and CompletedDate (this is the field that I need to be updateable or editable)
I know this is below most of you, but what seemed soo simple in my mind, has proved itself to be frustratingly over my head!
:confused:
IS there A simple EXPLANATION? or even a difficult one?
Thank you in advance for your input. Rich><>
What is it exactly that you need help with?
The links in your last page, should look like
<a href="thepage.php?mid=xxxx&date=2000-01-04" title="Update the completationdate for xxxx ">Update xxxx</a>
where xxxx is the MedID of the record and date contains the value you want to updat the completiondate to. So inside your previous pages, you need a form where the user can fill in the datevalue and post that to a page wich will validate the value, and append itto the querystring in the right format.
So you'll have 1 link for each record which all point to the same page, buth with a different value in the querystring.
Then inside "thepage.php", you need to use the xxxx from the querystring inside the where clause. Like
$sql=("UPDATE `020_Med`SET CompletionDate='". $_GET['date'] ."' WHERE MedID = " . $_GET['mid']);
but you first need to check if $_GET['mid'] contains a valid value, to avoid that people change the querystringvalue.
I'm not sure if this is helping because i don't know what sort of code Frontpage generates and if you can easely slip in your own code.
+ a better wy then the filtering through these links is if you first load a page with 2 or more interdependent dropdown (region -->PID-->MedID) so that you can select the region in the first one which automatically populates the second dropdown etc . The last dropdown then has the MedID value as value for each option. Then have a datefield (or, better still, 3 dropdowns --> 1 for year, 1 for month ...-under these dropdown where the user can enter the date.
Then post the form to thepage.php and inthere have
$date=($_POST['year'] . '-' . $_POST['month'] . '-' . $_POST['day']) ;
$sql=("UPDATE `020_Med`SET CompletionDate='". $date ."' WHERE MedID = " . $_POST['mid']);
But i don't know if this is helping. You basically need to abandon the generated code sooner or later and get your hands dirty and start writing your own code.
vBulletin® v3.8.2, Copyright ©2000-2010, Jelsoft Enterprises Ltd.