View Full Version : mysql query involving dateline
chris1979
06-24-2009, 08:58 PM
I want to change the title of all new threads that were posted in a certain forum in the last 30 days.
Can you help me with the query?
I think it should be something like...
UPDATE thread SET title='additional text '+title
WHERE dateline<????
AND forumid=1;
Thanks in advance!
You can use a timestamp generator (http://www.4webhelp.net/us/timestamp.php) to get the variable you need. If you're doing this in PHP, you can use the following...
$last30 = mktime(0, 0, 0, date("m"), date("d")-30, date("y"));
Then simply plug $last30 into your SQL statement.
chris1979
06-26-2009, 06:18 PM
thanks
this bit will work?
title='additional text '+title
jchamber2010
06-27-2009, 03:12 AM
if you are trying to append an existing variable to a new variable in PHP you use the following format
<?
$var1 = "some text here". $var2
?>
Dismounted
06-27-2009, 04:51 AM
this bit will work?
title='additional text '+title
Yes, that should work. However, always try on some test data first!
DragonBlade
06-27-2009, 01:10 PM
I've never tried with a Plus Symbol before, but the way that I would do it is:
UPDATE blah SET bleh=CONCAT('blah blah blah ', bleh);
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.