Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the UPDATE command in mySQL

Status
Not open for further replies.

vcherubini

Programmer
May 29, 2000
527
US
Hello:

I am having trouble using the UPDATE command in mySQL using a PHP script that I wrote.

First, I have a field called lastupdate that is of type TEXT. I am working on a forum and one of the features I have is when the forum is updated last (i.e., when someone posts a new thread).

I have a variable called $time that is defined as so:

[tt]$time = date("D M d, Y h:i:s");[/tt]

I think want to input into the database with this query:
[tt]$insert5 = "UPDATE forums SET lastupdate=$time WHERE forumid=$forumid";
[/tt]

But when I try this, it will not add into the database. Are you not able to update fields of type TEXT. I also tried to make the field of type DATE with PHPMyAdmin, but I had no luck in doing that.

Can anyone help?

Thanks,

-Vic vic cherubini
malice365@hotmail.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director
====
 
Man, I feel dumb now. I got it. I needed to add single quotes around the $time variable in the mySQL query so it reads:

[tt]"UPDATE forums SET lastupdate='$time' WHERE forumid=$forumid";[/tt]

Because I made time a string.

Dumb me,

-Vic
vic cherubini
malice365@hotmail.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash, Director
====
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top