Re: [PHP] Pulling two field from mysql table into an array
How 'bout ? $query = SELECT field_name, user_id FROM table; $result = mysql_query($query); while($line = mysql_fetch_assoc($result) { $array[$line[user_id]] = $line[field_name]; } ? - Original Message - From: Richard Kurth [EMAIL PROTECTED] To: Richard Kurth [EMAIL PROTECTED] Sent: Monday, February 02, 2004 7:00 AM Subject: [PHP] Pulling two field from mysql table into an array What is the best way to pull two fields from a mysql database and add the two fields to an array for each record in the table field_name user_id I need it so iI can access the array with $key and $value -- 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] read file only half the file loads ...
loadimage.php has the following code in it. ?php $myimage=d:/website/images/no_access_php.jpg; // above is the file and the location is verified. header(Content-type: image/jpeg); readfile($myimage) ; ? Only half the image is shown ... it stops loading the image or the image wont' load at all. Any Ideas what the problem could be? --- Philip J. Newman Master Developer PhilipNZ.com [NZ] Ltd. [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and XML.
Rolf Brusletto wrote: The only thing I can think of is apache/you_webserver_here is limiting the amount of memory.. still an odd problem though, depending on the size of the xml.. The XML is tiny, 12 lines. I got round the problem by chopping up someone elses PHP XML parser script, so that it wasn`t using expat. Wich I had time to look into all of these little things :-) -- Mark Ackroyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: read file only half the file loads ...
The server or the connection seems to be the problem.. :s -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com Philip J. Newman [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] loadimage.php has the following code in it. ?php $myimage=d:/website/images/no_access_php.jpg; // above is the file and the location is verified. header(Content-type: image/jpeg); readfile($myimage) ; ? Only half the image is shown ... it stops loading the image or the image wont' load at all. Any Ideas what the problem could be? --- Philip J. Newman Master Developer PhilipNZ.com [NZ] Ltd. [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested PHP
you can also do stuff like this... ?php if ($someVar == true) { ? html titlesomeVar appears to be true/title ?php } else { ? html titlesomeVar appears to be false/title ?php } ? Thanks, Jon jon bennett | [EMAIL PROTECTED] new media creative _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ J b e n . n e t 91 Gloucester Rd, Trowbridge, Wilts, BA14 0AD t: +44 (0) 1225 341039 w: http://www.jben.net/ iChat (AIM): jbendotnet On 1 Feb 2004, at 16:44, John Nichel wrote: Russell Shaw wrote: Hi, I have php code embedded in html, that is read by apache. Is nested php code allowable such as: ? $phpcode=? echo \ some html \ ?; ? ... html ... body ? echo $phpcode ? /body /html Yes. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- 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] Print page with default margins
Hi, I'm using Apache/PHP/MySQL in my business project My big problem now is: How can I print a page on a standard page format, like Letter, left margin: 0.25 inch, etc.) When I print, I must every time set page margin manually, and I want this being made by php or javascript automatically on load page I appreciate much any suggestion or ideaa or links to examples similars or documentation can help me. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Print page with default margins
Narcis Florea wrote: Hi, Hello, I'm using Apache/PHP/MySQL in my business project Thank you for using php! My big problem now is: How can I print a page on a standard page format, like Letter, left margin: 0.25 inch, etc.) When I print, I must every time set page margin manually, and I want this being made by php or javascript automatically on load page Unfortunately, this is not php question. Try another list, likely css. I can help you only with this: style type=text/css media=screen !-- @import url(screen.css); //-- /style style type=text/css media=print !-- @import url(print.css); //-- /style -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php header information
HI all I have a page that has been written by someone else and when I run it and click on a button to valid the username and password to login it sends me back the same page with the following: Warning: Cannot modify header information - headers already sent by (output started at c:\program files\apache group\apache\htdocs\zero\db_class.inc:1) in c:\program files\apache group\apache\htdocs\zero\login.php on line 26 on line 26 I have the following info: header(Location: clientmenu.php?.SID); Is the problem session related? or what would cause the above header? thanx in advanec Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 2 Feb 2004 13:50:31 -0000 Issue 2566
php-general Digest 2 Feb 2004 13:50:31 - Issue 2566 Topics (messages 176539 through 176570): Re: php version difference - local installation very strict 176539 by: DvDmanDT 176543 by: Jason Wong Re: Nested PHP 176540 by: Russell Shaw 176567 by: Jon Bennett Re: stristr 176541 by: Russell Shaw Re: PHP, Windows 2000/IIS MySQL 176542 by: Russell Shaw Re: VERY URGENT. 176544 by: Jason Wong Pulling unique data from database 176545 by: Richard Kurth 176547 by: Jason Wong 176548 by: Raditha Dissanayake 176549 by: Jonathan Rosenberg 176551 by: Adam Bregenzer Help with files 176546 by: Mr. Austin 176550 by: Jason Wong 176552 by: Mr. Austin 176554 by: John Nichel 176555 by: John Nichel 176556 by: Martin Towell Re: comparing dates 176553 by: Ryan A Re: Sessions not working. 176557 by: The.Rock search.php 176558 by: John Taylor-Johnston 176559 by: Jason Wong 176561 by: Raditha Dissanayake 176562 by: John Taylor-Johnston Pulling two field from mysql table into an array 176560 by: Richard Kurth 176563 by: Toby Irmer read file only half the file loads ... 176564 by: Philip J. Newman 176566 by: DvDmanDT Re: PHP and XML. 176565 by: Mark Ackroyd Print page with default margins 176568 by: Narcis Florea 176569 by: Marek Kilimajer php header information 176570 by: Angelo Zanetti Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Once on every page... I include one file once, on each page, and in that one I have session_start()... -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com Phillip Jackson [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] That's great advice... the only questions i have then: I only need to call session_start ONCE in my entire application per instance of a session? when i published the application months ago to my production server i had errors on every page notifying me that a session had not been started so i could not call $_SESSION... ~pj Justin French [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Monday, February 2, 2004, at 10:14 AM, Phillip Jackson wrote: these errors are foreign to me as i have combed my code 100's of times before i deployed my app online 3 months ago. do i NEED this newer,stricter version or can i install a deprecated one? It's not newer and stricter, and it's not Apache -- it's PHP error notices set to a higher level that your production server. This is really around the wrong way -- your local (dev) server should be set to a high level of warning (mine's set to the highest) to encourage good programming practices, and should be set to none on the production (live) server to keep error messages out of the user experience. The long answer is to fix your application, and hunt down all these notices/warnings, so that your application is of better quality. The short answer is to set the error reporting on the live server to a lower level, so that these messages are suppressed. You can do this either with ini_set()[1] or error_reporting()[2] at the top of every script (or in a header include for example), or at an application level with a .htaccess file in root directory. A sample of a .htaccess file would be: IfModule mod_php4.c php_flag register_globals off php_flag magic_quotes_runtime off php_flag magic_quotes_gpc on php_value url_rewriter.tags 'a=href' php_value error_reporting 'E_ALL ~E_NOTICE' /IfModule I'm not 100% sure the last line is correct, because I'v always done it with ini_set() in my PHP application. [1] http://www.php.net/ini_set [2] http://www.php.net/error-reporting I would encourage you to fix your code as well as apply error reporting levels for both the production and live servers. Good luck, Justin French ---End Message--- ---BeginMessage--- On Monday 02 February 2004 08:03, Phillip Jackson wrote: i don't use register_globals - i have a function that massages data that mimics register globals' behaivior via dynamically named variables. which one should i set it to - E_NOTICE? error_reporting = E_ALL display_errors = Off log_errors = On error_log = /path/to/php.log -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general
Re: [PHP] Can't delete cookies
Are you sure that the cookie is not unset? You might have an old cookie with / as its path that you see now. Andrew Wood wrote: Can anyone fathom out why I can't get the setcookie function to delete a cookie? I'm calling it with the same arguments as I used to set it originally, but with a null string value an expiry time in the past but the cookie persistently remains in the browser. This how I set it: setcookie (hhubpassword, md5($newpassword) , time() + 1209600, /xchange/); And this is how I'm trying to delete it: setcookie (hhubpassword, , time() -3600, /xchange/); Thanks Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php header information
On Monday 02 February 2004 08:57 am, Angelo Zanetti wrote: HI all I have a page that has been written by someone else and when I run it and click on a button to valid the username and password to login it sends me back the same page with the following: Warning: Cannot modify header information - headers already sent by (output started at c:\program files\apache group\apache\htdocs\zero\db_class.inc:1) in c:\program files\apache group\apache\htdocs\zero\login.php on line 26 Check db_class.inc, it is probably got a space or something in it and that is enough to cause this problem. You cannot send anything at all before you use the header() function. James Hicks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] finding news stories in a selection of months
Hi everyone, I have made written some code (really bad code,I'm sure), that finds the earliest month that has a news story, and the latest month that has a news story. the code is below. I now need to loop through somehow, to build an array, that gives me the month (JAN,FEB,MAR) and the year it belongs to, along with the number of news stories each month has. I'm a bit stuck as i'm really new to this stuff, thanks for any help, you guys can give, heres the code i have: $strSQL = SELECT date from .$tbl_prefix.news where live=1 order by date asc limit 0,1; $result = mysql_query($strSQL,$dbconn); $firstresult = mysql_fetch_array($result); $firstdate = $firstresult['date']; $firstmonth = substr($firstdate, 4, 6); $firstyear = substr($firstdate, 0, 4); $strSQL = SELECT date from .$tbl_prefix.news where live=1 order by date desc limit 0,1; $result = mysql_query($strSQL,$dbconn); $lastresult = mysql_fetch_array($result); $lastdate = $lastresult['date']; $lastmonth = substr($lastdate, 4, 6); $lastyear = substr($lastdate, 0, 4); Michael Hill Senior Developer Holler 02076891942 www.holler.co.uk This message is confidential, you may use and apply the information only for the intended purpose. Internet communications are not secure and therefore Holler does not accept legal responsibility for the contents of this message. Any views or opinions expressed are solely those of the author and may not represent those of Holler. If you are not the intended recipient, any disclosure, copying, distribution or use of it, or any part of it, in any form whatsoever, and any actions taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.
Re: [PHP] finding news stories in a selection of months
Michael, Let the database do the work. Check your MySQL docs (assuming you are using MySQL, otherwise check what you have ) for the month() function. Use this in your SELECT, aliasing it so that you do not use the term month, say pub_month. Your SQL would then look like this $strSQL = SELECT date, MONTH(date) as pub_month from .$tbl_prefix.news where live=1 order by date asc limit 0,1; (You can do the same thing with the YEAR() function) Next step is to GROUP your results by the month ... $strSQL = SELECT date, month(date) as pub_month from .$tbl_prefix.news where live=1 GROUP BY pub_month order by date asc limit 0,1; As an aside, why are you limiting results to one record with limit 0,1? For testing, why don't you drop that? Also, while testing, echo your $strSQL so see what it looks like. I KNOW we always write correct code every time and don't need to bother with such an elementary step. Yet doing this seems to save a lot of time g. If you can, rename your date column to pub_date; date is a reserved word for many database systems or a function name in many languages. Good to avoid it and then you don't have to always enclose it in quotes, or square brackets, etc. Hope this is helpful - Miles At 03:10 PM 2/2/2004 +, Michael Hill wrote: Hi everyone, I have made written some code (really bad code,I'm sure), that finds the earliest month that has a news story, and the latest month that has a news story. the code is below. I now need to loop through somehow, to build an array, that gives me the month (JAN,FEB,MAR) and the year it belongs to, along with the number of news stories each month has. I'm a bit stuck as i'm really new to this stuff, thanks for any help, you guys can give, heres the code i have: $strSQL = SELECT date from .$tbl_prefix.news where live=1 order by date asc limit 0,1; $result = mysql_query($strSQL,$dbconn); $firstresult = mysql_fetch_array($result); $firstdate = $firstresult['date']; $firstmonth = substr($firstdate, 4, 6); $firstyear = substr($firstdate, 0, 4); $strSQL = SELECT date from .$tbl_prefix.news where live=1 order by date desc limit 0,1; $result = mysql_query($strSQL,$dbconn); $lastresult = mysql_fetch_array($result); $lastdate = $lastresult['date']; $lastmonth = substr($lastdate, 4, 6); $lastyear = substr($lastdate, 0, 4); Michael Hill Senior Developer Holler 02076891942 www.holler.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't delete cookies
Please, reply to the whole list, you will have a better chance you will get the right answer. Andrew Wood wrote: No because even if I manually delete all the cookies in the browser from my domain, then reload the page to set them again, then run the PHP code to delete them they're still there. The interesting thing is, the expiry time isn't being altered at all Another thing that comes to my mind: do you have the computer clocks (both client and server) correct? and timezones? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: OOP methodology
Thanks - very useful way of looking at things. I think I'll opt for applying this principle to the way I plan to improve my system. Currently far too bulky. Of course, now the project has progresse, finding time to refactor and effectively build most of it from scratch, is quite hard. Cheers Chris -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: 30 January 2004 17:19 To: [EMAIL PROTECTED] Subject: [PHP] Re: OOP methodology Wow, that's a lot of stuff in one class. Personally, I've started using the MVC (Model, View, Controller) architecture. Basically what it does is seperates Data logic from Display logic and Control logic. Here's how I've been using it. Model: Holds and deals with all data for the program, such as database connections / queries, session data, data consistency. I am currently using classes which use PEAR DB_DataObject for DB connections, querying, and data storage. View: Deals with displaying of data from model. ONLY does displaying, no processing. Very minimal logic only associated with outputting. Currently, I am using Smarty entirely for the view. Little no no PHP code, only Smarty. The View in this case is just a smarty template file. Controller: Handles requests from the browser. Instantiates Model and View, calls functions in Model to alter its state (updating from $_REQUEST vars, for instance). Chooses a view and then tells the view to display. For me, this is all home-grown PHP. This architecture can be much more complicated in, say, a C++ program, but the Server/Client pattern built into web programs makes it much more simple. The reason that I use this particular architecture is that it factors all of the pieces of your program very nicely. Later, if you do things right, you can use a single screen from one program in another with minimal editing. Here's a few pages that discuss MVC: http://ootips.org/mvc-pattern.html http://st-www.cs.uiuc.edu/users/smarch/st-docs/mvc.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If you are not the intended recipient of this e-mail, please preserve the confidentiality of it and advise the sender immediately of any error in transmission. Any disclosure, copying, distribution or action taken, or omitted to be taken, by an unauthorised recipient in reliance upon the contents of this e-mail is prohibited. Somerfield cannot accept liability for any damage which you may sustain as a result of software viruses so please carry out your own virus checks before opening an attachment. In replying to this e-mail you are granting the right for that reply to be forwarded to any other individual within the business and also to be read by others. Any views expressed by an individual within this message do not necessarily reflect the views of Somerfield. Somerfield reserves the right to intercept, monitor and record communications for lawful business purposes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Zlib Compression || Implementation || Bandwidth Savings?
Hey all. Having a good problem -- our hockey report site has jumped from 10 gigs/month to 30+ gigs/month growing. We're getting killed in bandwidth fees at the moment; barring switching to another host, will utilizing ZLIB compression significantly reduce bandwidth? Also, in terms of ZLIB settings, I've ini_set() zlib compression to ON. Additionally, do I need to ob_start() ( flush) page output? I am uncertain how to implement the following: example.php ? session_start(); ini_set(zlib.output_compression,ON); ini_set(zlib.output_compression_level,4); ob_start(); $page_contents = fopen(** read file contents to variable **); ob_end_flush(); ? Thanks for any advice, --Noah -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How check credit card or magnetic card number.
Hi, how i can check credit card or magnetic card number for a site of electronic commerce that i have to design. Sorry for my english. Pedro. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Flash interface to CLI PHP Script vs GTK
I'm sure people have had wilder ideas, but this is what I'm trying to do. I'm disappointed by the lack of clear documentation and examples for GTK and the strange way the package insists on using its own binary php.exe (for win32) instead of being just a simple extension. And I've yet to find a way to put 2 buttons on the new window. I tried this 6 months ago, can't remember the detail but remember thinking at the time, stuff this! Never again etc. The documentation wasn't clear to me, so I'm not sure what I've said is strictly true. I've written an application which iterates through a database, performing various functions along the way, and at each step there are about 20 variables which I'd like to see. These are output to the console at such speed that it's hard to see what's going on unless it crashes and you can look at the error log. I'd like to have a basic GUI for outputting this information and it occurred to me that I could use PHP's COM functionality to create a Shockwave Flash object (as I have done in Excel VBA for example) and then pass data from PHP, through to the custom fields in a custom made flash object. My application runs in the CLI version of PHP 5. I've tried to instantiate the flash object, but it doesn't recognise the term Shockwave Flash Object when I try to create it. Am I just trying to create the object using the wrong object name? Or is this because it's a plugin? And if so, how come it works when I created a test in Excel VBA (where I managed to interact with a flash object from within a VBA script). My only other option is to create a Internet Explorer object, load a document with an embedded flash object and then reference it from there, but that sounds even more 'cowboy-coder' to me. My thinking is that if it's easy to talk to a flash object (and I believe it's possible for a COM object to talk back to PHP) then it strikes me that a flash file would be an improved interface to PHP than GTK - it looks nicer for starters, smooth fonts and animation not as hard to implement. Failing this, I'm considering writing a PHP script with socket support which can talk to a Flash object in a client-server manner. Anyone got any thoughts on this? Thanks Chris If you are not the intended recipient of this e-mail, please preserve the confidentiality of it and advise the sender immediately of any error in transmission. Any disclosure, copying, distribution or action taken, or omitted to be taken, by an unauthorised recipient in reliance upon the contents of this e-mail is prohibited. Somerfield cannot accept liability for any damage which you may sustain as a result of software viruses so please carry out your own virus checks before opening an attachment. In replying to this e-mail you are granting the right for that reply to be forwarded to any other individual within the business and also to be read by others. Any views expressed by an individual within this message do not necessarily reflect the views of Somerfield. Somerfield reserves the right to intercept, monitor and record communications for lawful business purposes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Str_Replace Command
I have never had this problem before and it is probably something simple... Please take a look at the two foreach statements. I am at a loss as to why the second line does not actually remove the quotes. The first foreach statement does so how are they different. $StockURL = http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,dankyf=sl1e=.txt;; $StockResults = implode('', file($StockURL)); $Rows = split(\n, $StockResults); foreach($Rows as $Row) { echo str_replace('',,$Row).br\n; } foreach($Rows as $Row) { str_replace('',,$Row); echo $Row.br\n; } Eventually, I need to break apart the $Row into two elements $Symbol and $Price and then into a two dimensional array. I have done this with the code below, but so far, I can not get rid of the quotes. foreach($Rows as $Row){ list($Symbol, $Price) = split(\n, $Row); $TickerData=array($Symbol=$Price); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] The PHP Problem
I was in the same shoes a few years ago and used this. http://www.net-language.com/workshops/Default.asp?workshop=21 It's a good guide, shows you how to set up a web server, php and mysql on your own PC (win32). As it's for a slightly older version of PHP some parts of the guide don't no longer hold true, but for the most part you shouldn't have any problems; you should have it all up and running in a few hours. You'll have an ideal test system to start trying out your code, and should learn a bit about how to administrate MySQL databases and Apache web servers in the process. Hope that helps. Chris ps. Recommend you write notes for yourself as you install and setup. eg. you'll probably only have to do one or two MySQL grant statements to get it running, which if your like me you'll forget as soon as it works. Every time I install it I waste 2 hours trawling through manuals trying to get the syntax right, promising myself Next Time I'll Take Notes. I never do. -Original Message- From: Ash [mailto:[EMAIL PROTECTED] Sent: 30 January 2004 18:52 To: [EMAIL PROTECTED] Subject: [PHP] The PHP Problem Hi, I am totally new to PHP and dont know a thing. I tried looking through the articles but they were of no use. My Question is: How can I just write php in a text editor, save it as a .php, and view it in internet explorer, offline? I have tried everything and it just wont work. I tried the code: ?php echo Hi, I'm a PHP script!; ? in a .php file and nothing happened. Nothing will work, help! I dont have a website, I just want to write and use the code. Tnaks from Ashley Williams -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If you are not the intended recipient of this e-mail, please preserve the confidentiality of it and advise the sender immediately of any error in transmission. Any disclosure, copying, distribution or action taken, or omitted to be taken, by an unauthorised recipient in reliance upon the contents of this e-mail is prohibited. Somerfield cannot accept liability for any damage which you may sustain as a result of software viruses so please carry out your own virus checks before opening an attachment. In replying to this e-mail you are granting the right for that reply to be forwarded to any other individual within the business and also to be read by others. Any views expressed by an individual within this message do not necessarily reflect the views of Somerfield. Somerfield reserves the right to intercept, monitor and record communications for lawful business purposes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Str_Replace Command
On Tuesday 03 February 2004 00:14, Christopher J. Crane wrote: $StockURL = http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,dankyf=sl1e=.txt;; $StockResults = implode('', file($StockURL)); $Rows = split(\n, $StockResults); foreach($Rows as $Row) { echo str_replace('',,$Row).br\n; } foreach($Rows as $Row) { str_replace('',,$Row); echo $Row.br\n; } str_replace() RETURNS the replaced string. It does not alter $Row. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Spiritual leadership should remain spiritual leadership and the temporal power should not become too important in any church. - Eleanor Roosevelt */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Str_Replace Command
Ok I got around it by the following, but now I have a new problem. I can not get the two dimensional array working. I want to later be able to output a variable like this $TickerData[IKN] and it will output the associated $Price. $StockURL = http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,dankyf=sl1e=.txt;; $StockResults = implode('', file($StockURL)); $Rows = split(\n, $StockResults); foreach($Rows as $Row) { list($Symbol, $Price) = split(,, $Row); $Symbol = str_replace('', , $Symbol); $TickerData = array($Symbol=$Ticker); } print_r($TickerData); echo $TickerData[IKN].br\n; Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tuesday 03 February 2004 00:14, Christopher J. Crane wrote: $StockURL = http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,dankyf=sl1e=.txt;; $StockResults = implode('', file($StockURL)); $Rows = split(\n, $StockResults); foreach($Rows as $Row) { echo str_replace('',,$Row).br\n; } foreach($Rows as $Row) { str_replace('',,$Row); echo $Row.br\n; } str_replace() RETURNS the replaced string. It does not alter $Row. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Spiritual leadership should remain spiritual leadership and the temporal power should not become too important in any church. - Eleanor Roosevelt */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Str_Replace Command
On Tuesday 03 February 2004 00:52, Christopher J. Crane wrote: Ok I got around it by the following, but now I have a new problem. I can not get the two dimensional array working. I want to later be able to output a variable like this $TickerData[IKN] and it will output the associated $Price. print_r($TickerData); So what does the above show? If it isn't what you expect, figure out *why*. Like how is $TickerData being assigned. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* We have phasers, I vote we blast 'em! -- Bailey, The Corbomite Maneuver, stardate 1514.2 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Str_Replace Command
Well this is it and it is really got me... Echoing out the $Symbol and $Price works just fine one row about the $TickerData array assignment. Yet it outputs nothing. Array ( [] = ) is what I get. If I change the line to $TickerData = array ($Symbol = $Price); I get nothing, or the same result. If I change the line to $TickerData = array ('$Symbo'l = '$Price'); I get the following Array ( [$Symbol] = $Price ) which tells me the assignment works, but it seems like the $Symbol and $Price variable are blank when assigning to the array. I know that they are not blank since they echoed out just fine one line above.GRR $StockURL = http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,dankyf=sl1e=.txt;; $StockResults = implode('', file($StockURL)); $Rows = split(\n, $StockResults); foreach($Rows as $Row) { list($Symbol, $Price) = split(,, $Row); $Symbol = str_replace('', , $Symbol); echo $Symbol. - .$Price.br\n; $TickerData = array ($Symbol = $Price); } print_r($TickerData); Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tuesday 03 February 2004 00:52, Christopher J. Crane wrote: Ok I got around it by the following, but now I have a new problem. I can not get the two dimensional array working. I want to later be able to output a variable like this $TickerData[IKN] and it will output the associated $Price. print_r($TickerData); So what does the above show? If it isn't what you expect, figure out *why*. Like how is $TickerData being assigned. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* We have phasers, I vote we blast 'em! -- Bailey, The Corbomite Maneuver, stardate 1514.2 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Str_Replace Command
On Tuesday 03 February 2004 01:09, Christopher J. Crane wrote: Well this is it and it is really got me... Echoing out the $Symbol and $Price works just fine one row about the $TickerData array assignment. Yet it outputs nothing. Array ( [] = ) is what I get. If I change the line to $TickerData = array ($Symbol = $Price); I get nothing, or the same result. If I change the line to $TickerData = array ('$Symbo'l = '$Price'); I get the following Array ( [$Symbol] = $Price ) which tells me the assignment works, but it seems like the $Symbol and $Price variable are blank when assigning to the array. I know that they are not blank since they echoed out just fine one line above.GRR Are you sure that the line: echo $Symbol ... is displaying something sensible for each $Row? You're overwriting $TickerData at each iteration of the foreach-loop thus if your last $Row doesn't contain something sensible neither would $TickerData. You probably want to use this assignment instead: $TickerData[$Symbol] = $Price; -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* TANSTAAFL */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Str_Replace Command
snip $StockURL = http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,dankyf=sl1e=.txt;; $StockResults = implode('', file($StockURL)); $Rows = split(\n, $StockResults); foreach($Rows as $Row) { list($Symbol, $Price) = split(,, $Row); $Symbol = str_replace('', , $Symbol); echo $Symbol. - .$Price.br\n; $TickerData = array ($Symbol = $Price); } print_r($TickerData); /snip why not replace: $TickerData = array ($Symbol = $Price); that line reassigns $TickerData to a array with one element in it everytime you call it. The last time through your loop, $Symbol = '' and $Price = '', so you get Array ( [] = ) when you print_r with this: $TickerData[$Symbol] = $Price; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Directory Browse Concept
Well, I'm installing post-nuke to see what that can do. I'm not sure I like the blog look that most sites have but I guess it has a lot of options. Probably more practical to just learn enough php to hack existing code to suit my needs. I had hoped to build something simpler myself which doesn't need to be so complicated and looks exactly how I want it to... maybe still possible... we shall see. Paul Furman wrote: I'm beginning to learn PHP to rebuild my web site in such a way that I can update it more easily (...and add some other dynamic features ...and utilize a database). I like the idea of a simple directory structure and it's a sensible way to organize my various projects and topics. So what I want is to place some simple text/htm files and jpegs in nested folders and have PHP read them onto a template page with header, footer dynamic folder navigation. Sort of a hybrid between a threaded discussion group and a photo album generator. I'm not sure if It's wise to follow the folder structure literally. 'Gallery' is a php photo album program http://gallery.menalto.com that simulates nested folders with a flat-file pseudo-database. Probably they had reasons for not using actual nested folders? Another reason not to use actual nested folders is that I will probably want to have alternative views of the same pictures/pages. I'm a gardener so I've got a database of plant descriptions sorted by family/genus/species but I also have photo shoots in folders sorted by location/date. Then I want to be able to set up pages for my clients where I pull out a selection of plants from my list and show them particular pictures from my photo collection... so this kind of thing is strictly relational database. I like the nested folders because of my photo collection, there are many 'seconds' unedited originals, etc I keep all those under location/date folders and need to go back sometimes. Once it becomes a database the folder structure is superfluous baggage. So, if I take the folder route, I guess I'd just nest things under my public_html and the url would reflect the current location within the folders. But the way I'm being taught to set up a PHP site in class is to use a single index.php at the root hide everything else outside of public_html. In this case I would have to create a global variable or SCREEN vars in the url with ?SCREEN to keep track of where the visitor is located. It would look so much nicer to have nested folder names in the url, even if they got long, I like the clear unmistakable logic of that. www.edgehill.net/plants/poacea/festuca/californica better than www.edgehill.net?FOLDER=plants/poacea/festuca/californica But to get the first option, I would then have to somehow set the template. 'Gallery' urls always look like one folder deep with some other optional settings sometimes: www.edgehill.net/gallery/festuca-californica (even if that folder is nested under: plants/poacea/festuca/festuca-californica) Each flat folder contains pictures and a data file with fields for various settings. I don't know how PHP knows to take all this to the 'Gallery' template. Somehow they say anything under that gallery folder should be presented through the gallery templates??? Thanks for any thoughts if you made it this far g. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reliable remote IPs in SSL?
Hi folks, I'm trying to do session-tracking with a get variable as securely as possible. Obviously, this is an inherently insecure technique, but I am trying to mitigate the risks. I see in a paper by the MIT Lab for Computer Science that Yahoo say they use the remote address for session tracking within the SSL. Yahoo claim that with HTTPS the IP address does not jump around the way it does with HTTP proxies, and it can be used reliably for tracking. Ref: http://cookies.lcs.mit.edu/pubs.html With Yahoo behind the claim it's tempting to belive it, but somehow it seems too good to be true. I don't have access to any big logs right now to check this out. Does anyone have experience with this? -- Geoff Caplan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Str_Replace Command
Matt: This worked perfect. Thank you. I didn't realize it was reassigning, I thought it would work similar to array_push and add to the existing data. I get it now, thanks to you. Thanks again. I had been so frustrated I was losing my objectivity. Christopher J. Crane Network Manager - Infrastructure Services IKON Document Efficiency at Work -Original Message- From: Matt Matijevich [mailto:[EMAIL PROTECTED] Sent: Monday, February 02, 2004 12:25 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Str_Replace Command snip $StockURL = http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,dankyf=sl1e=.txt;; $StockResults = implode('', file($StockURL)); $Rows = split(\n, $StockResults); foreach($Rows as $Row) { list($Symbol, $Price) = split(,, $Row); $Symbol = str_replace('', , $Symbol); echo $Symbol. - .$Price.br\n; $TickerData = array ($Symbol = $Price); } print_r($TickerData); /snip why not replace: $TickerData = array ($Symbol = $Price); that line reassigns $TickerData to a array with one element in it everytime you call it. The last time through your loop, $Symbol = '' and $Price = '', so you get Array ( [] = ) when you print_r with this: $TickerData[$Symbol] = $Price; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How check credit card or magnetic card number.
Pedro wrote: Hi, how i can check credit card or magnetic card number for a site of electronic commerce that i have to design. Sorry for my english. Pedro. ?php //Check credit card date on HTML form if(empty($_POST['cc']) || (empty($_POST['ccd'])) { echo Credit card and date fields not submitted.; } else { //Check formats for various card types date if(eregi(^4[0-9]{16}$,$_POST['cc'])) || eregi(^[0-9]{2}/+[0-9]{2}$,$_POST['ccd'])) { echo You card is a Visa Card; if(eregi(^5[0-9]{16}$,$_POST['cc'])) || eregi(^[0-9{2}/+[0-9]{2})) { echo Your card is a Mastercard; } ? You get the idea, you may to need to Google around for the various credit card types and how the need them to be formatted, and my regular expressions may need to be adjusted as I have not tested them out. But that is just an example of how you would accomplish your goal. HTH Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: How check credit card or magnetic card number.
Hi, how i can check credit card or magnetic card number for a site of electronic commerce that i have to design. Sorry for my english. Pedro. I think this should work for you, but it's not production tested yet. -Craig function verifyCC($name='', $type='', $number='', $expmonth='', $expyear='') { //make sure all fields are filled in if (empty($name) || empty($type) || empty($number) || empty($expyear) || empty($expmonth)) { return FALSE; } //verify month makes sense if(!is_numeric($expmonth) || $expmonth 1 || $expmonth 12) { return FALSE; } // Get the current year $currentYear = date('Y'); expyear = '20' . $expyear; settype($currentYear, 'integer'); //verify year makes sense if (!is_numeric($expyear) || $expyear $currentYear || $expyear $currentYear + 10) { return FALSE; } //strip out non-numeric numbers from number $number = preg_replace('/[^0-9]/', '', $number); $type = strtolower($type); //check length and prefix of number if ($type == 'mastercard' || $type == 'mc') { $validFormat = ereg(^5[1-5][0-9]{14}$, $number); } elseif ($type == 'visa') { $validFormat = ereg(^4[0-9]{12}([0-9]{3})?$, $number); } elseif ($type == 'amex' || $type == 'american express') { $validFormat = ereg(^3[47][0-9]{13}$, $number); } elseif ($type == 'diners club' || $type == 'dc' || $type = 'diners') { $validFormat = ereg(^3(0[0-5]|[68][0-9])[0-9]{11}$, $number); } elseif ($type == 'discover' || $type == 'disc') { $validFormat = ereg(^6011[0-9]{12}$, $number); } elseif ($type == 'jcb') { $validFormat = ereg(^(3[0-9]{4}|2131|1800)[0-9]{11}$, $number); } else { return FALSE; } if (!$validFormat) { return FALSE; } //do mod 10 algorithm $revNum = strrev($number); $sum = 0; for($i = 0; $i strlen($revNum); $i++) { $currentNum = substr($revNum, $i, 1); //double every second digit if($i % 2 == 1) { $currentNum *= 2; } //add digits of 2-digit numbers together if($currentNum 9) { $firstNum = $currentNum % 10; $secondNum = ($currentNum - $firstNum) / 10; $currentNum = $firstNum + $secondNum; } $sum += $currentNum; } //check if there's a remainder if ($sum % 10 0) { return FALSE; } return TRUE; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and MS SQL ?
We are running PHP 4.3.4 with an IIS 5 server on WIN 2K server. PHP works fine on the server, the problem is connecting to a MS SQL database. When I try to access the site I get the following message: Fatal error: Call to undefined function: mssql_connect() in C:\newdata\linked\db_connect.php on line 2 I followed the instructions for MS SQL install from the site below. http://www.php.net/manual/en/ref.mssql.php I left out To get these functions to work, you have to compile PHP with --with-mssql[=DIR], where DIR is the FreeTDS install prefix. And FreeTDS should be compiled using --enable-msdblib. , b/c it seem like it didn't apply to Windows. Any suggestions? Thanks in advance. - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it!
[PHP] Re: Zlib Compression || Implementation || Bandwidth Savings?
Cf High [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Having a good problem -- our hockey report site has jumped from 10 gigs/month to 30+ gigs/month growing. We're getting killed in bandwidth fees at the moment; barring switching to another host, will utilizing ZLIB compression significantly reduce bandwidth? well it depends what uses most of your bandwith. If it is for images, then compression will not help much since images are allready compressed. In that case, you may save much more if you can put images in some directory and tell apache to allow cacheing for that directory. On the other hand if your bandwith goes mainly on thransfer of html source for the pages then compression can shave up to 80% of your bandwith usage. rush -- http://www.templatetamer.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and MS SQL ?
Mark wrote: We are running PHP 4.3.4 with an IIS 5 server on WIN 2K server. PHP works fine on the server, the problem is connecting to a MS SQL database. When I try to access the site I get the following message: Fatal error: Call to undefined function: mssql_connect() in C:\newdata\linked\db_connect.php on line 2 I followed the instructions for MS SQL install from the site below. http://www.php.net/manual/en/ref.mssql.php I left out To get these functions to work, you have to compile PHP with --with-mssql[=DIR], where DIR is the FreeTDS install prefix. And FreeTDS should be compiled using --enable-msdblib. , b/c it seem like it didn't apply to Windows. Any suggestions? Thanks in advance. Did you do this, and restart your web server? The MSSQL extension is enabled by adding extension=php_mssql.dll to php.ini. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Regular expression help?
Not sure if anyone knows of a good way to match strings of this type... 00:02:8b:0c:2f:09 I have tried this but its not working. !eregi(^[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}$,$_POST['mac']) so it should match 2 characters 0-9a-fA-F each block of 2 characters is followed by a : and repreated in 6 blocks. Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and MS SQL ?
Mark wrote: I restarted the server and the extension was added by default. Was there a need to do the compile? No, I don't think so. You should only have to compile it if you're on a *nix machine. I'm not too familiar with Windows and IIS, but it sounds like the dll isn't getting loaded. Maybe check your error logs to see if IIS is telling you that. Also, check your extensions directory in the php.ini, and make sure it's pointing to where the .dll's are. There are some user comments on the mssql_connect() page of the manual which may help you out. http://us4.php.net/manual/en/function.mssql-connect.php snip -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help for code to 'sort list' please
I have the following sql query in my Php code: $sql = SELECT id, date_day, date_month, date_year, title, content FROM $table_name ORDER BY date_year desc; The rest of the php code is just a simple db connection with a bullet list and 'while' loop with an 'echo result' request. This shows a list of dates with latest year on top of list. I have Select/Option boxes to chose day,month,year etc to fill in Php form to update database. This is result of sql query: 2-August-2007 1-January-2007 30-December-2007 8-July-2006 29-February-2006 3-March-2006 16-February-2005 1-January-2004 Although it lists in year order descending (in fact what I asked it to do) I would like to learn to sort the months and days into desc order properly too. Can anyone suggest how I achieve this with php code. Thank you in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regular expression help?
* Jas [EMAIL PROTECTED]: Not sure if anyone knows of a good way to match strings of this type... 00:02:8b:0c:2f:09 I have tried this but its not working. !eregi(^[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}$,$_POST['mac']) Use the perl compatible regexps instead: !preg_match('/^([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}$/', $_POST['mac']) This searches for XX: 5 followed by XX, where XX is 0-9, A-F, or a-f. I _think_ the POSIX regexps can do some grouping like this as well, but I'm not absolutely sure. -- Matthew Weier O'Phinney Webmaster and IT Specialist National Gardening Association 802-863-5251 x156 mailto:[EMAIL PROTECTED] http://www.garden.org http://www.kidsgardening.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help for code to 'sort list' please
EastLothianDirectory wrote: I have the following sql query in my Php code: $sql = SELECT id, date_day, date_month, date_year, title, content FROM $table_name ORDER BY date_year desc; The rest of the php code is just a simple db connection with a bullet list and 'while' loop with an 'echo result' request. This shows a list of dates with latest year on top of list. I have Select/Option boxes to chose day,month,year etc to fill in Php form to update database. This is result of sql query: 2-August-2007 1-January-2007 30-December-2007 8-July-2006 29-February-2006 3-March-2006 16-February-2005 1-January-2004 Although it lists in year order descending (in fact what I asked it to do) I would like to learn to sort the months and days into desc order properly too. Can anyone suggest how I achieve this with php code. Thank you in advance Let the db do this. ORDER BY -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help for code to 'sort list' please
Thank you for reply. I already have 'ORDER BY year desc'. But as I mentioned how do I get the months and day in order too on the same list. Thank you in advance Original Message From: John Nichel Date: Mon 2/2/04 19:31 To: EastLothianDirectory Cc: [EMAIL PROTECTED] Subject:Re: [PHP] Help for code to 'sort list' please EastLothianDirectory wrote: I have the following sql query in my Php code: $sql = SELECT id, date_day, date_month, date_year, title, content FROM $table_name ORDER BY date_year desc; The rest of the php code is just a simple db connection with a bullet list and 'while' loop with an 'echo result' request. This shows a list of dates with latest year on top of list. I have Select/Option boxes to chose day,month,year etc to fill in Php form to update database. This is result of sql query: 2-August-2007 1-January-2007 30-December-2007 8-July-2006 29-February-2006 3-March-2006 16-February-2005 1-January-2004 Although it lists in year order descending (in fact what I asked it to do) I would like to learn to sort the months and days into desc order properly too. Can anyone suggest how I achieve this with php code. Thank you in advance Let the db do this. ORDER BY -- By-Tor.com It's all about the Rush http://www.by-tor.com -- 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] Help for code to 'sort list' please
EastLothianDirectory wrote: Thank you for reply. I already have 'ORDER BY year desc'. But as I mentioned how do I get the months and day in order too on the same list. Thank you in advance snip Read the documentation for ORDER BY in MySQL. You can sort on multiple columns. Basically, you can 'ORDER BY year, month, day DESC' (my syntax may be off), and it order it by the year first, then like years will be ordered by month, etc. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular expression help?
On Mon, 2004-02-02 at 14:15, Jas wrote: I have tried this but its not working. !eregi(^[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}$,$_POST['mac']) so it should match 2 characters 0-9a-fA-F each block of 2 characters is followed by a : and repreated in 6 blocks. That's a long expression, try: !preg_match('/^([0-9a-f]{2}($|:)){6}/i', $_POST['mac']); This pattern finds 6 matches of a number or letter (the /i means case-insensitive) followed by either a ':' or the end of the string. -- Adam Bregenzer [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pulling unique data from database into an array
I am pulling data from a database that list the Language a person speaks and the id number. It is in a format like this. user_idfield_value 6English||Spanish 2English 8English||Portuguese||Finnish 5English||Japanese||German 3English 1English 9German each time it looks at a new record it list all the languages that that person speaks with a double pipe in between each language. What I need to do is find all the unique languages so I can generate a list of languages that do not have any repeats in it with each users id number that speaks that language. so the list above would be 6,2,8,5,3,1 English 8 Portuguese 8 Finnish 5 Japanese 5,9 German 6 Spanish Using the script below (I am using ADODB for a database layer) I am able to pull the data into an array of both fields so it gives me an array that looks like this Array ( [6] = English||Portuguese||Finnish [2] = English||Portuguese||German [8] = English [7] = English ) ) But I can not figure out how to split it up so there is a list like I have above. I know I need to use explode, array_merge and array_unique but I am not sure how to set it up so it will work correctly $sql = SELECT * FROM default_UserDBElements WHERE field_name = 'Languages'; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $recordSet = $conn-Execute($sql); if (!$recordSet) print $conn-ErrorMsg(); else while (!$recordSet-EOF) { $array[$recordSet-fields['user_id']] = $recordSet-fields['field_value']; $recordSet-MoveNext(); } print_r($array); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help for code to 'sort list' please
Chris, It looks like your data in date_year is not in a format that supports a simple DESC sort. Look into getting the column formatted in -mm-dd order (see the mysql manual for this). Read the data in your column, format it, pump it back into the database, then change the column type to 'date'. Of course, you'll also need to examine any new inputs and get them correctly formated before they're added to the database. hugh - Original Message - From: EastLothianDirectory [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 02, 2004 11:18 AM Subject: [PHP] Help for code to 'sort list' please I have the following sql query in my Php code: $sql = SELECT id, date_day, date_month, date_year, title, content FROM $table_name ORDER BY date_year desc; The rest of the php code is just a simple db connection with a bullet list and 'while' loop with an 'echo result' request. This shows a list of dates with latest year on top of list. I have Select/Option boxes to chose day,month,year etc to fill in Php form to update database. This is result of sql query: 2-August-2007 1-January-2007 30-December-2007 8-July-2006 29-February-2006 3-March-2006 16-February-2005 1-January-2004 Although it lists in year order descending (in fact what I asked it to do) I would like to learn to sort the months and days into desc order properly too. Can anyone suggest how I achieve this with php code. Thank you in advance -- 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] Urgent: PHP Programmer
REQ-2004-01 Programmer I Position reference #166370 Job will go offline on 2/26/2004 ALeNet, Inc. is a privately held firm based in Coral Gables, Florida. We are a leading provider of enterprise system consulting services in the areas of eBusiness, enterprise resource planning (ERP) and customer relationship management (CRM). ALeNet has teamed up with leading technology providers to offer the most comprehensive, integrated suite of ERP, CRM and web solutions available today. Our industry recognized IT professionals will focus your ERP, CRM and e-business strategy efforts to achieve the greatest possible return on investment (ROI) and highest levels of customer service. Qualifications * Knowledge of: PHP (min. 5 years experience) * HTML+CSS+JavaScript is a must. * OOP * SQL or MySQL (preferred) Position description Under the general supervision of the Product Development Manager, reviews, analyzes, and modifies programming systems including encoding, testing, debugging and installing to support an organization's business applications. Gathers requirements from users and creates specifications and develops code. Designs and writes codes to support existing application. Familiar with standard concepts, practices, and procedures using PHP, MySQL, HTML, and JavaScript. Relies on limited experience and judgment to plan and accomplish goals. Performs a variety of IT related tasks. Additional information Locations : Miami, Fort Lauderdale,FL, United States Percentage travel : No Travel Position starts : 2/15/2004 Openings available : 3 Work Types : FullTime, Regular, Paid Contact information Cesar Cordovez 501 Brickell Key Drive Suite 203 Miami, FL, United States 33131 Primary Phone : (305) 379- Ext: 15 Email : [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need Help - extract unstructured data for parse reformat and import into DB
I need to get some guidance on a project. I have to extract unstructured data from a .CSV file and reformat the data to import into MSSQL. The unstructured data is basically in some kind of sub summary report. Note: the files will include a range from 1 to 12 months of information (month to date). Four different .CSV files would need to be reformatted at the same time. The file size for one is about 1.7 MB and containing roughly around 21,115 rows of data in each. Would PHP be a good program to use for this project? Has anyone had to reformat unstructured data to insert into a database? If anyone has any suggestions or examples please let me know. J I was thinking about importing the data into an array then parsing through the information with multiple if statements then using SQL to insert the data into a database. This will be my first PHP parse project so any examples and suggestions to get me started would be greatly appreciated. A small sample of the data structure is below: Thank You, Sophia [EMAIL PROTECTED] /WCS37 /WCS9 /WCS9 WCS9 RETAIL REGIS PAG E1 VEHIC LE TYPE CAR T AREA: PLACE MONTH MONTH MONTH OCT.SEP.AUG 200320032003 GROUP MAK MDL - --- --- - - - SPTY COUP AU RSX3 4 8 CCT CAR FORD FC 4 1 7 REPORT DATE: 1/12/01 RETAIL REGIS PAG E1 VEHIC LE TYPE CAR T AREA: PLACE2 MONTH MONTH MONTH OCT.SEP.AUG 200320032003 GROUP MAK MDL - --- --- - - - SPTY COUP AU RSX1 7 3 CCT CAR FORD FC 2 2 5 REPORT DATE: 1/12/01 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Zlib Compression || Implementation || Bandwidth Savings?
H Looks like the majority of sent bandwidth is html, not image files ratio is at least 10:1 html to images. With that in mind, setting zlib compression to ON seems the way to go. Question is, how to implement compression? Is it enough to just ini_set() zlib compression to ON? i.e. will all content be automatically be compressed, or do I need to ob_start() ob_end_clean() at the start and end of each page? TIA for any clues -- I'm obviously confused about compression techniques. --Noah Rush [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Cf High [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Having a good problem -- our hockey report site has jumped from 10 gigs/month to 30+ gigs/month growing. We're getting killed in bandwidth fees at the moment; barring switching to another host, will utilizing ZLIB compression significantly reduce bandwidth? well it depends what uses most of your bandwith. If it is for images, then compression will not help much since images are allready compressed. In that case, you may save much more if you can put images in some directory and tell apache to allow cacheing for that directory. On the other hand if your bandwith goes mainly on thransfer of html source for the pages then compression can shave up to 80% of your bandwith usage. rush -- http://www.templatetamer.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] POST required header info
I'm attempting to have some java code send a post request to a php script, but the variables are not being assigned correctly. The request comes through fine, but the vars keep coming up empty. The java code works fine with a perl script that grabs the post vars, as well as from a simple html form submitting post requests to the script. The only possible answer we've come up with some missing header information. Does anyone know where I can find a list of header requirements, or have encounter this type of problem before. Using GET is not an option. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help for code to 'sort list' please
EastLothianDirectory wrote: I have the following sql query in my Php code: $sql = SELECT id, date_day, date_month, date_year, title, content FROM $table_name ORDER BY date_year desc; ... Although it lists in year order descending (in fact what I asked it to do) I would like to learn to sort the months and days into desc order properly too. Can anyone suggest how I achieve this with php code. I would do it in the SQL the same way as you have sorted on 'date_year' e.g.: $sql = SELECT id, date_day, date_month, date_year, title, content FROM $table_name ORDER BY date_year, date_month desc; this assumes you have a numerical value stored for 'date_month', otherwise you will have the months sorted alphabetically which probably does not help. (my gut feeling is that storing the names of the month in the database is probably not the best way to go about it - have you looked at datetime/timestamp fields?) BTW you can also mix DESC/ASC sorting (although this probably does not make sense to do when considering ordering by 'date' data) e.g.: $sql = SELECT id, date_day, date_month, date_year, title, content FROM $table_name ORDER BY date_year ASC, date_month desc; the lowdown on sorting in MySQL can be found here: http://www.mysql.com/doc/en/Sorting_rows.html more info on datetime fields in MySQL can be found here: http://www.mysql.com/doc/en/DATETIME.html and here: http://www.mysql.com/doc/en/Date_calculations.html --- alernatively familiarize yourself with PHPs array sorting functions - e.g. array_multi_sort() (I may have spelt that function incorrectly!), but I think that it will be alot more hassle to set up an multilevel array with a second/third array for mapping the month names (assuming the 'date_month' field contains text) to numbers for sorting purposes than using the DB beforehand. Thank you in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help for code to 'sort list' please
Thank you for replying again but I have already been on the Mysql.com website and although I did ascertain the correct syntax ie ORDER BY date_day, date_month, date_year desc ORDER BY date_day, date_year, date_month desc ORDER BY date_month, date_day, date_year desc ORDER BY date_month, date_year, date_day desc ORDER BY date_year, date_day, date_month desc ORDER BY date_year, date_month, date_day desc None of them work mainly because the months get listed alphabetically and not IN ORDER. For example AUGUST is listed as the first month because it started with 'A' The year and day being integers were listed correctly. Now do you see the problem. This is why Mysql.com was no good so I came to PHP for help. Thank you in advance to anyone ?? that can help. Original Message From: John Nichel Date: Mon 2/2/04 19:43 To: [EMAIL PROTECTED] Subject:Re: [PHP] Help for code to 'sort list' please EastLothianDirectory wrote: Thank you for reply. I already have 'ORDER BY year desc'. But as I mentioned how do I get the months and day in order too on the same list. Thank you in advance snip Read the documentation for ORDER BY in MySQL. You can sort on multiple columns. Basically, you can 'ORDER BY year, month, day DESC' (my syntax may be off), and it order it by the year first, then like years will be ordered by month, etc. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- 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] Retrieving class names in a static method
I'm looking for a way to find the class name of an object within a static method. class_name($this) works for instances, but in a static method $this does not exist. Also, __CLASS__ isn't inheritable so isn't really a solution for what I am looking for. Has anybody done this before? Here's a theoretical example: class Foo { function getClassName() { // ??? } } class Bar extends Foo { } echo Foo::getClassName(); // returns 'foo' echo Bar::getClassName(); // returns 'bar' One sample application of this would be a debugging method in a base class that is inherited and used in a static method. TIA, Adam -- Adam Bregenzer [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need Help - extract unstructured data for parse reformat and import into DB
snip Would PHP be a good program to use for this project? Has anyone had to reformat unstructured data to insert into a database? If anyone has any suggestions or examples please let me know. J /snip If you have not already, look at regular expressions. imho, by far the best way to parse reports like this. php would work fine for parsing this data but I prefer perl's regular expression methods. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help for code to 'sort list' please
refering to my previous mail: I really don't think its a good idea to store the months as names in the DB (I recommend a datetime field to store the complete date info). but if you must then you will have to define an array which you can use as a sort key e.g. array( 1 = 'January', 2 = 'February', ...etc... ); and use something like this is combination with a multisort array function to get the order you want - but the way I see it your better off changing the DB schema and using a few date related function is either MySQL or PHP to display the dates in a user friendly way (e.g. '10 January 2004'). EastLothianDirectory wrote: Thank you for replying again but I have already been on the Mysql.com website and although I did ascertain the correct syntax ie ... None of them work mainly because the months get listed alphabetically and not IN ORDER. For example AUGUST is listed as the first month because it started with 'A' The year and day being integers were listed correctly. Now do you see the problem. This is why Mysql.com was no good so I came to PHP for help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pulling unique data from database into an array
// given an array in the form: $arrX = array( '6' = 'English||Spanish' '8' = 'English||Portuguese||Finnish' // ...etc... ); // define a new array loop thru $arrX like so: $arrTmp = array() foreach ($arrX as $langs) { $arrTmp = array_merge($arrTmp, explode('||',$langs)); } // now loop thru the $arrTmp array (and for each item loop the original $arrX array) as follows: foreach ($arrTmp as $Tmp) { $arrFinal[$Tmp] = array(); foreach($arrX as $uid = $langs) { // is the lang in this users lang list if (stristr($langs, $Tmp)) { // yes it is! add the user to this lang $arrFinal[$Tmp][] = $uid; } } } // now dump the results to the screen: echo (users lang\n); foreach ($arrFinal as $lang = $users) { echo implode(',',$users). $lang\n; } --- that was off the top of my head; there is probably a better way of doing it but hopefully it points you in the right direction. if you don't understand this code I suggest testing it out (there may be typos!!) - these are basic manipulations and a developing proper understanding of them is very important to being able to write good code - I speak from experience when I say the only real way to understand it is to play with it. have fun. Richard Kurth wrote: I am pulling data from a database that list the Language a person speaks and the id number. It is in a format like this. user_idfield_value 6English||Spanish 2English 8English||Portuguese||Finnish 5English||Japanese||German 3English 1English 9German each time it looks at a new record it list all the languages that that person speaks with a double pipe in between each language. What I need to do is find all the unique languages so I can generate a list of languages that do not have any repeats in it with each users id number that speaks that language. so the list above would be 6,2,8,5,3,1 English 8 Portuguese 8 Finnish 5 Japanese 5,9 German 6 Spanish Using the script below (I am using ADODB for a database layer) I am able to pull the data into an array of both fields so it gives me an array that looks like this Array ( [6] = English||Portuguese||Finnish [2] = English||Portuguese||German [8] = English [7] = English ) ) But I can not figure out how to split it up so there is a list like I have above. I know I need to use explode, array_merge and array_unique but I am not sure how to set it up so it will work correctly $sql = SELECT * FROM default_UserDBElements WHERE field_name = 'Languages'; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $recordSet = $conn-Execute($sql); if (!$recordSet) print $conn-ErrorMsg(); else while (!$recordSet-EOF) { $array[$recordSet-fields['user_id']] = $recordSet-fields['field_value']; $recordSet-MoveNext(); } print_r($array); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with mail() function
Hi, I'm new to php and this newsletter. I have a form on my webpage and a php file to email it to me but the contents of the text area are not emailed to me. Can anyone help me with this? here is the code for my html and php files: html headtitleTest/title/head body form action=textareamail.php method=POST Comments: /br textarea rows=10 cols=50 name=TextArea/textarea /br input type=reset value=Clear input type=submit value=Submit /form /body /html ?php if ($TextArea=) { echo You have to fill out the entire form, go back and try again.; } else { $to = [EMAIL PROTECTED]; $from = From-Test; $subject = Subject-Test; $message = $TextArea; mail($to, $subject, $message,From: $from); echo Thankyou; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with mail() function
[snip] ?php if ($TextArea=) { echo You have to fill out the entire form, go back and try again.; } else { $to = [EMAIL PROTECTED]; $from = From-Test; $subject = Subject-Test; $message = $TextArea; mail($to, $subject, $message,From: $from); echo Thankyou; } ? [/snip] What is happening when the form is posted? This is just a guess, but I think registar_globals is probaby off. try this ?php if ($_POST['TextArea']=) { echo You have to fill out the entire form, go back and try again.; } else { $to = [EMAIL PROTECTED]; $from = From-Test; $subject = Subject-Test; $message = $TextArea; mail($to, $subject, $message,From: $from); echo Thankyou; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with mail() function
ahh, I have to correct myself replace this: if ($_POST['TextArea']=) { with this: if ($_POST['TextArea']==) { -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help for code to 'sort list' please
Was just reading your previous reply and my months are indeed in text and therein lies the problem. I will have to completely rewrite the online form which will add a(mysql type) date to add it and all the fields to the DB. I will research the 'PHPs array sorting functions' that you mention. It might be quicker. ..Just thought that it WILL be quicker converting the months in the SELECT/OPTION boxes to integers then no need to do a complete rewrite although I should learn how to do the mysql date thing anyway. Thanks Jochem and also to Hugh for replying. Chris - Original Message From: Jochem Maas Date: Mon 2/2/04 20:47 To: [EMAIL PROTECTED] Subject:Re: [PHP] Help for code to 'sort list' please refering to my previous mail: I really don't think its a good idea to store the months as names in the DB (I recommend a datetime field to store the complete date info). but if you must then you will have to define an array which you can use as a sort key e.g. array( 1 = 'January', 2 = 'February', ...etc... ); and use something like this is combination with a multisort array function to get the order you want - but the way I see it your better off changing the DB schema and using a few date related function is either MySQL or PHP to display the dates in a user friendly way (e.g. '10 January 2004'). EastLothianDirectory wrote: Thank you for replying again but I have already been on the Mysql.com website and although I did ascertain the correct syntax ie ... None of them work mainly because the months get listed alphabetically and not IN ORDER. For example AUGUST is listed as the first month because it started with 'A' The year and day being integers were listed correctly. Now do you see the problem. This is why Mysql.com was no good so I came to PHP for help. -- 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] POST required header info
Scott Birksted wrote: I'm attempting to have some java code send a post request to a php script, but the variables are not being assigned correctly. The request comes through fine, but the vars keep coming up empty. The java code works fine with a perl script that grabs the post vars, as well as from a simple html form submitting post requests to the script. The only possible answer we've come up with some missing header information. Does anyone know where I can find a list of header requirements, or have encounter this type of problem before. Using GET is not an option. Please read this: http://php.net/register_globals If it's still not clear, check the archives. If you still can't find an answer come back here and we'll spoon-feed you. -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help with mail() function
did you replace ($TextArea=) with ($TextArea==) ? ($TextArea=) will reassign $TextArea to Pooya Eslami [EMAIL PROTECTED] 2/2/2004 3:00:32 PM Well the problem is not that it won't get executed, its that every thing will be sent except the message in the textarea! subject, to and from are sent fine -- 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] Sendmail wrapper
Hi all... I have a chrooted Apache/PHP on Solaris 8 working fine except for one PHP function, mail(). I read that in Unix environments there is not possible to make PHP use a remote SMTP and it needs to find a sendmail executable un the path. Since including Postfix in the chrooted env. does not look very nice, I try to use a wapper (local_FS-remote_SMTP), but I am not happy with the one I found. It does not handle well the CC, nor the BCC so I change it a little, but still have issues (for explample if the SMTP does not responds, it don't try angain and the mail is lost). Do you know some sendmail wrapper to recomend? Any help is welcome... Bye! -- Federico Petronio [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help with mail() function
Well the problem is not that it won't get executed, its that every thing will be sent except the message in the textarea! subject, to and from are sent fine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] My PHP file is not parsed
I have installed Apache 2.0.43 (win32) on my XP machine, together with PHP 4.2.3. I have configured the server to recognise PHP, local directories etc. Apache starts - no errors, and will accept PHP documents from my browser. But when I run my PHP pages, php is not parsed. I've put syntax errors purposely but it does not post any syntax errors. This is means that the php part is not parsed. What could be the problem in the configuration? Thx a lot _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] My PHP file is not parsed
From: Reem M. [EMAIL PROTECTED] I have installed Apache 2.0.43 (win32) on my XP machine, together with PHP 4.2.3. I have configured the server to recognise PHP, local directories etc. Apache starts - no errors, and will accept PHP documents from my browser. But when I run my PHP pages, php is not parsed. I've put syntax errors purposely but it does not post any syntax errors. This is means that the php part is not parsed. What could be the problem in the configuration? Thx a lot Or it could just mean display_errors is OFF in your php.ini. Turn it on. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular expression help?
Adam Bregenzer wrote: On Mon, 2004-02-02 at 14:15, Jas wrote: I have tried this but its not working. !eregi(^[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}$,$_POST['mac']) so it should match 2 characters 0-9a-fA-F each block of 2 characters is followed by a : and repreated in 6 blocks. That's a long expression, try: !preg_match('/^([0-9a-f]{2}($|:)){6}/i', $_POST['mac']); This pattern finds 6 matches of a number or letter (the /i means case-insensitive) followed by either a ':' or the end of the string. Thanks, that worked like a charm. Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular expression help?
Jas wrote: Adam Bregenzer wrote: On Mon, 2004-02-02 at 14:15, Jas wrote: I have tried this but its not working. !eregi(^[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}$,$_POST['mac']) so it should match 2 characters 0-9a-fA-F each block of 2 characters is followed by a : and repreated in 6 blocks. That's a long expression, try: !preg_match('/^([0-9a-f]{2}($|:)){6}/i', $_POST['mac']); This pattern finds 6 matches of a number or letter (the /i means case-insensitive) followed by either a ':' or the end of the string. Thanks, that worked like a charm. Jas You may want to check out The Regex Coach. It's very helpful. :-) http://www.weitz.de/regex-coach/ -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [Stats] PHP Net List: January 2004
-- Searchable archives for this list are available at http://www.listsearch.com/phplist.lasso -- == PHP Net List Stats January, 2004 == Note: Up/Down % as compared with December, 2003 Posts: 2900 (Up 26%) Authors: 555 (Up 8%) Threads: 759 (Up 17%) Top 20 Contributors by Number of Posts -- Richard Davey 80 John Nichel 75 John W. Holmes 73 Jason Wong 68 Chris Shiflett 66 Ryan A 61 Freedomware 60 Jay Blanchard 51 Ben Ramsey 50 Stuart 49 Raditha Dissanayake 41 Matt Matijevich 39 daniel 38 memoimyself 37 Marek Kilimajer 37 DvDmanDT35 CPT John W. Holmes 30 Radwan Aladdin 30 Tom Rogers 29 Justin Patrin 29 Top 20 Threads by Number of Posts -- [PHP] Odd Code Error. 43 [PHP] what PHP really needs 30 [PHP] URL rewriting...anybody done this?26 [PHP] Still error messages!!21 [PHP] Returning Newbie (Disoriented)20 [PHP] Session time-out value20 [PHP] picturing webpage 16 [PHP] jpeg Uploader issue 16 [PHP] Generating an Excel file? 16 [PHP] Why we love Microsoft (0t)16 [PHP] amp 16 [PHP] Flash-PHP Socket Connection 15 [PHP] Googlebot 14 [PHP] Form validation: client- or server-side? 13 [PHP] Syntax Error - This is WEIRD!13 [PHP] Sessions not working. 13 [PHP] How do you guys do this? 13 [PHP] Counting back 90 days... 12 [PHP] Sorting data into columns vertically 12 [PHP] Image Header Issues 12 Top 20 Search Terms by Number of Requests -- include 2 schedule 2 lasso1 session 1 -- - Bill Doerrfeld[EMAIL PROTECTED] Blue World Communications, Inc. http://www.blueworld.com/ - Build and serve powerful data-driven Web sites with Lasso Studio and Lasso Professional. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Adding one month to a given date
Hi there, I am trying to add one month to a given date. Somehow I am lost inbetween mktime, date and unix timestamps ;-( Can anybody give me a hint on that? The date format I do have is: 2003-10-19 Guess this does not work: $ptm = '2003-10-19'; $ptm = 1 + mktime('YmdHis',$ptm); Thanx for any help, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Adding one month to a given date
I've found the following works best for me, takes into consideration leapyears and daylight savings time, etc. $datetime = date(Y-m-d H:i:s,strtotime($inputdatetime. + 1 month)); http://www.php.net/manual/en/ref.datetime.php Warren Vail -Original Message- From: merlin [mailto:[EMAIL PROTECTED] Sent: Monday, February 02, 2004 2:24 PM To: [EMAIL PROTECTED] Subject: [PHP] Adding one month to a given date Hi there, I am trying to add one month to a given date. Somehow I am lost inbetween mktime, date and unix timestamps ;-( Can anybody give me a hint on that? The date format I do have is: 2003-10-19 Guess this does not work: $ptm = '2003-10-19'; $ptm = 1 + mktime('YmdHis',$ptm); Thanx for any help, Merlin -- 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] Adding one month to a given date
here's a thought: - // using strtotime() you can turn your date into a unixtimestamp. e.g. $unixTimeStamp = strtotime('2003-10-19'); // using getdate($unixTimeStamp) you can get the consituent parts of the // date. e.g. $dateParts = getdate($unixTimeStamp); // then create a new unixtimestamp with mktime() e.g. $newUnixTimeStamp = mktime($dateParts['hours'], $dateParts['minutes'], $dateParts['seconds'], $dateParts['mon'] + 1, $dateParts['mday'], $dateParts['year']); // now you need to format the unixtimestamp so its humanly readable e.g. echo strftime('%Y-%m-%d', $newUnixTimeStamp); tip: mktime() is a great tool for date calculations! check the comments on PHP site (page for the mktime() function) for tips on this. hope it helps (the above may contain typos!) rgds, jochem merlin wrote: Hi there, I am trying to add one month to a given date. Somehow I am lost inbetween mktime, date and unix timestamps ;-( Can anybody give me a hint on that? The date format I do have is: 2003-10-19 Guess this does not work: $ptm = '2003-10-19'; $ptm = 1 + mktime('YmdHis',$ptm); Thanx for any help, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Pulling unique data from database into an array
Hello Jochem, I tried what you suggested and it work just perfect as long as i made the array by hand. But when I try to generate the array using the database I can not get it to work. How would I create the array $arrX from the mysql database. I have tried this but it does not work properly while (!$recordSet-EOF) { $arrX = $recordSet-fields['user_id'] = $recordSet-fields['field_value']; $recordSet-MoveNext(); $arrX = array( 6 = English||Spanish, 8 = English||Portuguese||Finnish, 2 = English ); // define a new array loop thru $arrX like so: $arrTmp = array(); foreach ($arrX as $langs) { $arrTmp = array_merge($arrTmp, explode('||',$langs)); } // now loop thru the $arrTmp array (and for each item loop the original //$arrX array) as follows: foreach ($arrTmp as $Tmp) { $arrFinal[$Tmp] = array(); foreach($arrX as $uid = $langs) { // is the lang in this users lang list if (stristr($langs, $Tmp)) { // yes it is! add the user to this lang $arrFinal[$Tmp][] = $uid; } } } // now dump the results to the screen: echo (userslang\n); foreach ($arrFinal as $lang = $users) { echo implode(',',$users). $lang\n; } Monday, February 2, 2004, 12:47:25 PM, you wrote: JM // given an array in the form: JM $arrX = array( '' = 'English||Spanish' '8' = 'English||Portuguese||Finnish' JM // ...etc... JM ); JM // define a new array loop thru $arrX like so: JM $arrTmp = array() JM foreach ($arrX as $langs) { JM $arrTmp = array_merge($arrTmp, explode('||',$langs)); JM } JM // now loop thru the $arrTmp array (and for each item loop the original JM $arrX array) as follows: JM foreach ($arrTmp as $Tmp) { JM $arrFinal[$Tmp] = array(); JM foreach($arrX as $uid = $langs) { JM // is the lang in this users lang list JM if (stristr($langs, $Tmp)) { JM // yes it is! add the user to this lang JM $arrFinal[$Tmp][] = $uid; JM } JM } JM } JM // now dump the results to the screen: JM echo (userslang\n); JM foreach ($arrFinal as $lang = $users) { JM echo implode(',',$users). $lang\n; JM } JM --- JM that was off the top of my head; there is probably a better way of doing JM it but hopefully it points you in the right direction. JM if you don't understand this code I suggest testing it out (there may be JM typos!!) - these are basic manipulations and a developing proper JM understanding of them is very important to being able to write good code JM - I speak from experience when I say the only real way to understand it JM is to play with it. JM have fun. JM Richard Kurth wrote: I am pulling data from a database that list the Language a person speaks and the id number. It is in a format like this. user_idfield_value 6English||Spanish 2English 8English||Portuguese||Finnish 5English||Japanese||German 3English 1English 9German each time it looks at a new record it list all the languages that that person speaks with a double pipe in between each language. What I need to do is find all the unique languages so I can generate a list of languages that do not have any repeats in it with each users id number that speaks that language. so the list above would be 6,2,8,5,3,1 English 8 Portuguese 8 Finnish 5 Japanese 5,9 German 6 Spanish Using the script below (I am using ADODB for a database layer) I am able to pull the data into an array of both fields so it gives me an array that looks like this Array ( [6] = English||Portuguese||Finnish [2] = English||Portuguese||German [8] = English [7] = English ) ) But I can not figure out how to split it up so there is a list like I have above. I know I need to use explode, array_merge and array_unique but I am not sure how to set it up so it will work correctly $sql = SELECT * FROM default_UserDBElements WHERE field_name = 'Languages'; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $recordSet = $conn-Execute($sql); if (!$recordSet) print $conn-ErrorMsg(); else while (!$recordSet-EOF) { $array[$recordSet-fields['user_id']] = $recordSet-fields['field_value']; $recordSet-MoveNext(); } print_r($array); -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Pulling unique data from database into an array
[snip] while (!$recordSet-EOF) { $arrX = $recordSet-fields['user_id'] = $recordSet-fields['field_value']; $recordSet-MoveNext(); [/snip] while (!$recordSet-EOF) { $arrX[$recordSet-fields['user_id']] = $recordSet-fields['field_value']; $recordSet-MoveNext(); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Thumbnail Page
I think I'm having a Bad Hair Day I have a table in my database with all my thumbnail filenames in it. My query pull that out, now I want to display the images in a table, I can get it to go down the page row by row, but I want it to say do five columns of different images and then go down the page with different images? Maybe even have Next and Previous at the bottom would be nice. Anyone got a suggestion, other than a good night sleep ;-) Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] looking for a way to manually free memory in the middle of a script
Hi. I'm running PHP 4.3.4 with bundled GD 2.0.1.5 Here is the problem: I'm running a PHP shell script to fix about a thousand image files that were uploaded to a server without much error checking. I'm skipping all the obvious problems like wrong file types and insanely large jpeg files but after that, each file is getting processed with GD, using imagecreatefromjpg(). I'm still running the script in test mode at the moment so I'm not doing any processing, just watching for errors. I am calling imagedestroy() after each loop but ... around about the 150th image, imagecreatefromjpg() stops the script with the error Allowed memory size of 33554432 bytes exhausted (tried to allocate 9144 bytes). After making minor adjustments, it will process more or less images so it doesn't seem to be getting stuck on a particular file (the file it stops on now is a 32KB jpeg). My question is: is there any other function or method to relieve PHP of some memory? Could it be that imagedestroy() is not freeing all memory properly? a memory leak? I would rather not have to do only a few images at a time since there should be no problems crunching through them all at once. Any suggestions for general memory optimization? thanks, Kumar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] auto forms from mysql database
Hi all, I've been wanting to try building user forms for a CMS straight from what I know about a mysql table before, but have never got around to it. I've discovered that I can find out A LOT about each column using the mysql_field_*() functions, which is great. However, where I'm stuck is that not every field should be displayed to the user (like an auto-increment ID). I first though column comments would help, but they're a MySQL 4.1+ feature that I don't / won't have the luxury of. My simple idea was to place a _usr on the end of column names which I expected user input from, then only building a HTML form to suit THOSE columns. This worked fine. Then I decided that some fields would be required, and others would not. I also decided that some fields would require basic cleaning (strip tags), but others would require complex parsing (bbcode for example) before insertion. I had a pie-in-the-sky idea that I could name MySQL columns WITH instructions in them for what my application should do... bodyText_URB could mean that it's for the User to fill in, it's Required, and should be parsed with a BBCode parser. bodyText_URH could mean that it's for the User to fill in, it'd Required, and basic HTML is allowed inside. I like the fact that everything I need to know about a column / field is listed in one place -- it isn't split into the PHP script as well. However, this also means I'm putting application logic in the data layer, and creating a legacy field name that may have to be changed at some point when I decide a 'H' should be a 'B', or an 'R' is no longer required. Perhaps all the user-supplied data could be in a separate table, but that would only solve some of my problems. So, looks like I'm back to PHP logic. I considered that I could store a simple array of required/user/bb/html/etc field names to which I could check against when building the form from the mysql data, but my hope is that someone else has tackled something like this in the past, and can offer some advice... TIA Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with upload don't understand
hi, i have the following script to dowload upload file into a webserver I know i don't need copy but i used it to know if this way works or not $att = $_FILES['att']['name']; $temp = $_FILES['att']['tmp_name']; if($att){ $uploadfile = $uploaddir.$att; print yo GOT $att and temp is $temp, and $uploadfilebr; copy($temp, $uploadfile); if (!move_uploaded_file($temp, $uploadfile)){ print Error can not upload file br; } and here is the output yo GOT CC.xls and temp is /tmp/phprHKPjk, and /home/cm7uk/public_html/emaillist/attach/CC.xls Warning: open_basedir restriction in effect. File is in wrong directory in /home/cm7uk/public_html/emaillist/sending.php on line 13 Warning: Unable to create ' /home/cm7uk/public_html/emaillist/attach/CC.xls': No such file or directory in /home/cm7uk/public_html/emaillist/sending.php on line 14 Warning: Unable to move '/tmp/phprHKPjk' to ' /home/cm7uk/public_html/emaillist/attach/CC.xls' in /home/cm7uk/public_html/emaillist/sending.php on line 14 Error can not upload file Warning: Cannot add header information - headers already sent by (output started at /home/cm7uk/public_html/emaillist/sending.php:11) in /home/cm7uk/public_html/emaillist/sending.php on line 65 any help is appreciated thanx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: looking for a way to manually free memory in the middle of a script
Kumar McMillan wrote: Hi. I'm running PHP 4.3.4 with bundled GD 2.0.1.5 Here is the problem: I'm running a PHP shell script to fix about a thousand image files that were uploaded to a server without much error checking. I'm skipping all the obvious problems like wrong file types and insanely large jpeg files but after that, each file is getting processed with GD, using imagecreatefromjpg(). I'm still running the script in test mode at the moment so I'm not doing any processing, just watching for errors. I am calling imagedestroy() after each loop but ... around about the 150th image, imagecreatefromjpg() stops the script with the error Allowed memory size of 33554432 bytes exhausted (tried to allocate 9144 bytes). After making minor adjustments, it will process more or less images so it doesn't seem to be getting stuck on a particular file (the file it stops on now is a 32KB jpeg). My question is: is there any other function or method to relieve PHP of some memory? Could it be that imagedestroy() is not freeing all memory properly? a memory leak? I would rather not have to do only a few images at a time since there should be no problems crunching through them all at once. Any suggestions for general memory optimization? thanks, Kumar If this does happen to be a GD or PHP memory leak, I would suggest writing a driver script which calls a sub-script which does the processing. Have the driver keep track of all of the files and hand one (or some number) to the processor, which processes them. Use system() to call the processor. -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: auto forms from mysql database
Justin French wrote: Hi all, I've been wanting to try building user forms for a CMS straight from what I know about a mysql table before, but have never got around to it. I've discovered that I can find out A LOT about each column using the mysql_field_*() functions, which is great. However, where I'm stuck is that not every field should be displayed to the user (like an auto-increment ID). I first though column comments would help, but they're a MySQL 4.1+ feature that I don't / won't have the luxury of. My simple idea was to place a _usr on the end of column names which I expected user input from, then only building a HTML form to suit THOSE columns. This worked fine. Then I decided that some fields would be required, and others would not. I also decided that some fields would require basic cleaning (strip tags), but others would require complex parsing (bbcode for example) before insertion. I had a pie-in-the-sky idea that I could name MySQL columns WITH instructions in them for what my application should do... bodyText_URB could mean that it's for the User to fill in, it's Required, and should be parsed with a BBCode parser. bodyText_URH could mean that it's for the User to fill in, it'd Required, and basic HTML is allowed inside. I like the fact that everything I need to know about a column / field is listed in one place -- it isn't split into the PHP script as well. However, this also means I'm putting application logic in the data layer, and creating a legacy field name that may have to be changed at some point when I decide a 'H' should be a 'B', or an 'R' is no longer required. Perhaps all the user-supplied data could be in a separate table, but that would only solve some of my problems. So, looks like I'm back to PHP logic. I considered that I could store a simple array of required/user/bb/html/etc field names to which I could check against when building the form from the mysql data, but my hope is that someone else has tackled something like this in the past, and can offer some advice... TIA Justin French Sounds like you want to look into some of the PEAR projects. DB_DataObject knows about field types and can do required fields and such. DB_DataObject_FormBuilder can give you a form to edit fields which can be customized in *any* way you want it to be. It includes facilities for hiding fields as well as *many* others. I'm also working on DB_DataObject_FormBuilder_Frontend which will give you a whole frontend to choose tables and view / edit fields from any table. http://pear.php.net/package/DB_DataObject http://pear.php.net/package/DB_DataObject_FormBuilder -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with mail() function
Pooya Eslami wrote: Hi, I'm new to php and this newsletter. I have a form on my webpage and a php file to email it to me but the contents of the text area are not emailed to me. Can anyone help me with this? here is the code for my html and php files: html headtitleTest/title/head body form action=textareamail.php method=POST Comments: /br textarea rows=10 cols=50 name=TextArea/textarea /br input type=reset value=Clear input type=submit value=Submit /form /body /html ?php if ($TextArea=) { echo You have to fill out the entire form, go back and try again.; } else { $to = [EMAIL PROTECTED]; $from = From-Test; $subject = Subject-Test; $message = $TextArea; $message=$_POST[TextArea]; mail($to, $subject, $message,From: $from); echo Thankyou; } ? A better way (imo) is to do it as javascript and pop up a window with the message. No server-side processing is then needed until a successful message is submitted. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: auto forms from mysql database
On Tuesday, February 3, 2004, at 12:19 PM, Justin Patrin wrote: Sounds like you want to look into some of the PEAR projects. DB_DataObject knows about field types and can do required fields and such. DB_DataObject_FormBuilder can give you a form to edit fields which can be customized in *any* way you want it to be. It includes facilities for hiding fields as well as *many* others. I'm also working on DB_DataObject_FormBuilder_Frontend which will give you a whole frontend to choose tables and view / edit fields from any table. http://pear.php.net/package/DB_DataObject http://pear.php.net/package/DB_DataObject_FormBuilder They DO sound like what I want, and I've been looking at the above already, but I don't want the overhead or requirements of Pear. This will end up as a distro, and adding pear to the equation is far from desirable. Thanks anyway! Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] auto forms from mysql database
On Tue, 3 Feb 2004, Justin French wrote: So, looks like I'm back to PHP logic. I considered that I could store a simple array of required/etc field names to which I could check against when building the form from the mysql data, but my hope is that someone else has tackled something like this in the past, and can offer some advice... I think your best bet may be to design some sort of object that defines these tables/forms, that can be extended for each table/form or that contains the definition and can be serialized somewhere... Doing it that way would facilitate changing the underlying data source if necessary, and it seems like a logical architecture. The idea of autonomous database form creation is interesting, and your naming convention ideas are novel, but I have the same issue that you apparently do with that, it could come back to haunt you down the road.. Design the object well and it could validate the data automatically or contain other non-database data such as form headings, help text, etc. Also hooking this into some kind of form class (I like PEAR's HTML_QuickForm) may help speed things along... -- Kelly Hallman // Ultrafancy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] auto forms from mysql database
Kelly Hallman wrote: On Tue, 3 Feb 2004, Justin French wrote: So, looks like I'm back to PHP logic. I considered that I could store a simple array of required/etc field names to which I could check against when building the form from the mysql data, but my hope is that someone else has tackled something like this in the past, and can offer some advice... I think your best bet may be to design some sort of object that defines these tables/forms, that can be extended for each table/form or that contains the definition and can be serialized somewhere... Doing it that way would facilitate changing the underlying data source if necessary, and it seems like a logical architecture. The idea of autonomous database form creation is interesting, and your naming convention ideas are novel, but I have the same issue that you apparently do with that, it could come back to haunt you down the road.. Design the object well and it could validate the data automatically or contain other non-database data such as form headings, help text, etc. Also hooking this into some kind of form class (I like PEAR's HTML_QuickForm) may help speed things along... Which is what DB_DataObject_FormBuilder does. :-) -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: auto forms from mysql database
Justin French wrote: On Tuesday, February 3, 2004, at 12:19 PM, Justin Patrin wrote: Sounds like you want to look into some of the PEAR projects. DB_DataObject knows about field types and can do required fields and such. DB_DataObject_FormBuilder can give you a form to edit fields which can be customized in *any* way you want it to be. It includes facilities for hiding fields as well as *many* others. I'm also working on DB_DataObject_FormBuilder_Frontend which will give you a whole frontend to choose tables and view / edit fields from any table. http://pear.php.net/package/DB_DataObject http://pear.php.net/package/DB_DataObject_FormBuilder They DO sound like what I want, and I've been looking at the above already, but I don't want the overhead or requirements of Pear. This will end up as a distro, and adding pear to the equation is far from desirable. Thanks anyway! Justin French What overhead and requirements? It doesn't take that much to load PEAR (mod_php will hold 'compiled' versions in memory, too) and I don't see the requirements as much either. A few hundred K of files (not all of which will be loaded at any given time) for a good framework, unified error handling, and lots of functionality that you don't have to re-invent is well worth it. -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about dates
I just need a confirmation, when the getdate() function is invoked inside a PHP script, the date returned will be the server hosting the pages' date and not the client requesting the page, right? or am i wrong in my assumption? Thanks guys.
Re: [PHP] Question about dates
Renan G. Galang wrote: I just need a confirmation, when the getdate() function is invoked inside a PHP script, the date returned will be the server hosting the pages' date and not the client requesting the page, right? or am i wrong in my assumption? Thanks guys. Correct. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Stats] PHP Net List: January 2004
Bill Doerrfeld wrote: snip Top 20 Contributors by Number of Posts -- Richard Davey 80 John Nichel 75 John W. Holmes 73 Jason Wong 68 Chris Shiflett 66 Ryan A 61 Freedomware 60 Jay Blanchard 51 Ben Ramsey 50 Stuart 49 Raditha Dissanayake 41 Matt Matijevich 39 daniel 38 memoimyself 37 Marek Kilimajer 37 DvDmanDT35 CPT John W. Holmes 30 Radwan Aladdin 30 Tom Rogers 29 Justin Patrin 29 Great, now my wife has physical proof to back up her claim that I spend too much time posting to mailing lists. ;) -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Retrieve specific data from MySQL
Hello, I have a basic question I can't figure out. My site lets people enter in their information... I now want to be able for a user to search the database. For example, enter in firstname or lastname in a text box, hit submit, and have the results returned. How do I write this in PHP? I've tried lots of twists on SELECT * FROM table WHERE lastname=$lastname... but can't get it to work... any help greatly appreciated, thanks, Hedges -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about dates
Renan G. Galang wrote: I just need a confirmation, when the getdate() function is invoked inside a PHP script, the date returned will be the server hosting the pages' date and not the client requesting the page, right? or am i wrong in my assumption? Thanks guys. Yes, you are not wrong in your assumption. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The 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] Retrieve specific data from MySQL
Matt Hedges wrote: Hello, I have a basic question I can't figure out. My site lets people enter in their information... I now want to be able for a user to search the database. For example, enter in firstname or lastname in a text box, hit submit, and have the results returned. How do I write this in PHP? I've tried lots of twists on SELECT * FROM table WHERE lastname=$lastname... but can't get it to work... any help greatly appreciated, thanks, Hedges How 'bout SELECT * FROM dbName.tableName WHERE lastname LIKE '%$lastname%' -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retrieve specific data from MySQL
$lastname = (string) $_POST['lastname']; // probably want to do some sanity checks on the input // e.g. watch out for names like O'Reilly $lastname = str_replace(','',$lastname); // the contents of variable must be inside single quotes $sql = SELECT * FROM table WHERE lastname='$lastname'; // or try the SQL 'LIKE' syntax $sql = SELECT * FROM table WHERE lastname LIKE '$lastname'; // may be use a wildcard $sql = SELECT * FROM table WHERE lastname LIKE '$lastname%'; Matt Hedges wrote: Hello, I have a basic question I can't figure out. My site lets people enter in their information... I now want to be able for a user to search the database. For example, enter in firstname or lastname in a text box, hit submit, and have the results returned. How do I write this in PHP? I've tried lots of twists on SELECT * FROM table WHERE lastname=$lastname... but can't get it to work... any help greatly appreciated, thanks, Hedges -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Retrieve specific data from MySQL
Thank you for your replies... I have it showing the last name... but what I can't figure out is how for it to reference to the whole entry. So, for example, when someone enters to search for the last name Smith, all the Smiths are pulled up, sorted by first name and linked by id. How do I do this? thank you very much, Hedges Now, How do I get Matt Hedges [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I have a basic question I can't figure out. My site lets people enter in their information... I now want to be able for a user to search the database. For example, enter in firstname or lastname in a text box, hit submit, and have the results returned. How do I write this in PHP? I've tried lots of twists on SELECT * FROM table WHERE lastname=$lastname... but can't get it to work... any help greatly appreciated, thanks, Hedges -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Retrieve specific data from MySQL
Matt Hedges wrote: Thank you for your replies... I have it showing the last name... but what I can't figure out is how for it to reference to the whole entry. So, for example, when someone enters to search for the last name Smith, all the Smiths are pulled up, sorted by first name and linked by id. How do I do this? thank you very much, Hedges SELECT * FROM dbName.tableName WHERE lastname LIKE '%$lastname%' ORDER BY firstname And look here for how to execute your query... http://us4.php.net/manual/en/function.mysql-query.php And here on how to loop thru the result set... http://us4.php.net/manual/en/function.mysql-fetch-array.php -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Retrieve specific data from MySQL
its not clear to me what exactly you are asking but it sounds like you would do well to read up on some MySQL syntax - specifically 'JOIN' syntax and 'ORDER BY' syntax. --- if you mean 'Smith' should match 'Smith', 'Smiths' 'Smithson' then use the wildcard syntax (e.g LIKE '%Smith%' ) shown in the previous 2 emails. Matt Hedges wrote: Thank you for your replies... I have it showing the last name... but what I can't figure out is how for it to reference to the whole entry. So, for example, when someone enters to search for the last name Smith, all the Smiths are pulled up, sorted by first name and linked by id. How do I do this? thank you very much, Hedges Now, How do I get Matt Hedges [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I have a basic question I can't figure out. My site lets people enter in their information... I now want to be able for a user to search the database. For example, enter in firstname or lastname in a text box, hit submit, and have the results returned. How do I write this in PHP? I've tried lots of twists on SELECT * FROM table WHERE lastname=$lastname... but can't get it to work... any help greatly appreciated, thanks, Hedges -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL Query Not Kosher?
Hi all: I am trying to get this to work, but always get the same error: that the resource in mysql_affected_rows() is not valid. Anyone see why this would be? All variables have been tested for accuracy. $query = mysql_query(UPDATE stories SET status='approved' WHERE story_id={$id}); if(mysql_affected_rows($query) == 1) { print(Your approval of \$title\ was successful. If this user entered an email address, they have been sent a notice of its approval and publication on the site.); } else { print(The approval of \$title\ was not successful. Please check with the site administrator for assistance.); } The above SQL statement works perfectly with phpMyAdmin (and, oddly enough, works with the above script, yet the Warning is produced and the 'not successful' message is displayed) Any thoughts are appreciated! Mr. Austin
Re: [PHP] SQL Query Not Kosher?
That would explain why it displays the second message saying it was not successful. But why then does it still display this warning? Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource in c:\apache\htdocs\admin\stories.php on line 112 Mr. Austin - Original Message - From: Jochem Maas [EMAIL PROTECTED] To: Mr. Austin [EMAIL PROTECTED] Sent: Monday, February 02, 2004 10:41 PM Subject: Re: [PHP] SQL Query Not Kosher? from the php function manual: quote Note: When using UPDATE, MySQL will not update columns where the new value is the same as the old value. This creates the possibility that mysql_affected_rows() may not actually equal the number of rows matched, only the number of rows that were literally affected by the query. /quote http://nl2.php.net/mysql_affected_rows Mr. Austin wrote: Hi all: I am trying to get this to work, but always get the same error: that the resource in mysql_affected_rows() is not valid. Anyone see why this would be? All variables have been tested for accuracy. $query = mysql_query(UPDATE stories SET status='approved' WHERE story_id={$id}); if(mysql_affected_rows($query) == 1) { print(Your approval of \$title\ was successful. If this user entered an email address, they have been sent a notice of its approval and publication on the site.); } else { print(The approval of \$title\ was not successful. Please check with the site administrator for assistance.); } The above SQL statement works perfectly with phpMyAdmin (and, oddly enough, works with the above script, yet the Warning is produced and the 'not successful' message is displayed) Any thoughts are appreciated! Mr. Austin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Retrieve specific data from MySQL
Thanks, ya'll! Got it working. Matt Hedges [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I have a basic question I can't figure out. My site lets people enter in their information... I now want to be able for a user to search the database. For example, enter in firstname or lastname in a text box, hit submit, and have the results returned. How do I write this in PHP? I've tried lots of twists on SELECT * FROM table WHERE lastname=$lastname... but can't get it to work... any help greatly appreciated, thanks, Hedges -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: looking for a way to manually free memory in the middle of a script
On Feb 2, 2004, at 7:15 PM, Justin Patrin wrote: Kumar McMillan wrote: If this does happen to be a GD or PHP memory leak, I would suggest writing a driver script which calls a sub-script which does the processing. Have the driver keep track of all of the files and hand one (or some number) to the processor, which processes them. Use system() to call the processor. ahhh... works so much smoother. did a little switch with getopt() and used the same file as the subscript too. after doing this though I can see the memory explosion happening on the same image files so I take it there is something up with those files and not a memory leak in imagecreatefromjpg() when called repeatedly. Either way, calling a separate process allowed me to isolate the problem files and get on with the show. thanks, Kumar -- paperCrane Justin Patrin -- 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] [Stats] PHP Net List: January 2004
A late burs in the last week got me in. :-) John Nichel wrote: Bill Doerrfeld wrote: snip Top 20 Contributors by Number of Posts -- Richard Davey 80 John Nichel 75 John W. Holmes 73 Jason Wong 68 Chris Shiflett 66 Ryan A 61 Freedomware 60 Jay Blanchard 51 Ben Ramsey 50 Stuart 49 Raditha Dissanayake 41 -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Selling PHP Code? PHP Careers?
Hi PHP list, I seem to have a knack for really powerful, creative PHP code. With a little effort, I have yet to find any real limitations I cannot overcome with PHP/MySQL/PostgreSQL. Not that there aren't any, just that almost (emphasis on almost) anything web related, I can do. I'm pretty confident I could develop things as complex as Amazon.com and eBay and perhaps even improve on them. At least that's what I like to think :) I'm not the kind of person who likes to spend years on a project. I put lots of energy, creativity, and effort in, get an amazing result, then move onto something else. That's my tendency, although I can restrain myself a bit, especially if there is significant profit for me. Creative programming is my thing. I'm pretty good at graphic design (i.e. web page layouts) too... I keep developing PHP-related ideas I want to pursue. Some of them are fully implemented, others partially, and many not at all. Already I've developed a powerful fuzzy search system that most programmers find very impressive. Others projects go all up and down the spectrum of possibilities. I'm writing this to ask the collective advice of the php mailing list. As it stands, I'm a college student and working part-time on PHP development in Vancouver, Washington, USA. I've had excellent raises, now making over 60% more since September, but I'm probably not going to go much further in this small company. I'm thinking about other options - maybe self employment or going in with a business partner - or perhaps some more clear career paths. Does anyone have suggestions for me? I'm especially interested in anyone self-employed or working with a business partner - something I'm seriously considering - or in some kind of start up company. What are your thoughts and feelings? Do you like it? Feel free to reply off-list if you think this topic is off-topic and/or you don't want to blast your information to the whole world. Thanks, Galen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Re: [PHP] Oracle + PHP
Ok, thanks I will try it. Michael Mauch wrote: Luis Moran Ochoa wrote: ORACLE_SID=OWEB ;export ORACLE_SID; ORACLE_HOME=/usr/oracle/product; export ORACLE_HOME; TNS_ADMIN=/usr/oracle/product/network/admin; export TNS_ADMIN; ORACLE_BASE=/usr/oracle; export ORACLE_BASE; ORA_NLS33=/usr/oracle/product/ocommon/nls/admin/data; export ORA_NLS33; ORA_NLS=/usr/oracle/product/ocommon/nls/admin/data; export ORA_NLS; NLS_LANG=spanish_spain.we8dec; export NLS_LANG; TNS_ADMIN=/usr/oracle/product/network/admin; export TNS_ADMIN; CLASSPATH=:/usr/local/jre:/usr/oracle/product/jdbc/lib/classes111.zip: export CLASSPATH; LD_LIBRARY_PATH=/usr/oracle/product/lib:/usr/oracle/product/jdbc/lib: export LD_LIBRARY_PATH Perhaps some variables are set in the start script, but not in your root shell. Put a export /tmp/apache-start in the start script to see which variables are set. Boot, move /tmp/apache-start to /tmp/apache-boot, stop apache, start apache from your root shell. diff -u /tmp/apache-boot /tmp/apache-start will show the differences. Or try to unset the locale variables in the start script: unset LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION LC_ALL Some parts of Apache/Oracle/whatever-else apparently has trouble with locales. Regards... Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php