php-general Digest 27 Mar 2007 11:27:28 -0000 Issue 4700
php-general Digest 27 Mar 2007 11:27:28 - Issue 4700 Topics (messages 251432 through 251443): Re: Performance: While or For loop 251432 by: Jake Gardner 251434 by: Travis Doherty 251437 by: Tijnema ! short open tags not working even if enabled - lighttpd + fastcgi 251433 by: Matt Arnilo S. Baluyos (Mailing Lists) 251435 by: Tim 251438 by: Tijnema ! 251439 by: Colin Guthrie 251441 by: Jochem Maas Re: PHP newbie question on xslt 251436 by: Miguel J. Jiménez Smarty Website down? 251440 by: Mario Guenterberg 251443 by: itoctopus Re: Optimization of all mysql databases on a server 251442 by: Jochem Maas 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: php-general@lists.php.net -- ---BeginMessage--- He said if you run the /script/ itself 1000 times, not a loop with 1000 iterations. This is quite possible; I am fairly certain there are websites out there that get accessed well over 1000 times a minute, yes? So every minute, that website is saving a total of 2.6 seconds to do... whatever it is websites do in their free time. In reality, scripts rarely get executed once and then are deleted; they are used repetitively, and the more a script is used, the more significant the gain. Claiming to look practically on a small gain /within one execution of a script/ is impractical in itself. On 3/26/07, Richard Lynch [EMAIL PROTECTED] wrote: On Sat, March 24, 2007 4:52 am, Tijnema ! wrote: That means that at 1000 iterations, you are saving how much time? .00026 seconds? .4 seconds? Puhleaze. Well, if you execute this script 1000 times, you would get a difference of 2.6 seconds? But if every microseconds counts for your script, then you should now about this. No. Re-read the benchmards. At 1000 iterations you're looking at .000xx seconds. At a MILLION iterations, you're looking at 0.xx seconds At a TEN MILLION iterations, you've broken the 1-second barrier. How many PHP scripts do a for or while loop 10 million iterations? xx is either 26 or 4, depending on whose benchmarks you believe. Running tests with 10 million iterations to benchmark is great for removing overhead margin of error. It's also great to look at exactly how many times you'd have to do something to make a significant savings. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- Jake Gardner wrote: He said if you run the /script/ itself 1000 times, not a loop with 1000 iterations. This is quite possible; I am fairly certain there are websites out there that get accessed well over 1000 times a minute, yes? So every minute, that website is saving a total of 2.6 seconds to do... whatever it is websites do in their free time. In reality, scripts rarely get executed once and then are deleted; they are used repetitively, and the more a script is used, the more significant the gain. Claiming to look practically on a small gain /within one execution of a script/ is impractical in itself. I still wouldn't go around telling people to re-write all of their code to use for loops instead of while loops (or whatever was faster for whatever architecture.) Keep in mind that .000xx seconds in performance improvement certainly does make a difference on a site that is accessed millions of times a day, however, one bug caused by writing code that reads poorly instead of writing clean code can cost a *lot* more in the end. - Use what reads easier when deciding if a for/while loop is best. - Profile your code and find the right places to optimize. Optimizing code that takes .0001 seconds to run down to .1 seconds is great, 10x improvement! Who cares. Find the chunk that takes 0.5 seconds to run and optimize that to 0.05 seconds. 10x improvement still, except that this time it actually makes a practical difference. Travis Doherty ---End Message--- ---BeginMessage--- On 3/27/07, Travis Doherty [EMAIL PROTECTED] wrote: Jake Gardner wrote: He said if you run the /script/ itself 1000 times, not a loop with 1000 iterations. This is quite possible; I am fairly certain there are websites out there that get accessed well over 1000 times a minute, yes? So every minute, that website is saving a total of 2.6 seconds to do... whatever it is websites do in their free time. In reality, scripts rarely get executed once and then are deleted; they are used repetitively, and the more a script is used, the more significant the gain. Claiming to look practically on a small
Re: [PHP] Performance: While or For loop
On 3/27/07, Travis Doherty [EMAIL PROTECTED] wrote: Jake Gardner wrote: He said if you run the /script/ itself 1000 times, not a loop with 1000 iterations. This is quite possible; I am fairly certain there are websites out there that get accessed well over 1000 times a minute, yes? So every minute, that website is saving a total of 2.6 seconds to do... whatever it is websites do in their free time. In reality, scripts rarely get executed once and then are deleted; they are used repetitively, and the more a script is used, the more significant the gain. Claiming to look practically on a small gain /within one execution of a script/ is impractical in itself. I still wouldn't go around telling people to re-write all of their code to use for loops instead of while loops (or whatever was faster for whatever architecture.) While loops came out faster :) Keep in mind that .000xx seconds in performance improvement certainly does make a difference on a site that is accessed millions of times a day, however, one bug caused by writing code that reads poorly instead of writing clean code can cost a *lot* more in the end. - Use what reads easier when deciding if a for/while loop is best. - Profile your code and find the right places to optimize. Optimizing code that takes .0001 seconds to run down to .1 seconds is great, 10x improvement! Who cares. Find the chunk that takes 0.5 seconds to run and optimize that to 0.05 seconds. 10x improvement still, except that this time it actually makes a practical difference. Travis Doherty I'm not telling people to rewrite the code, but if you need to choose, and both are good for the job, choose while :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] short open tags not working even if enabled - lighttpd + fastcgi
On 3/27/07, Matt Arnilo S. Baluyos (Mailing Lists) [EMAIL PROTECTED] wrote: Hello everyone, I have a working lighttpd + fastcgi + PHP + eaccelerator installation. I have also enabled short tags on the /usr/local/lib/php.ini but I'm having problems with PHP not escaping the short tags. To better illustrate, my phpinfo() file can be accessed at http://202.171.164.70/phpinfo.php - if you notice short_open_tag is set to On. But when you access a PHP page at http://202.171.164.70/admin/login.php and try to view the source, the short open tag is not escaped. Any reason why this isn't working as expected? Regards, Matt You also use XML in your page, and thereby i would NOT recommend using short tags. as xml tags also start with ? Better learn to start PHP tags with ?php and disable the short tags. This way i cannot ever give problems with the ?xml tags.s Tijnema -- Stand before it and there is no beginning. Follow it and there is no end. Stay with the ancient Tao, Move with the present. -- 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] Re: short open tags not working even if enabled - lighttpd + fastcgi
Matt Arnilo S. Baluyos (Mailing Lists) wrote: Hello everyone, I have a working lighttpd + fastcgi + PHP + eaccelerator installation. I have also enabled short tags on the /usr/local/lib/php.ini but I'm having problems with PHP not escaping the short tags. To better illustrate, my phpinfo() file can be accessed at http://202.171.164.70/phpinfo.php - if you notice short_open_tag is set to On. But when you access a PHP page at http://202.171.164.70/admin/login.php and try to view the source, the short open tag is not escaped. Any reason why this isn't working as expected? If I've understood correctly, short tags are the spawn of the devil and will be purged from this earth when PHP 6 reigns supreme ;) Col. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Smarty Website down?
Hi... I try to connect in the last hours and the results are timeouts. Greetings Mario -- - | havelsoft.com - Ihr Service Partner für Open Source | | Tel: 033876-21 966 | | Notruf: 0173-277 33 60 | | http://www.havelsoft.com| | | | Inhaber: Mario Günterberg | | Mützlitzer Strasse 19 | | 14715 Märkisch Luch | - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] short open tags not working even if enabled - lighttpd + fastcgi
Matt Arnilo S. Baluyos (Mailing Lists) wrote: Hello everyone, I have a working lighttpd + fastcgi + PHP + eaccelerator installation. I have also enabled short tags on the /usr/local/lib/php.ini but I'm having problems with PHP not escaping the short tags. either you stopped using short php tags, there is no problem or you fixed it somehow. no? To better illustrate, my phpinfo() file can be accessed at http://202.171.164.70/phpinfo.php - if you notice short_open_tag is set to On. But when you access a PHP page at http://202.171.164.70/admin/login.php and try to view the source, the short open tag is not escaped. what does 'is not escaped' mean? Any reason why this isn't working as expected? Regards, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Optimization of all mysql databases on a server
Tijnema ! wrote: On 3/26/07, Chris [EMAIL PROTECTED] wrote: itoctopus wrote: The purpose of this script is to optimize all associated tables in all databases on a mysql server. This script is working great, you can put in a CRON and run it every day. Feel free to throw in your 2 cents! It's going to time out if you have any large databases or tables. php will not timeout on the commandline unless you actually specify a timeout - unlike php as used as a webserver SAPI. What about set_time_limit(99)?? RTFM: set_time_limit(0); although it's not needed. Also a much easier option is to run mysqlcheck -o ... indeed - use the right tool for the job. That's true :) Tijnema -- Postgresql php tutorials http://www.designmagick.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] Re: Smarty Website down?
looks ok now -- itoctopus - http://www.itoctopus.com Mario Guenterberg [EMAIL PROTECTED] wrote in message news:20070327092337.GA24779@/bin/dnsdomainname... Hi... I try to connect in the last hours and the results are timeouts. Greetings Mario -- - | havelsoft.com - Ihr Service Partner für Open Source | | Tel: 033876-21 966 | | Notruf: 0173-277 33 60 | | http://www.havelsoft.com| | | | Inhaber: Mario Günterberg | | Mützlitzer Strasse 19 | | 14715 Märkisch Luch | - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] short open tags not working even if enabled - lighttpd + fastcgi
- Original Message - From: Tijnema ! [EMAIL PROTECTED] On 3/27/07, Matt Arnilo S. Baluyos (Mailing Lists) [EMAIL PROTECTED] wrote: Hello everyone, I have a working lighttpd + fastcgi + PHP + eaccelerator installation. I have also enabled short tags on the /usr/local/lib/php.ini but I'm having problems with PHP not escaping the short tags. To better illustrate, my phpinfo() file can be accessed at http://202.171.164.70/phpinfo.php - if you notice short_open_tag is set to On. But when you access a PHP page at http://202.171.164.70/admin/login.php and try to view the source, the short open tag is not escaped. Any reason why this isn't working as expected? Regards, Matt You also use XML in your page, and thereby i would NOT recommend using short tags. as xml tags also start with ? Indeed, ?xxx is called a 'Processing Instruction' (PI) and the ? should be followed by some identifier indicating the nature of that PI, the identifier XML, in any combination of upper and lower case letter is reserved. So, contrary to other means of escaping out of HTML mode, such as ASPs % tags, the ?php prefix is perfectly valid. A short tag, though, a simple ? is invalid since it lacks the identifier of the expected recipient of that PI. Though it doesn't work that way, PIs would in principle, allow several interpreters each to handle a section of an XML file so if you could chain interpreters or it there were a master PI dispatcher, a single source file could mix several processors of whatever is contained within PIs, not only procedural languages such as PHP but any other kind of process. Satyam Better learn to start PHP tags with ?php and disable the short tags. This way i cannot ever give problems with the ?xml tags.s Tijnema -- Stand before it and there is no beginning. Follow it and there is no end. Stay with the ancient Tao, Move with the present. -- 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 -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.18/734 - Release Date: 26/03/2007 14:31 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Smarty Website down?
On Tue, 27 Mar 2007, Mario Guenterberg wrote: Hi... I try to connect in the last hours and the results are timeouts. Excelent connection here. -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 - Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática| '@' || 'unl.edu.ar'; Universidad Nacional| DBA, Programador, del Litoral | Administrador - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: gethostbyname () uses old DNS server
gethostbyname uses the local DNS cache, could that be the problem? -- itoctopus - http://www.itoctopus.com Kent Tong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, We have moved our DNS server from one IP to another. But on a Linux server, the PHP programs keep using the old DNS server IP. For example, for a simple php file: ? echo gethostbyname (smtp.cpttm); ? When it is run, it tries to lookup smtp.cpttm using the old DNS server (I know it using tcpdump). The new DNS server is specified in /etc/resolv.conf. If I issue ping smtp.cpttm in a command prompt, then tcpdump shows that it is accessing the new DNS server. Any idea? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Optimization of all mysql databases on a server
Agreed that mysqlcheck is much more efficient... As for the timeout thing, I rememeber we were once using wget to run php scripts (which was not the correct way). Anyway, we had a script that was repeating every 15 minutes, and eventually we discovered that by default wget has a timeout of 15 minutes, and if it reaches that timeout, it will restart the script (thinking something went wrong), very bad implementation (of wget) in my opinion. As of then, we started running CRON php scripts without using wget. -- itoctopus - http://www.itoctopus.com Jochem Maas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Tijnema ! wrote: On 3/26/07, Chris [EMAIL PROTECTED] wrote: itoctopus wrote: The purpose of this script is to optimize all associated tables in all databases on a mysql server. This script is working great, you can put in a CRON and run it every day. Feel free to throw in your 2 cents! It's going to time out if you have any large databases or tables. php will not timeout on the commandline unless you actually specify a timeout - unlike php as used as a webserver SAPI. What about set_time_limit(99)?? RTFM: set_time_limit(0); although it's not needed. Also a much easier option is to run mysqlcheck -o ... indeed - use the right tool for the job. That's true :) Tijnema -- Postgresql php tutorials http://www.designmagick.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] preview string with strlen PHP (help)
On 24 March 2007 16:28, tedd wrote: 2007. 03. 23, péntek keltezéssel 17.30-kor Dwayne Heronimo ezt írta: YES this works thank nemeth: your welcome but please call me Zoltán ;) (my first name is Zoltán. in Hungary we write names the opposite order than anywhere else ;) so that's why my mailbox is set to display 'Németh Zoltán' but I sign my mails as 'Zoltán Németh' showing that my first name is Zoltán and last name is Németh :) ) greets Zoltán Németh Zoltán: You see, people are looking at your email address and making the assumption that your first name is Nemeth. Now, you have a choice: a) don't change you email and continue receiving email thinking Nemeth is your first name; b) or change your email address. As us USA types are told, we all have to adapt to global conventions. :-) ... which presumably explains why the (US-owned) company my wife works for has email addresses in the form [EMAIL PROTECTED] Would you be equally confused by these? Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Anyone TrackPro 2 or Something Similar?
Ave, I was looking to incorporate a PHP based web traffic analysis script for one of my website. Nothing too fancy or exceptional, but something like TrackPro from Curve2.com ... I use their scripts before and I liked them. Unfortunately they have a ³temporarily closed² on their website for download trackpro. I was wondering if someone has a the trackpro script from before they closed it down. If not ... Anything similar would do. Thanks. ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely²
Re: [PHP] Anyone TrackPro 2 or Something Similar?
On 3/27/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote: Ave, I was looking to incorporate a PHP based web traffic analysis script for one of my website. Nothing too fancy or exceptional, but something like TrackPro from Curve2.com ... I use their scripts before and I liked them. Unfortunately they have a ³temporarily closed² on their website for download trackpro. I was wondering if someone has a the trackpro script from before they closed it down. If not ... Anything similar would do. Thanks. With the use of google, i found this: http://freescripts.filehungry.com/product/php/web_traffic_analysis/andy_s_site_stats It does exactly the same as TrackPro as far as i'm aware. Tijnema ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone TrackPro 2 or Something Similar?
Ave, Will give it a try!! Thanks! On 3/27/07 9:37 AM, Tijnema ! [EMAIL PROTECTED] wrote: On 3/27/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote: Ave, I was looking to incorporate a PHP based web traffic analysis script for one of my website. Nothing too fancy or exceptional, but something like TrackPro from Curve2.com ... I use their scripts before and I liked them. Unfortunately they have a ³temporarily closed² on their website for download trackpro. I was wondering if someone has a the trackpro script from before they closed it down. If not ... Anything similar would do. Thanks. With the use of google, i found this: http://freescripts.filehungry.com/product/php/web_traffic_analysis/andy_s_site _stats It does exactly the same as TrackPro as far as i'm aware. Tijnema ~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: [EMAIL PROTECTED] ³I morti non sono piu soli ... The dead are no longer lonely² -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP newbie question on xslt
Miguel J. Jiménez wrote: // Example 2520. Creating an XSLTProcessor ?php $xml_filename = collection.xml; $xsl_filename= collection.xsl; $doc = new DOMDocument(); $xsl = new XSLTProcessor(); $doc-load($xsl_filename); $xsl-importStyleSheet($doc); $doc-load($xml_filename); echo $xsl-transformToXML($doc); ? (where I have added the two filenames, and copied the files collection.x?l from the manual). When I run PHP I get: [EMAIL PROTECTED] Test]# php ex2520.php // Example 2520. Creating an XSLTProcessor Segmentation fault I'm running the program under Fedora-6 Linux with the latest versions of all programs. Is there something I should have included, to get the program to run? Any advice or suggestions gratefully received. Try not to load both xml and xsl in the same $doc variable... use one for the xsl and another for the xml. I think you are destroying the dom for the xsl before the transform... Thanks for the response. I'm sure you are right. However, I wasn't trying anything really - I just copied (electronically) Example 2520 from http://www.php.net/manual/en/function.xsl-xsltprocessor-construct.php and ran it. Is there in fact some confusion in this manual between different versions of PHP, or at least of PHP/XSLT? I notice that I get the same (bad) result if I run - // Example 2526. Transforming to a string ?php // Load the XML source $xml = new DOMDocument; $xml-load('collection.xml'); $xsl = new DOMDocument; $xsl-load('collection.xsl'); // Configure the transformer $proc = new XSLTProcessor; $proc-importStyleSheet($xsl); // attach the xsl rules echo $proc-transformToXML($xml); ? - from http://www.php.net/manual/en/function.xsl-xsltprocessor-transform-to-xml.php - [EMAIL PROTECTED] Test]# php ex2526.php // Example 2526. Transforming to a string Segmentation fault - Is there any way of debugging a PHP program like this? (I tried running strace php ex2526.php but this didn't enlighten me.) -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] converting video formats
Bruce Gilbert escribió: Can someoune point me in the right direction as to how (if possible) to convert a video format uploaded to a server to a flash format (.flv) no matter what the orginal format is? thanks I recommend you use FFMPEG ... It can convert almost any video type to FLV -- Miguel J. Jiménez Área de Internet/XSL/PHP [EMAIL PROTECTED] ISOTROL Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta. Parque Tecnológico Cartuja '93, 41092 Sevilla. Teléfono: 955 036 800 - Fax: 955 036 849 http://www.isotrol.com Killing is often a part of life. What's hypocritical is to condemn, and then make allowances when the situation suits. Utu-Noranti Pralatong (Farscape 4x17 - A Constellation Of Doubt) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Session variable
Hi, I have retrieved 4 values from database. Out of which 3 are displayed on the same page and one variable, which is email address, needs to be carried to the next page through a hyper link, the next page is actually a web form. I can do this by either transferring that variable through query string or through session. Now the next page which is a web form is connected to a file that sends email using php email functionality. The problem I am having is just sending this $email variable from page one to the web form. Once it reaches the web form, I need to again pass it to the file that has php email functionality. How to send the variable across these pages. I tried: On Page 1: ? $query=SELECT val1, val2, val3, email FROM table WHERE no= '$no'; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $1=mysql_result($result,$i,1); $2=mysql_result($result,$i,2); $3=mysql_result($result,$i,3); $email=mysql_result($result,$i,email); session_start(); session_register (tamma); $HTTP_SESSION_VARS [tamma] = $email; ? On the webform: ? $HTTP_SESSION_VARS [email] = $email; ? on the php email page it's like this: ? $name = $_REQUEST['name'] ; $emailid = $_REQUEST['emailid'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; $email = $_REQUEST['email'] ; mail( $email, $name, $message, From: $emailid ); header( Location: thankYouContact.php ); ? Please advice a work around for this if I am doing it wrong. I know I am. Chris -- View this message in context: http://www.nabble.com/PHP-Session-variable-tf3473378.html#a9693267 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Session variable
On Mar 27, 2007, at 9:17 AM, Chris Carter wrote: Hi, I have retrieved 4 values from database. Out of which 3 are displayed on the same page and one variable, which is email address, needs to be carried to the next page through a hyper link, the next page is actually a web form. I can do this by either transferring that variable through query string or through session. Now the next page which is a web form is connected to a file that sends email using php email functionality. The problem I am having is just sending this $email variable from page one to the web form. Once it reaches the web form, I need to again pass it to the file that has php email functionality. How to send the variable across these pages. I tried: On Page 1: ? $query=SELECT val1, val2, val3, email FROM table WHERE no= '$no'; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $1=mysql_result($result,$i,1); $2=mysql_result($result,$i,2); $3=mysql_result($result,$i,3); $email=mysql_result($result,$i,email); session_start(); session_register (tamma); $HTTP_SESSION_VARS [tamma] = $email; ? On the webform: ? $HTTP_SESSION_VARS [email] = $email; ? on the php email page it's like this: ? $name = $_REQUEST['name'] ; $emailid = $_REQUEST['emailid'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; $email = $_REQUEST['email'] ; mail( $email, $name, $message, From: $emailid ); header( Location: thankYouContact.php ); ? Please advice a work around for this if I am doing it wrong. I know I am. On the page that generates your webform: input name=email type=text value=?php $HTTP_SESSION_VARS ['tamma'] ? Also, changing to using the $_SESSION superglobal array instead of $HTTP_SESSION_VARS will save you a bit of typing. erik jones [EMAIL PROTECTED] software developer 615-296-0838 emma(r)
Re: [PHP] PHP Session variable
Chris Carter wrote: session_start(); session_register (tamma); $HTTP_SESSION_VARS [tamma] = $email; Use $_SESSION. HTTP_SESSION_VARS is deprecated and hasn't been used since PHP 4.0.6 (or rather, shouldn't have been) You don't need session_register(). On the webform: ? $HTTP_SESSION_VARS [email] = $email; ? This is *setting* the session value. You want to READ it here. You could do it like this: Page 1: session_start(); $_SESSION['tamma'] = $email; Mail Form: session_start(); echo 'input type=hidden name=email value=' . $_SESSION['tamma'] . ''; Then it will come into your mail PHP script as a standard REQUEST value. Or of course, you could skip 'hiding' it on the mail form completely, and just access it directly in the mail script: session_start(); $email = $_SESSION['tamma']; Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk Never trust a computer you can't throw out of a window -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Session variable
Em Terça 27 Março 2007 11:17, Chris Carter escreveu: Hi, I have retrieved 4 values from database. Out of which 3 are displayed on the same page and one variable, which is email address, needs to be carried to the next page through a hyper link, the next page is actually a web form. I can do this by either transferring that variable through query string or through session. Now the next page which is a web form is connected to a file that sends email using php email functionality. The problem I am having is just sending this $email variable from page one to the web form. Once it reaches the web form, I need to again pass it to the file that has php email functionality. How to send the variable across these pages. I tried: On Page 1: ? $query=SELECT val1, val2, val3, email FROM table WHERE no= '$no'; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $1=mysql_result($result,$i,1); $2=mysql_result($result,$i,2); $3=mysql_result($result,$i,3); $email=mysql_result($result,$i,email); session_start(); session_register (tamma); $HTTP_SESSION_VARS [tamma] = $email; ? On the webform: ? $HTTP_SESSION_VARS [email] = $email; ? on the php email page it's like this: ? $name = $_REQUEST['name'] ; $emailid = $_REQUEST['emailid'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; $email = $_REQUEST['email'] ; mail( $email, $name, $message, From: $emailid ); header( Location: thankYouContact.php ); ? Please advice a work around for this if I am doing it wrong. I know I am. Chris -- View this message in context: http://www.nabble.com/PHP-Session-variable-tf3473378.html#a9693267 Sent from the PHP - General mailing list archive at Nabble.com. I would try $_SESSION, $_GET and $_POST instead $_HTTP_SESSION_VARS and $_REQUEST... best regards, -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: A young girl once committed suicide because her mother refused her a new bonnet. Coroner's verdict: Death from excessive spunk. -- Sacramento Daily Union, September 13, 1860 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] usage of flock
Richard Lynch wrote: On Fri, March 23, 2007 10:34 pm, Myron Turner wrote: I've never used locks in PHP, but have used them in Perl. In Perl a lock is automatically released on exit or when the locked file is closed. Is that not the same in PHP? According the the man page for the C version of flock, it too releases the lock on close and C's exit closes all streams. So, Perl is consistent with that. Just wondering for myself it this isn't the case with PHP, in case I ever want to use a lock. It is the case, just as in C or Perl, that it's SUPPOSED to shut down nicely and remove the lock... When, not if, when, something goes terribly wrong, and you manage to segfault PHP/Apache, do you want to have to remember to manually nuke the flock somehow, or do you just want to code it from the get-go to ignore locks older than X time? :-) No matter how carefully you program your locks, sooner or later, you'll have to have some meta programming about the locks to deal with an inconsistent state of locks. At least, that's been my experience so far... It is something to think about. I've never had this problem but possibly because the sites haven't been high traffic enough. Thanks, Myron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] preview string with strlen PHP (help)
At 12:54 PM +0100 3/27/07, Ford, Mike wrote: On 24 March 2007 16:28, tedd wrote: 2007. 03. 23, péntek keltezéssel 17.30-kor Dwayne Heronimo ezt írta: YES this works thank nemeth: your welcome but please call me Zoltán ;) (my first name is Zoltán. in Hungary we write names the opposite order than anywhere else ;) so that's why my mailbox is set to display 'Németh Zoltán' but I sign my mails as 'Zoltán Németh' showing that my first name is Zoltán and last name is Németh :) ) greets Zoltán Németh Zoltán: You see, people are looking at your email address and making the assumption that your first name is Nemeth. Now, you have a choice: a) don't change you email and continue receiving email thinking Nemeth is your first name; b) or change your email address. As us USA types are told, we all have to adapt to global conventions. :-) ... which presumably explains why the (US-owned) company my wife works for has email addresses in the form [EMAIL PROTECTED] Would you be equally confused by these? I'm easily confused anyway. If people want to call me sperling instead of tedd (it's better than other things I've been called) it doesn't make any difference to me and I wasn't the one complaining anyway. If a US company wants to use [EMAIL PROTECTED], then as we all know, management is always right -- so let's all change to that. Except for the companies that do it the other way -- ah, there I go being confused again. There's just no getting around it. Why can't we all just agree? Fortunately, I have other things to worry about. :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Smarty Website down?
On Tue, Mar 27, 2007 at 07:27:18AM -0500, itoctopus wrote: looks ok now The site is ok now. Thanks Mario -- -- | havelsoft.com - Ihr Service Partner fuer Open Source | | Tel: 033876-21 966 | | Notruf: 0173-277 33 60 | | http://www.havelsoft.com | | | | Inhaber: Mario Guenterberg | | Muetzlitzer Strasse 19 | | 14715 Maerkisch Luch | -- signature.asc Description: Digital signature
Re: [PHP] preview string with strlen PHP (help)
At 6:57 PM +0200 3/27/07, Tijnema ! wrote: snip As us USA types are told, we all have to adapt to global conventions. :-) ... which presumably explains why the (US-owned) company my wife works for has email addresses in the form [EMAIL PROTECTED] Would you be equally confused by these? I'm easily confused anyway. If people want to call me sperling instead of tedd (it's better than other things I've been called) it doesn't make any difference to me and I wasn't the one complaining anyway. If a US company wants to use [EMAIL PROTECTED], then as we all know, management is always right -- so let's all change to that. Except for the companies that do it the other way -- ah, there I go being confused again. There's just no getting around it. Why can't we all just agree? Fortunately, I have other things to worry about. :-) Cheers, tedd What's against using a codename? My real name isn't tijnema, i use it as a codename. It's only a forename. So it's just nearly impossible to call me wrong :) tijnema That's not your real name!?! Here all this time I thought you were some exotic programmer with all these leading-edge comments you make -- and now you just burst my bubble. As for me using a code name -- that would only confuse me further and I'd probably starting answering my own questions. Can't have that. I've used the same email address since 1994 and published it widely on numerous email list, web sites and other such publications -- it servers me well. I use spamcop.net an it does a good job of filtering spam. I would hate to start getting email under another address -- like teddsperling at gmail.com Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preview string with strlen PHP (help)
2007. 03. 27, kedd keltezéssel 18.57-kor Tijnema ! ezt írta: snip As us USA types are told, we all have to adapt to global conventions. :-) ... which presumably explains why the (US-owned) company my wife works for has email addresses in the form [EMAIL PROTECTED] Would you be equally confused by these? I'm easily confused anyway. If people want to call me sperling instead of tedd (it's better than other things I've been called) it doesn't make any difference to me and I wasn't the one complaining anyway. If a US company wants to use [EMAIL PROTECTED], then as we all know, management is always right -- so let's all change to that. Except for the companies that do it the other way -- ah, there I go being confused again. There's just no getting around it. Why can't we all just agree? Fortunately, I have other things to worry about. :-) Cheers, tedd What's against using a codename? My real name isn't tijnema, i use it as a codename. It's only a forename. So it's just nearly impossible to call me wrong :) tijnema actually I have one... I use the code name Syntax Error ;) I also write a blog in Hungarian at http://www.syntaxerror.hu/ and thus I have an e-mail address [EMAIL PROTECTED] but I thought it would be funny to talk about real syntax errors with a code name Syntax Error :D that's why I use my real name e-mail address here, which is the e-mail address I use also for work, business, everything... greets Zoltán Németh -- --- http://sperling.com http://ancientstones.com http://earthstones.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] POST + QUERY
Okay, I thought this was VERY simple, but I cannot wrap my mind around what I am doing wrong. echo $_POST['max_id']; *The echo returns the correct result *if($_POST['max_id'] ='') { *This is suppose to run the below query if $_POST['max_id'] is not blank* $max_id = $_POST['max_id']; *Sets my POST value to a variable* $info = SELECT * FROM payment_request WHERE id = '$max_id'; *Selects record from my database by the matching ID's* $result_info = mssql_query($info) or die(mssql_error()); *Puts the query results into a variable* $row_info = ifx_fetch_row($result_info); *Makes a row in an array for all the returned fields from my query* $my_info = $row_info['my_value']; input type=Text value=?php echo $my_info; ? size=20 maxlength=16 name=my_value *However, this box returns no data.* I should be using if($_POST['max_id'] ='') { and notif($_POST['max_id'] !=='') { correct? Since it is a comparative function just the = should be correct.
Re: [PHP] preview string with strlen PHP (help)
snip If a US company wants to use [EMAIL PROTECTED], then as we all know, management is always right -- so let's all change to that. Except for the companies that do it the other way -- ah, there I go being confused again. There's just no getting around it. Why can't we all just agree? Fortunately, I have other things to worry about. :-) Cheers, tedd What's against using a codename? My real name isn't tijnema, i use it as a codename. It's only a forename. So it's just nearly impossible to call me wrong :) tijnema actually I have one... I use the code name Syntax Error ;) I also write a blog in Hungarian at http://www.syntaxerror.hu/ and thus I have an e-mail address [EMAIL PROTECTED] but I thought it would be funny to talk about real syntax errors with a code name Syntax Error :D that's why I use my real name e-mail address here, which is the e-mail address I use also for work, business, everything... greets Zoltán Németh Well... Hi Syntax, Sounds little bit strange I also think we need to stop this thread now, because this is totally NOT related to PHP ;) It's way offtopic :P Best regards, Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST + QUERY
use: $_POST['max_id'] == or even better: if (empty($_POST['max_id']))
Re: [PHP] POST + QUERY
On 3/27/07, Dan Shirah [EMAIL PROTECTED] wrote: Okay, I thought this was VERY simple, but I cannot wrap my mind around what I am doing wrong. echo $_POST['max_id']; *The echo returns the correct result *if($_POST['max_id'] ='') { *This is suppose to run the below query if $_POST['max_id'] is not blank* $max_id = $_POST['max_id']; *Sets my POST value to a variable* $info = SELECT * FROM payment_request WHERE id = '$max_id'; *Selects record from my database by the matching ID's* $result_info = mssql_query($info) or die(mssql_error()); *Puts the query results into a variable* $row_info = ifx_fetch_row($result_info); *Makes a row in an array for all the returned fields from my query* $my_info = $row_info['my_value']; input type=Text value=?php echo $my_info; ? size=20 maxlength=16 name=my_value *However, this box returns no data.* I should be using if($_POST['max_id'] ='') { and notif($_POST['max_id'] !=='') { correct? Since it is a comparative function just the = should be correct You're wrong, = means you want to give the variable on the left the value on the right. This if you're using now will always return true (atleast if you don't have very buggy server). And your $_POST['max_id'] will; have the value '' Use != :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST + QUERY
Dan Shirah wrote: Okay, I thought this was VERY simple, but I cannot wrap my mind around what I am doing wrong. echo $_POST['max_id']; *The echo returns the correct result *if($_POST['max_id'] ='') { *This is suppose to run the below query if $_POST['max_id'] is not blank* $max_id = $_POST['max_id']; *Sets my POST value to a variable* $info = SELECT * FROM payment_request WHERE id = '$max_id'; *Selects record from my database by the matching ID's* $result_info = mssql_query($info) or die(mssql_error()); *Puts the query results into a variable* $row_info = ifx_fetch_row($result_info); *Makes a row in an array for all the returned fields from my query* $my_info = $row_info['my_value']; input type=Text value=?php echo $my_info; ? size=20 maxlength=16 name=my_value *However, this box returns no data.* I should be using if($_POST['max_id'] ='') { and notif($_POST['max_id'] !=='') { correct? Since it is a comparative function just the = should be correct. read this: http://php.net/operators -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST + QUERY
Em Terça 27 Março 2007 17:02, Dave Goodchild escreveu: use: $_POST['max_id'] == or even better: if (empty($_POST['max_id'])) Why not: if (!(isset($_POST[max_id))) ? -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: Around computers it is difficult to find the correct unit of time to measure progress. Some cathedrals took a century to complete. Can you imagine the grandeur and scope of a program that would take as long? -- Epigrams in Programming, ACM SIGPLAN Sept. 1982 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST + QUERY
So I was dancing all around it by trying !== and = but did not try != /??? UGH! On 3/27/07, Tijnema ! [EMAIL PROTECTED] wrote: On 3/27/07, Dan Shirah [EMAIL PROTECTED] wrote: Okay, I thought this was VERY simple, but I cannot wrap my mind around what I am doing wrong. echo $_POST['max_id']; *The echo returns the correct result *if($_POST['max_id'] ='') { *This is suppose to run the below query if $_POST['max_id'] is not blank* $max_id = $_POST['max_id']; *Sets my POST value to a variable* $info = SELECT * FROM payment_request WHERE id = '$max_id'; *Selects record from my database by the matching ID's* $result_info = mssql_query($info) or die(mssql_error()); *Puts the query results into a variable* $row_info = ifx_fetch_row($result_info); *Makes a row in an array for all the returned fields from my query* $my_info = $row_info['my_value']; input type=Text value=?php echo $my_info; ? size=20 maxlength=16 name=my_value *However, this box returns no data.* I should be using if($_POST['max_id'] ='') { and notif($_POST['max_id'] !=='') { correct? Since it is a comparative function just the = should be correct You're wrong, = means you want to give the variable on the left the value on the right. This if you're using now will always return true (atleast if you don't have very buggy server). And your $_POST['max_id'] will; have the value '' Use != :) Tijnema
Re: [PHP] POST + QUERY
Because isset will return true if the variable is set, even if it is blank. Empty will return true is the variable holds an empty string.
Re: [PHP] POST + QUERY
On 3/27/07, Davi [EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:02, Dave Goodchild escreveu: use: $_POST['max_id'] == or even better: if (empty($_POST['max_id'])) Why not: if (!(isset($_POST[max_id))) ? If form is left empty, it is set, but it's stil empty. So if you submit a form the normal way, then it should pass this, even if you leave it empty :) Tijnema -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: Around computers it is difficult to find the correct unit of time to measure progress. Some cathedrals took a century to complete. Can you imagine the grandeur and scope of a program that would take as long? -- Epigrams in Programming, ACM SIGPLAN Sept. 1982 -- 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 + QUERY
Should I use something besides mssql_fetch_row to get my result? No matter which method I use for determining if the value exists, I still get no data populated to my form. On 3/27/07, Tijnema ! [EMAIL PROTECTED] wrote: On 3/27/07, Davi [EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:02, Dave Goodchild escreveu: use: $_POST['max_id'] == or even better: if (empty($_POST['max_id'])) Why not: if (!(isset($_POST[max_id))) ? If form is left empty, it is set, but it's stil empty. So if you submit a form the normal way, then it should pass this, even if you leave it empty :) Tijnema -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: Around computers it is difficult to find the correct unit of time to measure progress. Some cathedrals took a century to complete. Can you imagine the grandeur and scope of a program that would take as long? -- Epigrams in Programming, ACM SIGPLAN Sept. 1982 -- 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 + QUERY
2007. 03. 27, kedd keltezéssel 15.58-kor Dan Shirah ezt írta: Okay, I thought this was VERY simple, but I cannot wrap my mind around what I am doing wrong. echo $_POST['max_id']; *The echo returns the correct result *if($_POST['max_id'] ='') { *This is suppose to run the below query if $_POST['max_id'] is not blank* with that line you assign a value to $_POST['max_id'] if you want to see that $_POST['max_id'] is not blank, you should use if ($_POST['max_id'] != '') { greets Zoltán Németh $max_id = $_POST['max_id']; *Sets my POST value to a variable* $info = SELECT * FROM payment_request WHERE id = '$max_id'; *Selects record from my database by the matching ID's* $result_info = mssql_query($info) or die(mssql_error()); *Puts the query results into a variable* $row_info = ifx_fetch_row($result_info); *Makes a row in an array for all the returned fields from my query* $my_info = $row_info['my_value']; input type=Text value=?php echo $my_info; ? size=20 maxlength=16 name=my_value *However, this box returns no data.* I should be using if($_POST['max_id'] ='') { and notif($_POST['max_id'] !=='') { correct? Since it is a comparative function just the = should be correct. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Language detection with PHP
2007. 03. 27, kedd keltezéssel 15.06-kor William Lovaton ezt írta: Hi there, I am trying to implement language detection with PHP for a web site I am trying to build. The idea is to take a piece of text and try to guess the language it is written in. I have two options but I'd like to know if you guys have a better idea. 1) I implemented a detector using spell checking, so if I run the text through many spell checkers the one with less errors is probably the right language for that text. It works quite well and I am pleased with it. The only thing I don't like is that loading many spell checkers is a bit of a waste, it may require a lot of CPU and a lot of memory depending on the dictionary and the number of dictionaries you load. Besides, it adds one extra module dependency (pspell). 2) The other option is implemented in PEAR and it's called Text_LanguageDetect: [] http://pear.php.net/package/Text_LanguageDetect It seems to use a very different technique called N-Gram-Based Text Categorization, I haven't tested it yet but I will very soon and see how good it works, it says it's in alpha state but I guess it doesn't requiere pspell, doesn't consume a lot of memory and it should be fast. The only thing I am worried about is how accurate is it... I'll check soon and post my comments later. 3) Insert a very good idea here, please I'd really like to hear what different alternatives all of you have for this problem. I've definitely no experience with this problem, just guessing ;) what if you build some arrays of language specific stuff and check for that. I mean you could store stuff like if it contains 's, 've, 'm many times it's probably english... I don't really know how to store those rules, and I'm not sure they are good enough (or are there good enough rules) to tell several languages apart... greets Zoltán Németh Thanks a lot, -William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST + QUERY
I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. On 3/27/07, Brad Bonkoski [EMAIL PROTECTED] wrote: Dan Shirah wrote: Should I use something besides mssql_fetch_row to get my result? No matter which method I use for determining if the value exists, I still get no data populated to my form. Why not echo out your query before executing it, so you can run it against the back end if you have it, or at least for a sanity check to make sure you are running the correct query. On 3/27/07, Tijnema ! [EMAIL PROTECTED] wrote: On 3/27/07, Davi [EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:02, Dave Goodchild escreveu: use: $_POST['max_id'] == or even better: if (empty($_POST['max_id'])) Why not: if (!(isset($_POST[max_id))) ? If form is left empty, it is set, but it's stil empty. So if you submit a form the normal way, then it should pass this, even if you leave it empty :) Tijnema -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: Around computers it is difficult to find the correct unit of time to measure progress. Some cathedrals took a century to complete. Can you imagine the grandeur and scope of a program that would take as long? -- Epigrams in Programming, ACM SIGPLAN Sept. 1982 -- 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 + QUERY
Echo $info where you hold you query, to make sure that is reasonable. $result_info is the result set. $row_info ...well you can use var_dump() on this to get its contents... but if row_info prints out nothing, then there is probably a problem with the query, or your query is returning nothing.. Dan Shirah wrote: I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. On 3/27/07, *Brad Bonkoski* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Dan Shirah wrote: Should I use something besides mssql_fetch_row to get my result? No matter which method I use for determining if the value exists, I still get no data populated to my form. Why not echo out your query before executing it, so you can run it against the back end if you have it, or at least for a sanity check to make sure you are running the correct query. On 3/27/07, Tijnema ! [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On 3/27/07, Davi [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:02, Dave Goodchild escreveu: use: $_POST['max_id'] == or even better: if (empty($_POST['max_id'])) Why not: if (!(isset($_POST[max_id))) ? If form is left empty, it is set, but it's stil empty. So if you submit a form the normal way, then it should pass this, even if you leave it empty :) Tijnema -- Davi Vidal [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Agora com fortune: Around computers it is difficult to find the correct unit of time to measure progress. Some cathedrals took a century to complete. Can you imagine the grandeur and scope of a program that would take as long? -- Epigrams in Programming, ACM SIGPLAN Sept. 1982 -- 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 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] Language detection with PHP
Em Terça 27 Março 2007 17:33, Zoltán Németh escreveu: 2007. 03. 27, kedd keltezéssel 15.06-kor William Lovaton ezt írta: Hi there, I am trying to implement language detection with PHP for a web site I am trying to build. The idea is to take a piece of text and try to guess the language it is written in. I have two options but I'd like to know if you guys have a better idea. 1) I implemented a detector using spell checking, so if I run the text through many spell checkers the one with less errors is probably the right language for that text. It works quite well and I am pleased with it. The only thing I don't like is that loading many spell checkers is a bit of a waste, it may require a lot of CPU and a lot of memory depending on the dictionary and the number of dictionaries you load. Besides, it adds one extra module dependency (pspell). 2) The other option is implemented in PEAR and it's called Text_LanguageDetect: [] http://pear.php.net/package/Text_LanguageDetect It seems to use a very different technique called N-Gram-Based Text Categorization, I haven't tested it yet but I will very soon and see how good it works, it says it's in alpha state but I guess it doesn't requiere pspell, doesn't consume a lot of memory and it should be fast. The only thing I am worried about is how accurate is it... I'll check soon and post my comments later. 3) Insert a very good idea here, please I'd really like to hear what different alternatives all of you have for this problem. I've definitely no experience with this problem, just guessing ;) what if you build some arrays of language specific stuff and check for that. I mean you could store stuff like if it contains 's, 've, 'm many times it's probably english... I don't really know how to store those rules, and I'm not sure they are good enough (or are there good enough rules) to tell several languages apart... greets Zoltán Németh Thanks a lot, -William Good tip!! =] Portuguese-Brazilian: ç, ã, õ, á, é, í, ó, ú, à, è, ì, ò, ù, ü -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: Take a lesson from the whale; the only time he gets speared is when he raises to spout. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST + QUERY
Em Terça 27 Março 2007 17:40, Dan Shirah escreveu: I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. How about: print_r($row_info); ?? -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: agaffney I want to be so bleeding edge that I cut myself! robbat2 agaffney, no, that's just emo agaffney Gentoo is emo :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST + QUERY
print_r($row_info) display the entire column contents of the select id However, *$first = $row_info['first_name']; echo $cc_first;* the above echo still returns nothing. On 3/27/07, Davi [EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:40, Dan Shirah escreveu: I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. How about: print_r($row_info); ?? -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: agaffney I want to be so bleeding edge that I cut myself! robbat2 agaffney, no, that's just emo agaffney Gentoo is emo :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST + QUERY
Sorry, had a typo. *$cc_first = $row_info['first_name']; echo $cc_first;* this echo returns nothing. On 3/27/07, Dan Shirah [EMAIL PROTECTED] wrote: print_r($row_info) display the entire column contents of the select id However, *$first = $row_info['first_name']; echo $cc_first;* the above echo still returns nothing. On 3/27/07, Davi [EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:40, Dan Shirah escreveu: I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. How about: print_r($row_info); ?? -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: agaffney I want to be so bleeding edge that I cut myself! robbat2 agaffney, no, that's just emo agaffney Gentoo is emo :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Language detection with PHP
On 3/27/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 03. 27, kedd keltezéssel 15.06-kor William Lovaton ezt írta: Hi there, I am trying to implement language detection with PHP for a web site I am trying to build. The idea is to take a piece of text and try to guess the language it is written in. I have two options but I'd like to know if you guys have a better idea. 1) I implemented a detector using spell checking, so if I run the text through many spell checkers the one with less errors is probably the right language for that text. It works quite well and I am pleased with it. The only thing I don't like is that loading many spell checkers is a bit of a waste, it may require a lot of CPU and a lot of memory depending on the dictionary and the number of dictionaries you load. Besides, it adds one extra module dependency (pspell). 2) The other option is implemented in PEAR and it's called Text_LanguageDetect: [] http://pear.php.net/package/Text_LanguageDetect It seems to use a very different technique called N-Gram-Based Text Categorization, I haven't tested it yet but I will very soon and see how good it works, it says it's in alpha state but I guess it doesn't requiere pspell, doesn't consume a lot of memory and it should be fast. The only thing I am worried about is how accurate is it... I'll check soon and post my comments later. 3) Insert a very good idea here, please I'd really like to hear what different alternatives all of you have for this problem. I've definitely no experience with this problem, just guessing ;) what if you build some arrays of language specific stuff and check for that. I mean you could store stuff like if it contains 's, 've, 'm many times it's probably english... I don't really know how to store those rules, and I'm not sure they are good enough (or are there good enough rules) to tell several languages apart... greets Zoltán Németh In formal english, it's not allowed to use 've 'm etc, I'm should be written as I am. So that's not gonna work i think. But words like and are really english i think :) Keep in mind that this is quite a hard way i think, but i don't have a better solution. Just for example, Dutch and Afrikaans are not very different, so it's really hard to see which of the 2 the text is written in. Tijnema ps. If you can't get the difference between Dutch and Afrikaans, guess for Dutch :) It's a lot more used then Afrikaans. Thanks a lot, -William -- 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 + QUERY
2007. 03. 27, kedd keltezéssel 16.56-kor Dan Shirah ezt írta: print_r($row_info) display the entire column contents of the select id However, *$first = $row_info['first_name']; echo $cc_first;* the above echo still returns nothing. yeah because you assign that value to $first, not to $cc_first what you echo out later... greets Zoltán Németh On 3/27/07, Davi [EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:40, Dan Shirah escreveu: I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. How about: print_r($row_info); ?? -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: agaffney I want to be so bleeding edge that I cut myself! robbat2 agaffney, no, that's just emo agaffney Gentoo is emo :P -- 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] Language detection with PHP
2007. 03. 27, kedd keltezéssel 22.57-kor Tijnema ! ezt írta: On 3/27/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 03. 27, kedd keltezéssel 15.06-kor William Lovaton ezt írta: Hi there, I am trying to implement language detection with PHP for a web site I am trying to build. The idea is to take a piece of text and try to guess the language it is written in. I have two options but I'd like to know if you guys have a better idea. 1) I implemented a detector using spell checking, so if I run the text through many spell checkers the one with less errors is probably the right language for that text. It works quite well and I am pleased with it. The only thing I don't like is that loading many spell checkers is a bit of a waste, it may require a lot of CPU and a lot of memory depending on the dictionary and the number of dictionaries you load. Besides, it adds one extra module dependency (pspell). 2) The other option is implemented in PEAR and it's called Text_LanguageDetect: [] http://pear.php.net/package/Text_LanguageDetect It seems to use a very different technique called N-Gram-Based Text Categorization, I haven't tested it yet but I will very soon and see how good it works, it says it's in alpha state but I guess it doesn't requiere pspell, doesn't consume a lot of memory and it should be fast. The only thing I am worried about is how accurate is it... I'll check soon and post my comments later. 3) Insert a very good idea here, please I'd really like to hear what different alternatives all of you have for this problem. I've definitely no experience with this problem, just guessing ;) what if you build some arrays of language specific stuff and check for that. I mean you could store stuff like if it contains 's, 've, 'm many times it's probably english... I don't really know how to store those rules, and I'm not sure they are good enough (or are there good enough rules) to tell several languages apart... greets Zoltán Németh In formal english, it's not allowed to use 've 'm etc, I'm should be written as I am. So that's not gonna work i think. But words like and are really english i think :) Keep in mind that this is quite a hard way i think, but i don't have a better solution. Just for example, Dutch and Afrikaans are not very different, so it's really hard to see which of the 2 the text is written in. Tijnema ps. If you can't get the difference between Dutch and Afrikaans, guess for Dutch :) It's a lot more used then Afrikaans. yeah, looking for very frequently used words seems better idea. greets Zoltán Németh Thanks a lot, -William -- 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 + QUERY
2007. 03. 27, kedd keltezéssel 16.56-kor Dan Shirah ezt írta: Sorry, had a typo. *$cc_first = $row_info['first_name']; echo $cc_first;* this echo returns nothing. and what does echo $row_info['first_name']; print out? if still nothing, then probably 1) you misspelled the field name and it's not called first_name 2) the field first_name is empty in the row greets Zoltán Németh On 3/27/07, Dan Shirah [EMAIL PROTECTED] wrote: print_r($row_info) display the entire column contents of the select id However, *$first = $row_info['first_name']; echo $cc_first;* the above echo still returns nothing. On 3/27/07, Davi [EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:40, Dan Shirah escreveu: I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. How about: print_r($row_info); ?? -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: agaffney I want to be so bleeding edge that I cut myself! robbat2 agaffney, no, that's just emo agaffney Gentoo is emo :P -- 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 + QUERY
echo $row_info['first_name']; returns nothing. However I have verified the correct spelling both in the database and in the PHP code and they are identical and when I print_r it shows that there is a value in the first_name column of the record. On 3/27/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 03. 27, kedd keltezéssel 16.56-kor Dan Shirah ezt írta: Sorry, had a typo. *$cc_first = $row_info['first_name']; echo $cc_first;* this echo returns nothing. and what does echo $row_info['first_name']; print out? if still nothing, then probably 1) you misspelled the field name and it's not called first_name 2) the field first_name is empty in the row greets Zoltán Németh On 3/27/07, Dan Shirah [EMAIL PROTECTED] wrote: print_r($row_info) display the entire column contents of the select id However, *$first = $row_info['first_name']; echo $cc_first;* the above echo still returns nothing. On 3/27/07, Davi [EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:40, Dan Shirah escreveu: I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. How about: print_r($row_info); ?? -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: agaffney I want to be so bleeding edge that I cut myself! robbat2 agaffney, no, that's just emo agaffney Gentoo is emo :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST + QUERY
Send us the output of print_r($row_info) feel free to mask out any data values you may wish. Dan Shirah wrote: echo $row_info['first_name']; returns nothing. However I have verified the correct spelling both in the database and in the PHP code and they are identical and when I print_r it shows that there is a value in the first_name column of the record. On 3/27/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 03. 27, kedd keltezéssel 16.56-kor Dan Shirah ezt írta: Sorry, had a typo. *$cc_first = $row_info['first_name']; echo $cc_first;* this echo returns nothing. and what does echo $row_info['first_name']; print out? if still nothing, then probably 1) you misspelled the field name and it's not called first_name 2) the field first_name is empty in the row greets Zoltán Németh On 3/27/07, Dan Shirah [EMAIL PROTECTED] wrote: print_r($row_info) display the entire column contents of the select id However, *$first = $row_info['first_name']; echo $cc_first;* the above echo still returns nothing. On 3/27/07, Davi [EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:40, Dan Shirah escreveu: I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. How about: print_r($row_info); ?? -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: agaffney I want to be so bleeding edge that I cut myself! robbat2 agaffney, no, that's just emo agaffney Gentoo is emo :P -- 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 + QUERY
Have you tried use number instead name? Something like: echo $row_info[0]; On mysql, you've mysql_fetch_object... Does has anything like this on MS Sql Server? best regards... Em Terça 27 Março 2007 18:17, Dan Shirah escreveu: echo $row_info['first_name']; returns nothing. However I have verified the correct spelling both in the database and in the PHP code and they are identical and when I print_r it shows that there is a value in the first_name column of the record. On 3/27/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 03. 27, kedd keltezéssel 16.56-kor Dan Shirah ezt írta: Sorry, had a typo. *$cc_first = $row_info['first_name']; echo $cc_first;* this echo returns nothing. and what does echo $row_info['first_name']; print out? if still nothing, then probably 1) you misspelled the field name and it's not called first_name 2) the field first_name is empty in the row greets Zoltán Németh On 3/27/07, Dan Shirah [EMAIL PROTECTED] wrote: print_r($row_info) display the entire column contents of the select id However, *$first = $row_info['first_name']; echo $cc_first;* the above echo still returns nothing. On 3/27/07, Davi [EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:40, Dan Shirah escreveu: I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. How about: print_r($row_info); ?? -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: agaffney I want to be so bleeding edge that I cut myself! robbat2 agaffney, no, that's just emo agaffney Gentoo is emo :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: [during a fishing trip] Peter Griffin: Man, some trip this turned out to be. All we caught is a tire, a boot, a tin can and this book of clich�s. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST + QUERY
2007. 03. 27, kedd keltezéssel 17.17-kor Dan Shirah ezt írta: echo $row_info['first_name']; returns nothing. However I have verified the correct spelling both in the database and in the PHP code and they are identical and when I print_r it shows that there is a value in the first_name column of the record. maybe paste here the complete result of: echo pre; var_dump($row_info); echo /pre; so I might have some more ideas... greets Zoltán Németh On 3/27/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 03. 27, kedd keltezéssel 16.56-kor Dan Shirah ezt írta: Sorry, had a typo. *$cc_first = $row_info['first_name']; echo $cc_first;* this echo returns nothing. and what does echo $row_info['first_name']; print out? if still nothing, then probably 1) you misspelled the field name and it's not called first_name 2) the field first_name is empty in the row greets Zoltán Németh On 3/27/07, Dan Shirah [EMAIL PROTECTED] wrote: print_r($row_info) display the entire column contents of the select id However, *$first = $row_info['first_name']; echo $cc_first;* the above echo still returns nothing. On 3/27/07, Davi [EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:40, Dan Shirah escreveu: I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. How about: print_r($row_info); ?? -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: agaffney I want to be so bleeding edge that I cut myself! robbat2 agaffney, no, that's just emo agaffney Gentoo is emo :P -- 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 + QUERY
Here are the results of my print_r Array ( [0] = 121 [1] = Y [2] = DS [3] = [4] = {03} [5] = 500 [6] = *** *[7] = John* [8] = Mark [9] = Doe [10] = 123 My Way [11] = 456 Your Place [12] = Smithville [13] = 12345 [14] = 5432 [15] = 123555 [16] = 1235550011 [17] = [EMAIL PROTECTED] [18] = Y [19] = These are the comments [20] = Mar 27 2007 5:26PM [21] = Dan Create [22] = Mar 27 2007 5:26PM [23] = Dan Research [24] = Mar 27 2007 5:26PM [25] = Dan Submit [26] = C [27] = TN ) Bold and in red is the first_name column result. On 3/27/07, Brad Bonkoski [EMAIL PROTECTED] wrote: Send us the output of print_r($row_info) feel free to mask out any data values you may wish. Dan Shirah wrote: echo $row_info['first_name']; returns nothing. However I have verified the correct spelling both in the database and in the PHP code and they are identical and when I print_r it shows that there is a value in the first_name column of the record. On 3/27/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 03. 27, kedd keltezéssel 16.56-kor Dan Shirah ezt írta: Sorry, had a typo. *$cc_first = $row_info['first_name']; echo $cc_first;* this echo returns nothing. and what does echo $row_info['first_name']; print out? if still nothing, then probably 1) you misspelled the field name and it's not called first_name 2) the field first_name is empty in the row greets Zoltán Németh On 3/27/07, Dan Shirah [EMAIL PROTECTED] wrote: print_r($row_info) display the entire column contents of the select id However, *$first = $row_info['first_name']; echo $cc_first;* the above echo still returns nothing. On 3/27/07, Davi [EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:40, Dan Shirah escreveu: I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. How about: print_r($row_info); ?? -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: agaffney I want to be so bleeding edge that I cut myself! robbat2 agaffney, no, that's just emo agaffney Gentoo is emo :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST + QUERY
Here is the result from the pre/pre Once again, bold and red is the first_name field. array(28) { [0]= int(122) [1]= string(1) Y [2]= string(2) DS [3]= string(16) [4]= string(4) {03} [5]= float(500) [6]= string(4) *** *[7]= string(4) John* [8]= string(4) Mark [9]= string(3) Doe [10]= string(40) 123 My Way [11]= string(40) 456 Your Place [12]= string(40) Smithville [13]= string(5) 12345 [14]= string(4) 5432 [15]= string(10) 123555 [16]= string(10) 1235550011 [17]= string(7) [EMAIL PROTECTED] [18]= string(1) Y [19]= string(22) These are the comments [20]= string(19) Mar 27 2007 5:29PM [21]= string(30) Dan Create [22]= string(19) Mar 27 2007 5:29PM [23]= string(30) Dan Research [24]= string(19) Mar 27 2007 5:29PM [25]= string(30) Dan Submit [26]= string(1) C [27]= string(2) TN } On 3/27/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 03. 27, kedd keltezéssel 17.17-kor Dan Shirah ezt írta: echo $row_info['first_name']; returns nothing. However I have verified the correct spelling both in the database and in the PHP code and they are identical and when I print_r it shows that there is a value in the first_name column of the record. maybe paste here the complete result of: echo pre; var_dump($row_info); echo /pre; so I might have some more ideas... greets Zoltán Németh On 3/27/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 03. 27, kedd keltezéssel 16.56-kor Dan Shirah ezt írta: Sorry, had a typo. *$cc_first = $row_info['first_name']; echo $cc_first;* this echo returns nothing. and what does echo $row_info['first_name']; print out? if still nothing, then probably 1) you misspelled the field name and it's not called first_name 2) the field first_name is empty in the row greets Zoltán Németh On 3/27/07, Dan Shirah [EMAIL PROTECTED] wrote: print_r($row_info) display the entire column contents of the select id However, *$first = $row_info['first_name']; echo $cc_first;* the above echo still returns nothing. On 3/27/07, Davi [EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:40, Dan Shirah escreveu: I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. How about: print_r($row_info); ?? -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: agaffney I want to be so bleeding edge that I cut myself! robbat2 agaffney, no, that's just emo agaffney Gentoo is emo :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST + QUERY
Dan Shirah wrote: Here are the results of my print_r Array ( [0] = 121 [1] = Y [2] = DS [3] = [4] = {03} [5] = 500 [6] = *** *[7] = John* [8] = Mark [9] = Doe [10] = 123 My Way [11] = 456 Your Place [12] = Smithville [13] = 12345 [14] = 5432 [15] = 123555 [16] = 1235550011 [17] = [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [18] = Y [19] = These are the comments [20] = Mar 27 2007 5:26PM [21] = Dan Create [22] = Mar 27 2007 5:26PM [23] = Dan Research [24] = Mar 27 2007 5:26PM [25] = Dan Submit [26] = C [27] = TN ) Bold and in red is the first_name column result. use the numeric reference then... [..] is the index into the array, so if you want John use $row_info[7] and if you *want* to use the name or associative array read here: http://www.php.net/manual/en/function.mssql-fetch-array.php -B On 3/27/07, *Brad Bonkoski* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Send us the output of print_r($row_info) feel free to mask out any data values you may wish. Dan Shirah wrote: echo $row_info['first_name']; returns nothing. However I have verified the correct spelling both in the database and in the PHP code and they are identical and when I print_r it shows that there is a value in the first_name column of the record. On 3/27/07, Zoltán Németh [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: 2007. 03. 27, kedd keltezéssel 16.56-kor Dan Shirah ezt írta: Sorry, had a typo. *$cc_first = $row_info['first_name']; echo $cc_first;* this echo returns nothing. and what does echo $row_info['first_name']; print out? if still nothing, then probably 1) you misspelled the field name and it's not called first_name 2) the field first_name is empty in the row greets Zoltán Németh On 3/27/07, Dan Shirah [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: print_r($row_info) display the entire column contents of the select id However, *$first = $row_info['first_name']; echo $cc_first;* the above echo still returns nothing. On 3/27/07, Davi [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:40, Dan Shirah escreveu: I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. How about: print_r($row_info); ?? -- Davi Vidal [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Agora com fortune: agaffney I want to be so bleeding edge that I cut myself! robbat2 agaffney, no, that's just emo agaffney Gentoo is emo :P -- PHP General Mailing List (http://www.php.net/ 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 + QUERY
I would try an echo $my_info[7]; []s Em Terça 27 Março 2007 18:28, Dan Shirah escreveu: Here are the results of my print_r Array ( [0] = 121 [1] = Y [2] = DS [3] = [4] = {03} [5] = 500 [6] = *** *[7] = John* [8] = Mark [9] = Doe [10] = 123 My Way [11] = 456 Your Place [12] = Smithville [13] = 12345 [14] = 5432 [15] = 123555 [16] = 1235550011 [17] = [EMAIL PROTECTED] [18] = Y [19] = These are the comments [20] = Mar 27 2007 5:26PM [21] = Dan Create [22] = Mar 27 2007 5:26PM [23] = Dan Research [24] = Mar 27 2007 5:26PM [25] = Dan Submit [26] = C [27] = TN ) Bold and in red is the first_name column result. On 3/27/07, Brad Bonkoski [EMAIL PROTECTED] wrote: Send us the output of print_r($row_info) feel free to mask out any data values you may wish. Dan Shirah wrote: echo $row_info['first_name']; returns nothing. However I have verified the correct spelling both in the database and in the PHP code and they are identical and when I print_r it shows that there is a value in the first_name column of the record. On 3/27/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 03. 27, kedd keltezéssel 16.56-kor Dan Shirah ezt írta: Sorry, had a typo. *$cc_first = $row_info['first_name']; echo $cc_first;* this echo returns nothing. and what does echo $row_info['first_name']; print out? if still nothing, then probably 1) you misspelled the field name and it's not called first_name 2) the field first_name is empty in the row greets Zoltán Németh On 3/27/07, Dan Shirah [EMAIL PROTECTED] wrote: print_r($row_info) display the entire column contents of the select id However, *$first = $row_info['first_name']; echo $cc_first;* the above echo still returns nothing. On 3/27/07, Davi [EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:40, Dan Shirah escreveu: I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. How about: print_r($row_info); ?? -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: agaffney I want to be so bleeding edge that I cut myself! robbat2 agaffney, no, that's just emo agaffney Gentoo is emo :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: Unless hours were cups of sack, and minutes capons, and clocks the tongues of bawds, and dials the signs of leaping houses, and the blessed sun himself a fair, hot wench in flame-colored taffeta, I see no reason why thou shouldst be so superfluous to demand the time of the day. I wasted time and now doth time waste me. -- William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST + QUERY
2007. 03. 27, kedd keltezéssel 17.28-kor Dan Shirah ezt írta: Here are the results of my print_r Array ( [0] = 121 [1] = Y [2] = DS [3] = [4] = {03} [5] = 500 [6] = *** *[7] = John* [8] = Mark [9] = Doe [10] = 123 My Way [11] = 456 Your Place [12] = Smithville [13] = 12345 [14] = 5432 [15] = 123555 [16] = 1235550011 [17] = [EMAIL PROTECTED] [18] = Y [19] = These are the comments [20] = Mar 27 2007 5:26PM [21] = Dan Create [22] = Mar 27 2007 5:26PM [23] = Dan Research [24] = Mar 27 2007 5:26PM [25] = Dan Submit [26] = C [27] = TN ) Bold and in red is the first_name column result. yeah, this shows that you don't have an associative array, so you have nothing like $row['fist_name'] you might access the fields by their number or you could use mssql_fetch_assoc() http://www.php.net/manual/en/function.mssql-fetch-assoc.php greets Zoltán Németh On 3/27/07, Brad Bonkoski [EMAIL PROTECTED] wrote: Send us the output of print_r($row_info) feel free to mask out any data values you may wish. Dan Shirah wrote: echo $row_info['first_name']; returns nothing. However I have verified the correct spelling both in the database and in the PHP code and they are identical and when I print_r it shows that there is a value in the first_name column of the record. On 3/27/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 03. 27, kedd keltezéssel 16.56-kor Dan Shirah ezt írta: Sorry, had a typo. *$cc_first = $row_info['first_name']; echo $cc_first;* this echo returns nothing. and what does echo $row_info['first_name']; print out? if still nothing, then probably 1) you misspelled the field name and it's not called first_name 2) the field first_name is empty in the row greets Zoltán Németh On 3/27/07, Dan Shirah [EMAIL PROTECTED] wrote: print_r($row_info) display the entire column contents of the select id However, *$first = $row_info['first_name']; echo $cc_first;* the above echo still returns nothing. On 3/27/07, Davi [EMAIL PROTECTED] wrote: Em Terça 27 Março 2007 17:40, Dan Shirah escreveu: I have echoed something out after virtually every line of code :) When I echo out my result ($result_info) it returns Resource id#2 When I echo out my row ($row_info) it returns Array When I try to echo out a field from my array($my_info) it returns nothing at all. How about: print_r($row_info); ?? -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Agora com fortune: agaffney I want to be so bleeding edge that I cut myself! robbat2 agaffney, no, that's just emo agaffney Gentoo is emo :P -- 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] pear returns prompt
Greetings, Linux Redhat AS 4 with PHP 5.1.6 When I execute pear, I get my prompt back: % which pear /usr/bin/pear % pear % echo $status 255 % pear list % echo $status 255 I double-checked my $PATH to be OK and am executing right pear. Any ideas as what may be happening. Thanks -- Farid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST + QUERY
Dan Shirah wrote: Okay, I thought this was VERY simple, but I cannot wrap my mind around what I am doing wrong. echo $_POST['max_id']; *The echo returns the correct result *if($_POST['max_id'] ='') { *This is suppose to run the below query if $_POST['max_id'] is not blank* $max_id = $_POST['max_id']; *Sets my POST value to a variable* $info = SELECT * FROM payment_request WHERE id = '$max_id'; *Selects record from my database by the matching ID's* $result_info = mssql_query($info) or die(mssql_error()); *Puts the query results into a variable* $row_info = ifx_fetch_row($result_info); *Makes a row in an array for all the returned fields from my query* $my_info = $row_info['my_value']; input type=Text value=?php echo $my_info; ? size=20 maxlength=16 name=my_value *However, this box returns no data.* I should be using if($_POST['max_id'] ='') { and notif($_POST['max_id'] !=='') { correct? Since it is a comparative function just the = should be correct. Can someone take a look at this solution and tell me if this would be a descent solution for his problem? I use this logic all over my code base, let me know if it is efficient, clean, well structured, etc... if ( isset($_POST['max_id']) ) { $max_id = (int)$_POST['max_id']; if ( empty($max_id) ) { die('not a valid id'); # or some other, more graceful, way of catching the error } $SQL = SELECT * FROM payment_request WHERE id = '{$max_id}'; if ( ( $result_info = mssql_query($SQL) ) === false ) { die(mssql_error()); # again, maybe something more graceful here } if ( mssql_num_rows( $result_info ) == 0 ) { die('nothing to display'); # again, maybe something more graceful here } else { while ( $row_info = mssql_fetch_array($result_info) ) { echo 'input type=Text value='.$row_info['my_value']. ' size=20 maxlength=16 name=my_value'; } } } -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Optimization of all mysql databases on a server
Jochem Maas wrote: Tijnema ! wrote: On 3/26/07, Chris [EMAIL PROTECTED] wrote: itoctopus wrote: The purpose of this script is to optimize all associated tables in all databases on a mysql server. This script is working great, you can put in a CRON and run it every day. Feel free to throw in your 2 cents! It's going to time out if you have any large databases or tables. php will not timeout on the commandline unless you actually specify a timeout - unlike php as used as a webserver SAPI. Considering the amount of html in the script I guessed (maybe incorrectly) it was for running from a browser - which is why I mentioned about the timeout issue. A command line script isn't going to have br/'s or tables or anything (well, none that I've written recently do). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Optimization of all mysql databases on a server
You're right, it was running from a browser, you need to use set_time_limit. -- itoctopus - http://www.itoctopus.com Chris [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jochem Maas wrote: Tijnema ! wrote: On 3/26/07, Chris [EMAIL PROTECTED] wrote: itoctopus wrote: The purpose of this script is to optimize all associated tables in all databases on a mysql server. This script is working great, you can put in a CRON and run it every day. Feel free to throw in your 2 cents! It's going to time out if you have any large databases or tables. php will not timeout on the commandline unless you actually specify a timeout - unlike php as used as a webserver SAPI. Considering the amount of html in the script I guessed (maybe incorrectly) it was for running from a browser - which is why I mentioned about the timeout issue. A command line script isn't going to have br/'s or tables or anything (well, none that I've written recently do). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pear returns prompt
Farid Hamjavar wrote: Greetings, Linux Redhat AS 4 with PHP 5.1.6 When I execute pear, I get my prompt back: Ask the pear list - http://pear.php.net/support/lists.php -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] changing array to a string
When I submit the for below it gives me an array that looks like this array(5) { [0]= string(1) 3 [1]= string(1) 4 [2]= string(1) 5 [3]= string(1) 6 [4]= string(1) 7 } I would like to convert it to a string like this 3,4,5,6,7 form action=test.php method=post table trtd colspan=2 align=leftinput name=subscriptions[] value=3 type=checkboxtest message /td/trtrtd colspan=2 align=leftinput name=subscriptions[] value=4 type=checkboxtest message /td/trtrtd colspan=2 align=leftinput name=subscriptions[] value=5 type=checkboxtest message /td/trtrtd colspan=2 align=leftinput name=subscriptions[] value=6 type=checkboxtest message /td/trtrtd colspan=2 align=leftinput name=subscriptions[] value=7 type=checkboxtest message /td/tr /table input type=hidden name=doit value=yes input type=submit name=submit /form
Re: [PHP] changing array to a string
Richard Kurth wrote: When I submit the for below it gives me an array that looks like this array(5) { [0]= string(1) 3 [1]= string(1) 4 [2]= string(1) 5 [3]= string(1) 6 [4]= string(1) 7 } I would like to convert it to a string like this 3,4,5,6,7 $ids = implode(',', $_POST['subscriptions']); -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] changing array to a string
-Original Message- From: Richard Kurth [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 28, 2007 6:12 AM To: php-general@lists.php.net Subject: [PHP] changing array to a string When I submit the for below it gives me an array that looks like this array(5) { [0]= string(1) 3 [1]= string(1) 4 [2]= string(1) 5 [3]= string(1) 6 [4]= string(1) 7 } I would like to convert it to a string like this 3,4,5,6,7 form action=test.php method=post table trtd colspan=2 align=leftinput name=subscriptions[] value=3 type=checkboxtest message /td/trtrtd colspan=2 align=leftinput name=subscriptions[] value=4 type=checkboxtest message /td/trtrtd colspan=2 align=leftinput name=subscriptions[] value=5 type=checkboxtest message /td/trtrtd colspan=2 align=leftinput name=subscriptions[] value=6 type=checkboxtest message /td/trtrtd colspan=2 align=leftinput name=subscriptions[] value=7 type=checkboxtest message /td/tr /table input type=hidden name=doit value=yes input type=submit name=submit /form [Peter Lauri - DWS Asia] Check www.php.net/implode Best regards, Peter Lauri www.dwsasia.com - company web site www.lauri.se - personal web site www.carbonfree.org.uk - become Carbon Free -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] changing array to a string
Richard Kurth wrote: When I submit the for below it gives me an array that looks like this array(5) { [0]= string(1) 3 [1]= string(1) 4 [2]= string(1) 5 [3]= string(1) 6 [4]= string(1) 7 } I would like to convert it to a string like this 3,4,5,6,7 $ids = implode(',', $_POST['subscriptions']); Thanks I keep trying explode and forgot about implode -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 5.2.1: Some scripts are being parsed, but most aren't
Hi all, Previously, I had installed Apache 1.3.37 with PHP 5.2.1 as a static module on Ubuntu 6.06. I am having a problem where, for some reason, some of my PHP scripts just show source code, while some are parsed. In the meantime, while trying to get this issue fixed, I decided to upgrade to Ubuntu 6.10, the latest Ubuntu release, to see if that helped the problem. As stated above, some of my PHP scripts just show source code both in Apache and the CLI, and some are actually parsed. I know this is not an Apache problem since I get the same results in the CLI. This is a paid script, and I am unable to post code, but in generic terms, I have narrowed it down to the following code. require_once($(DIR VARIABLE NAME HERE)./(NAME HERE).php); include_once(includefilenamehere.inc); The first line of the code completely makes it show the line of code, and the second line makes it show the include file, even if the second line is executed without the first line. Unfortunately, this is the only information I've been able to locate in my debugging. For debugging purposes, I also downgraded to PHP 4.4.6, and I had the same exact problem. It looks like it is a problem with a library possibly? An strace reports that PHP is trying to search for libraries in /usr/local/mysql/lib/mysql, but if I put them in there, it still doesn't function correctly. Any help is more than appreciated. Thank you very much, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using for loop in function
Richard Kurth wrote: The function below will create a group of checkboxes it will also check the checkbox that is stored in the table field that is in $select_value this works fine if there is only one value in the variable but if there is more stored like 1,2,3,4 it will not work. I am trying to figure out how to use the following for loop to add the number to each checkbox and if they match mark the checkbox checked $ExplodeIt = explode(,,$select_value,,); $Count = count($ExplodeIt); for ($i=0; $i $Count; $i++) { } function checkbox($sqlu,$name,$value1,$value2,$select_value){ $name_result = safe_query($sqlu); while($rowu=mysql_fetch_array($name_result)){ echo trtd colspan=\2\ align=\left\input type='checkbox' name=' . $name . [ . $rowu[$value1] . ]' value=\$rowu[$value1]\; Pass in an array to this function and then do: if (in_array($rowu[$value1], $selected_items)) { echo CHECKED; } echo rest of stuff or get the function to handle one item or multiple: if (!is_array($select_value)) { $select_value = array($select_value); } If that doesn't work then what are you passing in (ie what is $select_value) and what is in the data (print_r($rowu)) ? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.1: Some scripts are being parsed, but most aren't
Check your php files. Make sure the PHP code are enclosed in the tag ?php ... ?, not ? ... ? There's a php.ini option to accept ? ... ?. It's: short_open_tag = On 2007/3/28, Eddie [EMAIL PROTECTED]: Hi all, Previously, I had installed Apache 1.3.37 with PHP 5.2.1 as a static module on Ubuntu 6.06. I am having a problem where, for some reason, some of my PHP scripts just show source code, while some are parsed. In the meantime, while trying to get this issue fixed, I decided to upgrade to Ubuntu 6.10, the latest Ubuntu release, to see if that helped the problem. As stated above, some of my PHP scripts just show source code both in Apache and the CLI, and some are actually parsed. I know this is not an Apache problem since I get the same results in the CLI. This is a paid script, and I am unable to post code, but in generic terms, I have narrowed it down to the following code. require_once($(DIR VARIABLE NAME HERE)./(NAME HERE).php); include_once(includefilenamehere.inc); The first line of the code completely makes it show the line of code, and the second line makes it show the include file, even if the second line is executed without the first line. Unfortunately, this is the only information I've been able to locate in my debugging. For debugging purposes, I also downgraded to PHP 4.4.6, and I had the same exact problem. It looks like it is a problem with a library possibly? An strace reports that PHP is trying to search for libraries in /usr/local/mysql/lib/mysql, but if I put them in there, it still doesn't function correctly. Any help is more than appreciated. Thank you very much, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- -- Hap-Hang Yu, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using for loop in function
Richard Kurth wrote: The function below will create a group of checkboxes it will also check the checkbox that is stored in the table field that is in $select_value this works fine if there is only one value in the variable but if there is more stored like 1,2,3,4 it will not work. I am trying to figure out how to use the following for loop to add the number to each checkbox and if they match mark the checkbox checked $ExplodeIt = explode(,,$select_value,,); $Count = count($ExplodeIt); for ($i=0; $i $Count; $i++) { } function checkbox($sqlu,$name,$value1,$value2,$select_value){ $name_result = safe_query($sqlu); while($rowu=mysql_fetch_array($name_result)){ echo trtd colspan=\2\ align=\left\input type='checkbox' name=' . $name . [ . $rowu[$value1] . ]' value=\$rowu[$value1]\; if($select_value==$rowu[$value1]) { echo checked$rowu[$value2]\n/td/trBR; }else{ echo $rowu[$value2]\n/td/trBR; } } } I have used in_array as a way of doing what you are looking for. function checkbox($sqlu,$name,$value1,$value2,$select_value){ $name_result = safe_query($sqlu); while ( $rowu = mysql_fetch_array($name_result) ) { $checked = ''; if ( in_array($rowu[$value1], $select_value) ) { $checked = ' checked=checked'; } echo HTML tr td colspan=2 align=left input type=checkbox name={$name}[{$rowu[$value1]}] value={$rowu[$value1]} {$checked} /{$rowu[$value2]} /td /tr HTML; } } Personally, I would change your SQL query to return only the two columns that you are wanting to display. And also use the mysql_fetch_assoc() SELECT id AS colA, name AS colB FROM myTable; and not this SELECT * FROM myTable; This would then allow me to write your function this way. function checkbox($sqlu,$name,$selected=array()){ if ( ( $name_result = safe_query($sqlu) ) === false ) { die('something went wrong'); } while ( $rowu = mysql_fetch_assoc($name_result) ) { $checked = ''; if ( in_array($rowu['colA'], $selected) ) { $checked = ' checked=checked'; } echo HTML tr td colspan=2 align=left inputtype=checkbox name={$name}[{$rowu['colA']}] value={$rowu['colA']} {$checked} /{$rowu['colB']} /td /tr HTML; } } Hope this helps -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5.2.1: Some scripts are being parsed, but most aren't
On Tue, Mar 27, 2007 at 10:22:40PM -0700, Eddie wrote: Hi all, Previously, I had installed Apache 1.3.37 with PHP 5.2.1 as a static module on Ubuntu 6.06. I am having a problem where, for some reason, some of my PHP scripts just show source code, while some are parsed. Hi... I have a problem something similar. Any scripts would be parsed, any would be downloaded in fireofx 2.x. I use Ubuntu 6.10. My solution is to start the ancient Mozilla browser, with this browser works everything fine. I think it is a firefox problem?! My server is apache 2.0.55 with php 5.2.1. Greetings Mario -- - | havelsoft.com - Ihr Service Partner für Open Source | | Tel: 033876-21 966 | | Notruf: 0173-277 33 60 | | http://www.havelsoft.com| | | | Inhaber: Mario Günterberg | | Mützlitzer Strasse 19 | | 14715 Märkisch Luch | - signature.asc Description: Digital signature
[PHP] How can i convert one object to another. Convert Exception object to MyException Object.
Hello there, I am trying to convert one object to another, something like clone. For example. --- class MyException extends Exception { // My functions etc.. etc.. } function ExceptionHandler($exception) { // Convert an NoN MyException to an MyException } set_exception_handler('ExceptionHandler'); --- Then when i do a: throw new Exception('My Message', 1); And i don't catch it my self, it will get into the ExceptionHandler. Now i have some special methods within MyException to handle stuff. And i want to copy/convert the $exception (Exception) object to a MyException object to use its methods. Thx in advanced. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php