Re: [PHP] Setting date fields in mysql queries
I ran the query in PhpMyAdmin. It work fine. It still doesn't work when I try to run it in another script. Frank wrote: > > Hi, > > it's a great tip to install PhpMyAdmin - or phpPgAdmin for PostgresSQL - > this will only take you at most half an hour even for a newcomer. > > You can then easily test queries, see any error messages and see what > result they have on tables. > > In this case I'd echo out the query > > echo $query = "UPDATE countertable SET CurrDate = '$ndate' WHERE ID = $id" > > and try to cut-and-paste it into the query-field in PhpMyAdmin. > > When you say "nothing happens" you'd probably discover that ID is a > number not matching anything _or_ that $nDate and the field are not > proper date values ;-) > > Hope it helps! > > Frank, U5 > > > PHP work! > > Looking for PHP work over the net? Or would like to try to work in South > East Asia's most exiting place, Bangkok? > Then jump to http://www.u5.com/ and fill out the Developers Form. > We are urgently looking for new people in October 2002 > > > > > At 15:16 2/10/2002 -0400, you wrote: > >> I have the following line in a program I'm working on: >> >> $query = "UPDATE countertable SET CurrDate = '$ndate' WHERE ID = $id" >> >> $ndate is a properly formated date read from a text field on a form on >> the previous page. When I run the query using mysql_query, it returns >> TRUE each time, but the field is not updated. The only explanation I >> can think of is that there is something wrong with the date value. >> I've echoed it to the screen and it looks fine, but the query still >> doesn't work. Any suggestions? >> >> Thanks in advance, >> >> Brad >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Setting date fields in mysql queries
Hi, it's a great tip to install PhpMyAdmin - or phpPgAdmin for PostgresSQL - this will only take you at most half an hour even for a newcomer. You can then easily test queries, see any error messages and see what result they have on tables. In this case I'd echo out the query echo $query = "UPDATE countertable SET CurrDate = '$ndate' WHERE ID = $id" and try to cut-and-paste it into the query-field in PhpMyAdmin. When you say "nothing happens" you'd probably discover that ID is a number not matching anything _or_ that $nDate and the field are not proper date values ;-) Hope it helps! Frank, U5 PHP work! Looking for PHP work over the net? Or would like to try to work in South East Asia's most exiting place, Bangkok? Then jump to http://www.u5.com/ and fill out the Developers Form. We are urgently looking for new people in October 2002 At 15:16 2/10/2002 -0400, you wrote: >I have the following line in a program I'm working on: > >$query = "UPDATE countertable SET CurrDate = '$ndate' WHERE ID = $id" > >$ndate is a properly formated date read from a text field on a form on the >previous page. When I run the query using mysql_query, it returns TRUE >each time, but the field is not updated. The only explanation I can think >of is that there is something wrong with the date value. I've echoed it >to the screen and it looks fine, but the query still doesn't work. Any >suggestions? > >Thanks in advance, > >Brad > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Setting date fields in mysql queries
[snip] I have the following line in a program I'm working on: $query = "UPDATE countertable SET CurrDate = '$ndate' WHERE ID = $id" $ndate is a properly formated date read from a text field on a form on the previous page. When I run the query using mysql_query, it returns TRUE each time, but the field is not updated. The only explanation I can think of is that there is something wrong with the date value. I've echoed it to the screen and it looks fine, but the query still doesn't work. Any suggestions? [/snip] Are you actually running the query somehow? Like with mysql_query()? Since you didn't deliver more code it this is the guess I would take. $query = "UPDATE countertable SET CurrDate = '$ndate' WHERE ID = $id" ; // do some error checking if(!($data = mysql_query($query, $your_bd_connection))){ print("MySQL reports: " . mysql_error() . "\n"); exit(); } HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Setting date fields in mysql queries
> From: Brad Harriger [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, October 02, 2002 3:17 PM > Subject: [PHP] Setting date fields in mysql queries > > > I have the following line in a program I'm working on: > > $query = "UPDATE countertable SET CurrDate = '$ndate' WHERE ID = $id" > > $ndate is a properly formated date read from a text field on > a form on > the previous page. When I run the query using mysql_query, > it returns > TRUE each time, but the field is not updated. The only explanation I > can think of is that there is something wrong with the date > value. I've > echoed it to the screen and it looks fine, but the query > still doesn't > work. Any suggestions? When you say it looks fine, are you meaning it looks like 2002-10-02? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php