Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2007-07-14, 02:56 AM   #1
Porn Junkie
I've always wondered if there was a god. And now I know there is -- and it's me
 
Porn Junkie's Avatar
 
Join Date: Apr 2007
Location: Canada Eh!
Posts: 325
Send a message via ICQ to Porn Junkie
PHP help

I need to write a select statement that basically pulls records out for the current date. Kind of what link lists use to show the days current selections.

I use <?php echo(date('F j, Y'))?> in my submit form but can't seem to figure out how to do a select to retrieve just todays submissions.

I thought this would work but it doesn't. $query_rsfeatured = "SELECT * FROM tsoomain WHERE tsoomain.ldate='<?php echo(date('F j, Y'))?>'";

HELP
__________________
EzAngels EzLinks - Submit here
Porn Junkie is offline   Reply With Quote
Old 2007-07-14, 07:05 PM   #2
JK
Well you know boys, a nuclear reactor is a lot like women. You just have to read the manual and press the right button
 
Join Date: Nov 2003
Posts: 157
Try something like this, define the date first. No coffee in my system yet so it might not work.

PHP Code:
$date date('F j, Y');

$query_rsfeatured "SELECT * FROM tsoomain WHERE tsoomain.ldate=$date";

$result mysql_query($query_rsfeatured); 
__________________
To alcohol! The cause of, and solution to, all of life’s problems
JK is offline   Reply With Quote
Old 2007-07-15, 05:14 AM   #3
Porn Junkie
I've always wondered if there was a god. And now I know there is -- and it's me
 
Porn Junkie's Avatar
 
Join Date: Apr 2007
Location: Canada Eh!
Posts: 325
Send a message via ICQ to Porn Junkie
worked like a freakin charm!

Greatly appreciated JK
__________________
EzAngels EzLinks - Submit here
Porn Junkie is offline   Reply With Quote
Old 2007-07-19, 09:56 AM   #4
AcidMaX
Programming till my fingers bleed.
 
AcidMaX's Avatar
 
Join Date: Aug 2003
Location: Michigan
Posts: 876
Other options are:

SELECT * FROM tablename WHERE date = now();

OR

SELECT * FROM tablename WHERE date BETWEEN '2007-06-01 00:00:00' AND '2007-06-01 23:59:59'

really depends on your database structure. Always multiple ways to skin a cat.
AcidMaX is offline   Reply With Quote
Old 2007-07-26, 12:39 AM   #5
Tinkerbell
Just because I don't care doesn't mean I don't understand!
 
Tinkerbell's Avatar
 
Join Date: Oct 2006
Posts: 95
Send a message via ICQ to Tinkerbell
Just to explain why it is what you did, didn't work... The <?PHP and ?> tags are used to tell your server that what lies between them is going to be PHP code. The thing is, given that you had a variable, $query_rsfeatured, in your script already, you probably had those tags somewhere else before and after the code you quoted above. Placing another pair between those tags would produce an error. In other words, if you've already written <?PHP somewhere, you don't need to write it again until you've closed the first one with ?>.
Tinkerbell is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:19 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc