[PHP-DB] Pulling Date from MySQL then subtract
I am needing some clarification on doing math with dates pulled from MySQL. The date format in the database is YYY-MM-DD and what I want to do is pull the date out, then add/subtract 30 days from the date. I have read through the manual, but for some reason, I'm just not getting it. Any help and/or examples would be greatly appreciated. Jess --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.832 / Virus Database: 566 - Release Date: 1/10/2005 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Pulling Date from MySQL then subtract
you can use date-sub in the sql command (see the mysql manual) or use mktime() function in php bastien From: Jess Hunter [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Pulling Date from MySQL then subtract Date: Sat, 22 Jan 2005 08:37:56 -0600 I am needing some clarification on doing math with dates pulled from MySQL. The date format in the database is YYY-MM-DD and what I want to do is pull the date out, then add/subtract 30 days from the date. I have read through the manual, but for some reason, I'm just not getting it. Any help and/or examples would be greatly appreciated. Jess --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.832 / Virus Database: 566 - Release Date: 1/10/2005 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Pulling Date from MySQL then subtract
Jess Hunter wrote: I am needing some clarification on doing math with dates pulled from MySQL. The date format in the database is YYY-MM-DD and what I want to do is pull the date out, then add/subtract 30 days from the date. SELECT yourdatecolumn - INTERVAL 30 DAY FROM yourtable WHERE ... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] What is wrong with this query?
Hi there everyone, Im trying to select data from 3 tables, Im using the following code: SELECT * FROM MLS, Cond, Comm ORDER BY Price DESC LIMIT 0, 50 But its not working, I thought this is how it worked but I guess Im wrong. Its just a basic query, but needs to pull all the info from all 3 tables in the same DB, what am I doing wrong? It works perfectly if I just use 1 table. Chris -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.2 - Release Date: 1/21/2005
[PHP-DB] Is this possible?
Hi, Is it security safe and possible to use my server to query another server, outside the local zone, and make updates to another server using a PHP page from my server? I'm just wondering. So in other words I'd have a DB setup to hold users domains, db names, db usernames, db passwords etc on mine and run PHP code query their own on their server. I wanna do this to run a program I am working on and wanna keep the code on my server rather than handing it out to people to freely use. Again the question is, is it security safe and possible. :) J Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Is this possible?
Hi, Is it security safe and possible to use my server to query another server, outside the local zone, and make updates to another server using a PHP page from my server? I'm just wondering. So in other words I'd have a DB setup to hold users domains, db names, db usernames, db passwords etc on mine and run PHP code query their own on their server. I wanna do this to run a program I am working on and wanna keep the code on my server rather than handing it out to people to freely use. Again the question is, is it security safe and possible. :) J Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Auto Responses?
Why do people set auto responses on a mailing list like this? It's crazy, imagine all the auto replies this list would generate. As if I care if a user is not able to reply because they have gone on holidays or something. If they don't reply obviously they are not around or can't answer or don't want to. That's fine, but I don't care if your away but I do care a stupid auto response is setup. It's worse than general spam!!! J Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] What is wrong with this query?
What exactly are you trying to do? If you require data from each table and that data is linked somehow thur some common field (not required to be the same field across all three tables) you need to include that SELECT a.*, b.*,c.* FROM MLS a, Cond b, Comm c where [join crtieria] and [search crtieria] ORDER BY Price DESC LIMIT 0, 50 need more info about structure and goal bastien From: Chris Payne [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] What is wrong with this query? Date: Sat, 22 Jan 2005 23:44:29 -0500 Hi there everyone, Im trying to select data from 3 tables, Im using the following code: SELECT * FROM MLS, Cond, Comm ORDER BY Price DESC LIMIT 0, 50 But its not working, I thought this is how it worked but I guess Im wrong. Its just a basic query, but needs to pull all the info from all 3 tables in the same DB, what am I doing wrong? It works perfectly if I just use 1 table. Chris -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.2 - Release Date: 1/21/2005 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] What is wrong with this query?
Hi there, Basically I just need to pull ALL the data from ALL the tables listed in the same query. It doesn't matter in what order the data is displayed and there is no relation between the tables. Chris What exactly are you trying to do? If you require data from each table and that data is linked somehow thur some common field (not required to be the same field across all three tables) you need to include that SELECT a.*, b.*,c.* FROM MLS a, Cond b, Comm c where [join crtieria] and [search crtieria] ORDER BY Price DESC LIMIT 0, 50 need more info about structure and goal bastien From: Chris Payne [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] What is wrong with this query? Date: Sat, 22 Jan 2005 23:44:29 -0500 Hi there everyone, Im trying to select data from 3 tables, Im using the following code: SELECT * FROM MLS, Cond, Comm ORDER BY Price DESC LIMIT 0, 50 But its not working, I thought this is how it worked but I guess Im wrong. Its just a basic query, but needs to pull all the info from all 3 tables in the same DB, what am I doing wrong? It works perfectly if I just use 1 table. Chris -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.2 - Release Date: 1/21/2005 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.2 - Release Date: 1/21/2005 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.2 - Release Date: 1/21/2005 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] GROUP BY? Urgent help needed with selection list
Hi there everyone, Im using the following code to populate cities from a huge database: select name=fm_city[] id=fm_city[] multiple option value=0Show All/option ? $sqla = SELECT DISTINCT(Area) FROM MLS_Listings ORDER BY Area; $sql_resulta = mysql_query($sqla,$connection) or die(Couldn't execute query.); while ($row = mysql_fetch_array($sql_resulta)) { $Area = $row[Area]; ? option value=?=$Area? ?=$Area? /option ? }; ? /select This works great, no problems BUT the client now needs is so the cities are grouped, but its not so simple. For example, say you have Akron, Akron Central etc . They need them so that ALL Akrons appear together, the problem is, that also includes some which are SE Akron etc . So, of course that appears further down the list under S. How can I group this way? I am pretty lost on this. Any help would REALLY be appreciated. Chris -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.2 - Release Date: 1/21/2005
[PHP-DB] Random Number generating and adding it to he database..
Hi all! I wanted to know the best Random Function for PHP.. But please I don't want duplications to happen at the same second.. because I receive many customers.. And also how can I add [EMAIL PROTECTED], whic abc is a variable... and localhost.com is a static text?? So I only request from the user to enter the abc only and it will automatically be : [EMAIL PROTECTED] Thanks! Radwan Aladdin
Re: [PHP-DB] GROUP BY? Urgent help needed with selection list
Well, first of all.. your subject line mentions GROUP BY which is a database function for telling the query what to use when performing aggregate functions like sum, count, average, etc type functions. That's really not what you're looking at doing here it sounds like. Sounds like you just want similar items alphebetized together while still keeping a 'region' like 'SE Akron' to display. Probably the best thing you can do is have a City and have a Region. City would be the major city that the region is near, like Akron and the Region (or whatever you want to call it) would be the area of the city that the data represents. Then just do an ORDER BY on your City instead of Region. you never have to display the City if you don't want to. But without having a giant cross reference database (that can't ever be complete) that can do the lookup of SE Akron and know that's actually Akron and not some suburb of Chicago or something, then you're going to have to tell it yourself. I think this is the best solution for you. Best of luck! -TG = = = Original message = = = Hi there everyone, I~m using the following code to populate cities from a huge database: select name=fm_city[] id=fm_city[] multiple option value=0Show All/option ? $sqla = SELECT DISTINCT(Area) FROM MLS_Listings ORDER BY Area; $sql_resulta = mysql_query($sqla,$connection) or die(Couldn't execute query.); while ($row = mysql_fetch_array($sql_resulta)) $Area = $row[Area]; ? option value=?=$Area? ?=$Area? /option ? ; ? /select This works great, no problems BUT the client now needs is so the cities are grouped, but it~s not so simple. For example, say you have Akron, Akron Central etc ~. They need them so that ALL Akrons appear together, the problem is, that also includes some which are SE Akron etc ~. So, of course that appears further down the list under S. How can I group this way? I am pretty lost on this. Any help would REALLY be appreciated. Chris -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.2 - Release Date: 1/21/2005 ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php