|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I am having an issue with my script and was wondering if anyone could help. Here goes:
$current_full_date = $_GET['year']; $current_full_date .= "-"; $current_full_date .= $_GET['month']; $current_full_date .= "-"; $current_full_date .= "00"; $db_connection = mysql_connect ($DBHost, $DBUser, $DBPass) OR die (mysql_error()); $db_select = mysql_select_db ($DBName) or die (mysql_error()); $query = "SELECT * FROM subscribers WHERE date_added >= \"$current_full_date\""; $query_result = mysql_query($query); while ($row = mysql_fetch_array($query_result)) { $subscriber_id = $row['id']; $subscriber_type = $row['type']; $date1 = $row['date_added']; $day = substr($date1, 8, 2); $events[$day][] = $subscriber_id; $event_info[$subscriber_id]['0'] = "New "; $event_info[$subscriber_id]['1'] = ucfirst("$subscriber_type"); } FOR($i = 1; $i <= $days_in_month; $i++) { IF(isset($events[$i])) { echo "<div align=\"left\">"; while (list($key, $value) = each ($events[$i])) { echo "$event_info[$value]['0'] . " " . $event_info[$value]['1']"; } } } This is supposed to show a list of people who signed the guestbook during the current month. I know someone is in the database, but I can't get it to show up. Any help is appreciated.
__________________
Silver Spring Real Estate | Southern Maryland Real Estate | Military Relocation Specialist |
|
||||
|
Do not use escape, quote inside mysql querys use single quotes around vars instead.
Also "00" is not a valid date use "01" And if you are only last month try using the date_sub function "Date_SUB(1999-12-01,INTERVAL 1 MONTH)" or "Date_SUB(NOW(),INTERVAL 1 MONTH)"
__________________
Irony: That for most people the most "trusted" web site on the planet is for a company the has been convicted of criminal activity. Both Security and SuSe start with "S". www.oldslides.com |
|
|||
|
Thanks Mushroom,
I'll try the date_sub function, and see if that helps. Also, I've never had any problems escaping in the query before, it's what I use in my search algo too.
__________________
Silver Spring Real Estate | Southern Maryland Real Estate | Military Relocation Specialist |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |