[PHP] selecting based on a month in a date
Hi, Asked this on the mySQL list but it seems to be more of a PHP syntax thing that a mySQL thing. In have the following line in PHP ?php $today = getdate();? I have a mySQL table which contains dates formatted as dates(-xx-xx) I want to select all records based on a specific month. This is my select statement SELECT * FROM sti_tracking WHERE `date` = MONTHNAME('$today') = 'August' Cased in php it looks like so... ?php mysql_select_db($database_sti_tracking_DB, $sti_tracking_DB); $query_totalHitsMonth_RS_RS = SELECT * FROM sti_tracking WHERE `date` = MONTHNAME('$today') = 'August'; $totalHitsMonth_RS_RS = mysql_query($query_totalHitsMonth_RS_RS, $sti_tracking_DB) or die(mysql_error()); $row_totalHitsMonth_RS_RS = mysql_fetch_assoc($totalHitsMonth_RS_RS); $totalRows_totalHitsMonth_RS_RS = mysql_num_rows($totalHitsMonth_RS_RS); ? but this isn't workingit's returning no records which is wrong. Anyone see a problem? Thx Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie Question regarding Syntax
?php echo 'Email: '.'A HREF=mailto:[EMAIL PROTECTED]'.$row_rep_RS['repEmail'].'/A'; ? Obviously this isn't working. What is the proper syntax when you have to use double quotes inside the tag? Thx Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question regarding Syntax
Sorry guys.It think there is a bit of confusion. I miss typed what I need to do. $row_rep_RS['repEmail'] is actually the email address I want to turn into a link. So I guess it would look something like. ?php echo 'Email: '.'A HREF=mailto:'.$row_rep_RS['repEmail'].''.$row_rep_RS['repEmail'].'/A'; ? Whewthink I made a mess of that Is that any more clear? Thanks for the very quick responses guys! Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 8:28 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Newbie Question regarding Syntax * Thus wrote Creative Solutions New Media ([EMAIL PROTECTED]): ?php echo 'Email: '.'A HREF=mailto:[EMAIL PROTECTED]'.$row_rep_RS['repEmail'].'/A'; ? Obviously this isn't working. What is the proper syntax when you have to use double quotes inside the tag? I usually prefer this method, its a style choice and others might argue using it.: Email: a href=mailto:[EMAIL PROTECTED] ?php echo $row_rep_RS['repEmail']; ?/a A lot easier/cleaner than to trying to concat and escape everything. Curt -- I used to think I was indecisive, but now I'm not so sure. -- 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] Newbie Question regarding Syntax
Thank you Curt. Works great and your right I makes more sense to do it that way. Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 8:45 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Newbie Question regarding Syntax * Thus wrote Creative Solutions New Media ([EMAIL PROTECTED]): Sorry guys.It think there is a bit of confusion. I miss typed what I need to do. ?php echo 'Email: '.'A HREF=mailto:'.$row_rep_RS['repEmail'].''.$row_rep_RS['repEmail'].'/A'; ? You should make sure to quote your html values ( href=value ), it will lead to trouble if you don't. I would still do it like this: Email: a href=mailto:?php echo $row_rep_RS['repEmail']? ?php echo $row_rep_RS['repEmail']?/a Curt -- I used to think I was indecisive, but now I'm not so sure. -- 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] detecting referer
Thanks all who replied. Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -Original Message- From: Chris Shiflett [mailto:[EMAIL PROTECTED] Sent: August 7, 2003 1:07 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] detecting referer --- Creative Solutions New Media [EMAIL PROTECTED] wrote: What is the best way, using php, to detect information about the referrer to a page. echo $_SERVER['HTTP_REFERER']; To see all of the information the Web server makes available to you, try this: print_r($_SERVER); Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- 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
[PHP] Calling to a page without having to load it
Hello, I have a weird problem I was hoping someone could help with. I have a client who hosts a site on a standard server (No PHP et all) Currently he has some Flash based content. Within the Flash content I can call to PHP pages in another domain to push and pull data from a mySQL DB into the Flash App (Basically what I am doing is tracking page hits within the flash movie). However, now there are going to be some standard HTML pages as well (no Flash). I would like to be able to integrate the tracking system to record hits on those pages as well. Is there a way to do this externally (to launch a PHP script on another server without actually have to load a PHP page). I know this is a bit of a weird thing but if anyone has a suggestion (beyond telling the customer to spring for PHP access himself) I would appreciate it very much. Thanks. Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] detecting referer
Hello, Bit of a newbie question I guess. What is the best way, using php, to detect information about the referrer to a page. Is this possible/difficult using PHP? Thanks, Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem sortiing dyn query
Hi John, Thanks. Just wanted to make sure we were on the same page as the line of code in question wrapped in my original message. You saying the solution is $query_Recordset1 = sprintf(SELECT * FROM sti_tracking ORDER BY %s %s,$reSort_Recordset1,$direction_Recordset1); Correct? Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: August 7, 2003 7:15 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Problem sortiing dyn query Creative Solutions New Media wrote: Hi Can someone give me some indication why this might not be working? $query_Recordset1 = sprintf(SELECT * FROM sti_tracking ORDER BY '%s' '%s', $query_Recordset1 = sprintf(SELECT * FROM sti_tracking ORDER BY %s %s, $reSort_Recordset1,$direction_Recordset1); the values for $reSort_Recordset1 and $direction_Recordset1 are passed through from another page. $reSort_Recordset1 is the files to sort on and $direction_Recordset1 is the direction (ASC or DESC). Thanks You're more than welcome. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals - www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP, JavaScript and populating DropDowns
Thanks very much John. It looks great. Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -Original Message- From: John Manko [mailto:[EMAIL PROTECTED] Sent: July 29, 2003 2:49 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Php. Net Subject: Re: [PHP] PHP, JavaScript and populating DropDowns assuming you have a table with colors, and each color has car associated with it (yes, there might be dup color entries). This should work (check spellings and case, etc..etc...) $query=SELECT * from colors; $results = mysql_query($query) or die (DB ERROR: . mysql_error()); $num = mysql_numrows($results); $i=0; echo script language=javascript\n!--\n; while ($i $num) { echo \n ca[$i] = new Array();; echo \n ca[$i][0] = \ . mysql_result($results,$i,CarID) . \;; echo \n ca[$i][1] = \ . mysql_result($results,$i,ColorID) . \;; echo \n ca[$i][2] = \ . mysql_result($results,$i,ColorName) . \;\n; ++$i; } echo function changeColor(ns) {var SelectColor, NumEntries, i; for (i = document.form1.selectcolor.length; i 0; i--) { document.addform.selectcolor.options[i-1] = null; } document.form1.selectcolor.options[0] = new Option(-- Select Color --,0); len = 0; if (ns != 0) { NumEntries = ca.length for (i = 0; i NumEntries; i++) { if(ca[i][0] == ns){ len++; document.form1.selectcolor.options[len] = new Option(ca[i][2],ca[i][1]); } } } document.form1.selectcolor.selectedIndex = 0; } ; echo \n//--\n/script\n; this in later in the page... $query=SELECT * from car; $results = mysql_query($query) or die(brERROR - Please Contact Site Administratorbr); $num = mysql_numrows($results); $i=0; echo select onchange='changeColor(this.value);' name='selectcar'option value='0'Select Car/option; while ($i $num) { $id=mysql_result($results,$i,CarID); $name=mysql_result($results,$i,CarName); echo option value='$id'$name/option; ++$i; } echo /select; echo select name=selectcoloroption value='0'-- Select Color --/option/select; --- Creative Solutions New Media wrote: Hello, I am using mySQL and PHP to pull some data into my page. I have 2 dropdown boxes. As an example lets say dropbox1 has a list of cars and dropbox2 has a list of colours. Here's the thing. The colours for each car vary so I won't know what colours to populate the 2nd dropbox with until a car is chosen. I really want this all contained on 1 page. Is there a standard way of dealing with this? The only thing I can think of is to reload the page once the make of car is selected which would give me the opportunity to populate the 2nd drop box at that time but that doesn't seem like a good solution. I don't know much in the way of JS but is there a way to do what I need that way? Thanks. Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -- 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
[PHP] PHP, JavaScript and populating DropDowns
Hello, I am using mySQL and PHP to pull some data into my page. I have 2 dropdown boxes. As an example lets say dropbox1 has a list of cars and dropbox2 has a list of colours. Here's the thing. The colours for each car vary so I won't know what colours to populate the 2nd dropbox with until a car is chosen. I really want this all contained on 1 page. Is there a standard way of dealing with this? The only thing I can think of is to reload the page once the make of car is selected which would give me the opportunity to populate the 2nd drop box at that time but that doesn't seem like a good solution. I don't know much in the way of JS but is there a way to do what I need that way? Thanks. Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php