[PHP] Re: [PHP-DB] Date Select
How can I query a MySQL table to get the latest results from a date field? Basically, I am inserting several records at a time at the end of each week. I want to have a page that displays the results for the last week only. The date format in the field is -MM-DD if you want the latest row - select * from table order by max(date_column) limit 1; if you want rows in a range of dates there are lots o ways, and instead of showing one or two, I'd suggest taking a look at the manual on dates http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html, and seeing what fits your needs best. Seems like you may want to look at BETWEEN And if you don't want to use those, you are always free to use select * from table where date_column '-mm-dd' and date_column '-mm-dd' order by date_col desc HTH Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [users@httpd] Re: [PHP] Apache 1.3/PHP
Tom Ray [List] [EMAIL PROTECTED]To: BAO RuiXian [EMAIL PROTECTED], PHP General os.com [EMAIL PROTECTED], [EMAIL PROTECTED] cc: 01/22/2004 05:25 Subject: [EMAIL PROTECTED] Re: [PHP] Apache 1.3/PHP PM Please respond to users As far as AddType goes for PHP this is what I have: IfModule mod_php3.c AddType application/x-httpd-php3 .php3 AddType application/x-httpd-php3-source .php3s /IfModule IfModule mod_php4.c AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps /IfModule AddType application/x-httpd-php3-source .php3s /IfModule IfModule mod_php4.c AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps /IfModule are your AddModule and LoadModule directives uncommented in httpd.conf? your post suggests it but... I added the AddType line outside of that and it's still not working. Thanks for the suggestion, please if you have any others I would love to know. I'm going to need to build a couple more FreeBSD boxes soon, and I want to have those go a little smoother :) Thanks again, Tom -Original Message- From: BAO RuiXian [EMAIL PROTECTED] To: Tom Ray [List] [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED], [EMAIL PROTECTED] Date: Fri, 23 Jan 2004 00:11:42 +0200 Subject: Re: [PHP] Apache 1.3/PHP Tom Ray [List] wrote: [snip]... ?php print Test 123; ? I'm sure I'm missing a line or two in my httpd.conf, but I really don't know what they would be. Anyone with experience with FreeBSD/Apache/PHP give me a hand? Do you have the following line in your httpd.conf: AddType application/x-httpd-php .php Best Bao TIA Tom - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: single quotes in database
You can use addslashes and stripslashes when inserting and selecting respectively. addslashes will turn your name into O\'connel. and stripslashes will bring it back to the displayable format. check out php.net/addslashes php.net/stripslashes hth Jeff Steve Buehler [EMAIL PROTECTED]To: PHP [EMAIL PROTECTED], mysql [EMAIL PROTECTED] cc: 11/07/2003 11:30 Subject: single quotes in database AM I am using PHP/MySQL and am having a problem. We have some names and addresses in the database that have single quotes in them. For instance. There is a town around here called Lee's Summit. Also names like O'connel. When I pull from the database it skips these because of the quotes. I know there is something that I have seen before about this, but can't find it now. Can anybody help me? I really hope this makes since because I am sick today and am having a hard time thinking straight. Is it something that I will have to fix when putting things into the database? I am hoping on being able to fix this when going in and when coming out of the database so that I don't have to go back and redo all the ones that are already in the database. Thanks Steve -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] RE: [PHP] Re: Adding a log file
if you want actual errors that PHP generates and not logic based errors, then writing your own error handling function and calling it with set_error_handler() at the top of your scripts may work for you. in your function you'd just need to use $errorstr, $errorfile and $errline and log it using error_log(). hth jeff Robert Sossomon [EMAIL PROTECTED]To: [EMAIL PROTECTED], [EMAIL PROTECTED] com cc: Subject: [PHP-DB] RE: [PHP] Re: Adding a log file 11/05/2003 11:02 AM Like I said, syntactically bogus, I was trying to write it out fast while I was away from the actual scripts... Like I said, for the MOST part the pieces are working, however on some items it is acting correctly yet the items are not showing up in the shopping cart or in the database anywhere. Here's the script pieces. //addtocart.php $addtocart = insert into store_shoppertrack values('','$_POST[SESSID]','$_POST[sel_item_id]','$_POST[sel_item_qty]', '$_POST[sel_item_price]','$item_desc', now()); mysql_query($addtocart); //redirect to showcart page header(Location: showcart.php); //Additem.php $addtocart = insert into store_shoppertrack values('','$_POST[SESSID]','$_POST[sel_item_name]','$_POST[sel_item_qty] ','$_POST[sel_item_price]','$item_desc', now()); mysql_query($addtocart); //Addspec.php //add info to cart table $addtocart = insert into store_shoppertrack values('','$_POST[SESSID]','$_POST[sel_item_id]','$_POST[sel_item_qty]', '$_POST[sel_item_price]','$_POST[sel_item_desc]', now()); mysql_query($addtocart); //Seestore.php /* The following code allows for the addition of a non-stock item. All information is added automatically to the quoter for the salesman. */ $display_block .= HRInput a new item: form method=post action=\addspec.php\nbsp;nbsp;nbsp;nbsp;Item ID:input type=\text\ name=\sel_item_id\BRDescription:input type=\text\ name=\sel_item_desc\BRQuantity: select name=\sel_item_qty\; $display_block .= option value=\0\0/optionoption value=\1\ selected1/option; for ($i=2; $i 301; $i++){ $display_block .= option value=\$i\$i/option; } $display_block .= /selectinput type=\hidden\ name=\SESSID\ value=\$PHPSESSID\/tdtdinput type=\hidden\ name=\url\ value=\$_SERVER[PHP_SELF]\BRPrice:input type=\text\ name=\sel_item_price\ size=\5\input type=\submit\ name=\submit\ value=\Add to Cart\/form; $display_block .= HR; /* The following code allows for the addition of a stocked item. All information is added automatically to the quoter for the salesman. */ $display_block .= Input item: form method=post action=\additem.php\nbsp;nbsp;nbsp;nbsp;; $display_block .= Item ID:input type=\text\ name=\sel_item_id\BRQuantity: select name=\sel_item_qty\; $display_block .= option value=\0\0/optionoption value=\1\ selected1/option; for ($i=2; $i 301; $i++){ $display_block .= option value=\$i\$i/option; } $display_block .= /select; $display_block .= input type=\hidden\ name=\SESSID\ value=\$PHPSESSID\/tdtd; $display_block .= input type=\hidden\ name=\url\ value=\$_SERVER[PHP_SELF]\BRPrice:; $display_block .= input type=\text\ name=\sel_item_price\ size=\5\; $display_block .= input type=\submit\ name=\submit\ value=\Add to Cart\/form; //categories.php $display_block .= trtdform method=post action=\addtocart.php\nbsp;nbsp;nbsp;nbsp;emstrong$item_name/strong - $item_desc/em/tdtdselect name=\sel_item_qty\; $display_block .= option value=\0\0/optionoption value=\1\ selected1/option; for ($i=2; $i 301; $i++){$display_block .= option value=\$i\$i/option; } $display_block .= /selectinput type=\hidden\ name=\SESSID\ value=\$PHPSESSID\input type=\hidden\ name=\sel_item_id\ value=\$item_id\/tdtdinput type=\hidden\ name=\sel_item_name\ value=\$item_name\input type=\hidden\ name=\sel_item_desc\ value=\$item_desc\input type=\hidden\ name=\url\ value=\$_SERVER[PHP_SELF]?cat_id=$cat_id\input type=\text\ name=\sel_item_price\ size=\5\
[PHP] Re: [PHP-DB] MySQL Insert Select statement
what was the error? dwalker dwalker@healthyproduct To: [EMAIL PROTECTED], 'professional php' splus.com [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] 10/19/2002 08:32 PM cc: Please respond to Subject: Re: [PHP-DB] MySQL Insert Select statement dwalker For some reason the Insert Select statement returned an ERROR and I had to resort to INSERT INTO Products (ProductName,Size,SuggestedRetailPrice,ProductCategory,ManufacturerName) SELECT * FROM kalproduct ; Is there a noticeable reason why: INSERT INTO Products (ProductName,Size,SuggestedRetailPrice,ProductCategory,ManufacturerName) SELECT(kalproduct.Product, kalproduct.size, kalproduct.SRP, kalproduct.Cat, kalproduct.manname) FROM kalproduct ; would have returned an error message?? I don't want to have to create multiple tables for the purpose of inserting into others. -Original Message- From: John W. Holmes [EMAIL PROTECTED] To: 'dwalker' [EMAIL PROTECTED]; 'professional php' [EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Saturday, October 19, 2002 7:24 PM Subject: RE: [PHP-DB] MySQL Insert Select statement That's how you do it. Hopefully you've figured it out already. ---John Holmes. -Original Message- From: dwalker [mailto:dwalker;healthyproductsplus.com] Sent: Saturday, October 19, 2002 7:51 PM To: professional php; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-DB] MySQL Insert Select statement While reading the MySQL manual for INSERT SELECT, I was not able to determine how to include all 5 fields of one table into another table (containing 100 fields) into SPECIFIC data fields. Do I need to explicitly list all the fields within the table of 5 fields? If so, would the statement be: INSERT INTO Products (ProductName,Size,SuggestedRetailPrice,ProductCategory,ManufacturerName) SELECT(kalproduct.Product, kalproduct.size, kalproduct.SRP, kalproduct.Cat, kalproduct.manname) FROM kalproduct ; Thanking you in advance. P.S. I'd give it a try, but I'm trying to move 500 partial records into a table containing at least 2000 records -- didn't want to start from scratch. This email message and all attachments transmitted herewith are trade secret and/or confidential information intended only for the viewing and use of addressee. If the reader of this message is not the intended recipient, you are hereby notified that any review, use, communication, dissemination, distribution or copying of this communication is prohibited. If you have received this communication is error, please notify the sender immediately by telephone or electronic mail, and delete this message and all copies and backups thereof. Thank you for your cooperation. -- PHP Database 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