php-general Digest 24 Mar 2005 12:52:14 -0000 Issue 3356
php-general Digest 24 Mar 2005 12:52:14 - Issue 3356 Topics (messages 211429 through 211454): Preorder Modified Tree Traversal 211429 by: Matt Babineau 211434 by: Burhan Khalid Re: Apache user can't use exec(), passthru(), etc. 211430 by: Jim Poserina 211432 by: Jim Poserina NetFlix Drag and Drop Row Ordering 211431 by: Graham Anderson 211436 by: Burhan Khalid Re: mail() Alternative? 211433 by: Manuel Lemos Memory use 211435 by: Joe Wollard 211438 by: M. Sokolewicz Re: executed script URL 211437 by: Michal Kozusznik SQL statement - please help 211439 by: Jacques 211450 by: Jason Barnett 211454 by: Jay Blanchard file upload 211440 by: William Stokes 211441 by: Tristan.Pretty.risk.sungard.com 211444 by: William Stokes 211446 by: William Stokes Destroying the Session Object 211442 by: Jacques 211451 by: Jason Barnett Listing directory, return none if only one file 211443 by: Alexandru Martin 211452 by: Forest Liu 211453 by: Jason Barnett convert date format 211445 by: Angelo Zanetti Re: convert date format-SOLVED 211447 by: Angelo Zanetti 211448 by: Chris Ramsay 211449 by: Angelo Zanetti Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- Hi all, I'm trying to use pmtt to display a windows explorer style view of products in a database. If anyone is familiar with pmtt could you send me an email, I'm looking for some help. I built some code to pull the Levels out of the database, I need some help tracking which level the user is clicking on so that I can create a drill-down scenario. I know this can most likely be achieved more easily using the adjacent tree method, but I need something a bit more robust than that. Let me know if you have created any systems that are drill-down style menus or whatnot, I'm interested in the methods you used to achieve your success. Thanks All! PS- Thanks to those who suggested the Linux command line HTML 2 PDF package!! Matt Babineau Criticalcode w: http://www.criticalcode.com p: 858.733.0160 e: [EMAIL PROTECTED] ---End Message--- ---BeginMessage--- Matt Babineau wrote: Hi all, I'm trying to use pmtt to display a windows explorer style view of products in a database. If anyone is familiar with pmtt could you send me an email, I'm looking for some help. I built some code to pull the Levels out of the database, I need some help tracking which level the user is clicking on so that I can create a drill-down scenario. I know this can most likely be achieved more easily using the adjacent tree method, but I need something a bit more robust than that. Let me know if you have created any systems that are drill-down style menus or whatnot, I'm interested in the methods you used to achieve your success. How are you tracking them now? What's not working? Sitepoint has a great article that has PHP snippets on both pmtt and the flat drill-down method. http://www.sitepoint.com/article/hierarchical-data-database ---End Message--- ---BeginMessage--- The output is: OS Error: 127. I have a second server that I use as a downtime backup. On that one, all the scripts work normally. I don't have to give a path for the commands, any commands with permission problems return permission denied, and the apache user (nobody) actually has /sbin/nologin as the shell. Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Mon, March 21, 2005 8:20 pm, Jim Poserina said: If I run this PHP script: ?php echo 'pre'; echo exec('whoami'); The first most biggest thing wrong is that you aren't using the additional arguments to exec() to find out what your output is, and if your command generated an error. For starters, I'm betting that at least one of the following is true: whoami is not in the $PATH/$path of the PHP user. whoami is not executable by the PHP user. You'll never find out which unless you use the extra args to exec http://php.net/exec echo '/pre'; ? from the web, the output is pre/preand from the command line running as the apache user(webuser), the output is. Content-type: text/html X-Powered-By: PHP/4.3.9 pre/pre EXCELLENT attempt to diagnose this, though! But if I run from the command line as root, the output is: Content-type: text/html X-Powered-By: PHP/4.3.9 preroot/preand from the command line as a user in the root group, the output is: Content-type: text/html X-Powered-By: PHP/4.3.9 prejimpoz/preSafe mode is turned off. As webuser (or any non-root-group user), no shell commands work. Not echo, not ls, not whoami, not touch.
[PHP] Re: executed script URL
Hello Rasmus answered this question a week or two ago. Search the archives for 'getenv request' and you will likely find the answer. I found something (in last 3000 posts) but it says about getenv('REMOTE_ADDR'). My problem is how to get an URL of executed script in always working way, compatible will all servers/configs The problem is in URLs like this http://domain.name.com/ ... some path ... /script.php Where I cannot get 'some path' part (in compatible way). best regards -- ***Media-IT Micha Kousznik *** *** IT networks - databases - multimedia *** ***[EMAIL PROTECTED] *** *** http://www.media-it.net *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Memory use
Joe Wollard wrote: Greetings, I'm trying to help a C programmer understand and use PHP for web development. So far all the similarities between C++ and PHP are making the process rather speedy. He asked what seemed like a very simple question, but I couldn't find the answer. The questions is how can you determine how much memory a variable/object/struct/etc are using? For instance: $myObject = new myClass(); $myObject-performAction_and_holdResult(); At this point, how can you tell how much memory $myObject is using? Thanks! you can't. PHP (the ZE actually) handles all memory related tasks behind the screens, this means you shouldn't have to worry about it. But just don't worry doesn't mean it can not be seen. AFAIK there are functions which give you the total memory used by the script, but I don't think there are any showing the memory used by a structure/variable. (since there's no need for them) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL statement - please help
Dear all Please, I realy need your help. I am trying to extract only those records that were entered during the past hour from my MySQL database. The following SQL statement extracts all the records. As soon as I change the INTERVAL to 1 HOUR I see all the records in my database. When I change CURDATE() to CURTIME() no records are extracted from the database. The cgtimeposted field is a time data type. Please advise me as to how I can formulate my SQL statement so that only those records entered within the past hour displays on my page. Here is my current SQL statement - this statement displays all the records: $sql = Select tblchatglobal.cgid, tblchatglobal.cgdateposted, tblchatglobal.cgtimeposted, tblchatglobal.uid, tblchatglobal.cgmsg, tblusers.uid, tblusers.uusername from tblchatglobal, tblusers where (tblchatglobal.uid = tblusers.uid) and (DATE_SUB(CURDATE(),INTERVAL 1 HOUR) = tblchatglobal.cgtimeposted) order by tblchatglobal.cgtimeposted desc; Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file upload
Hello, I'm (slowly) learning how to make a file upload stuff with php. Now I would like to know how to define the servers upload directory in the code? For example I have the upload script in folder /www in the www.domain.com server and I want upload the files to /www/uploads folder. So how do write the path in the php script? Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file upload
http://www.hotscripts.com/Detailed/24113.html take a look at this.. perhaps you can reverse engineer it William Stokes [EMAIL PROTECTED] 24/03/2005 09:18 To php-general@lists.php.net cc Subject [PHP] file upload Hello, I'm (slowly) learning how to make a file upload stuff with php. Now I would like to know how to define the servers upload directory in the code? For example I have the upload script in folder /www in the www.domain.com server and I want upload the files to /www/uploads folder. So how do write the path in the php script? Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Destroying the Session Object
How can I destroy the session object for a particular user when that user leaves my web site without properly signing out? Jacques -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Listing directory, return none if only one file
I have a script that lists the files in a directory, but when i have only ONE file , it won't display it ( here is the code : http://www.pastebin.com/262050 ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file upload
Okl I can't reverse engineer that... I just need to know how to set the path. now I have it like this and it wont work. $fileame comes from a form. if (copy($filename, /imagedir/ . $filename_name)) print H2upload succesful!/H2; Tristan Pretty [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] http://www.hotscripts.com/Detailed/24113.html take a look at this.. perhaps you can reverse engineer it William Stokes [EMAIL PROTECTED] 24/03/2005 09:18 To php-general@lists.php.net cc Subject [PHP] file upload Hello, I'm (slowly) learning how to make a file upload stuff with php. Now I would like to know how to define the servers upload directory in the code? For example I have the upload script in folder /www in the www.domain.com server and I want upload the files to /www/uploads folder. So how do write the path in the php script? Thanks -Will -- 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] convert date format
hi guys, I need to convert a date from this format: 2005-03-25 to 25 mar 2005. I have tried the mktime, strftime and the date functions but they all take a time stamp but I only have the dates in the format of 2005-03-25. These are what i tried where $row['date'] is 2005-02-24 but they all return 01 Jan 1970??? echo(mktime(0,0,0, date(j, $row['date']), date(M, $row['date']), date(Y, $row['date']))); echo(strftime(%d, $row['date']) . . strftime(%b, $row['date']). . strftime(%Y, $row['date'])); echo(date(d,$row['date'] ) . . date(M, $row['date']) . . date(Y,$row['date'] )); thanks in advance angelo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file upload
Never mind. I got that sorted out! Thanks anyway... -Will William Stokes [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] Okl I can't reverse engineer that... I just need to know how to set the path. now I have it like this and it wont work. $fileame comes from a form. if (copy($filename, /imagedir/ . $filename_name)) print H2upload succesful!/H2; Tristan Pretty [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] http://www.hotscripts.com/Detailed/24113.html take a look at this.. perhaps you can reverse engineer it William Stokes [EMAIL PROTECTED] 24/03/2005 09:18 To php-general@lists.php.net cc Subject [PHP] file upload Hello, I'm (slowly) learning how to make a file upload stuff with php. Now I would like to know how to define the servers upload directory in the code? For example I have the upload script in folder /www in the www.domain.com server and I want upload the files to /www/uploads folder. So how do write the path in the php script? Thanks -Will -- 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] convert date format-SOLVED
Hi guys, got it to work: $datearr = split('-', $row['date']); $tstamp = mktime(0,0,0,$datearr[1],$datearr[2],$datearr[0]); $myformat = date('j M Y',$tstamp); echo 'myformat: ' . $myformat; hope this can help others!! Angelo Angelo Zanetti wrote: hi guys, I need to convert a date from this format: 2005-03-25 to 25 mar 2005. I have tried the mktime, strftime and the date functions but they all take a time stamp but I only have the dates in the format of 2005-03-25. These are what i tried where $row['date'] is 2005-02-24 but they all return 01 Jan 1970??? echo(mktime(0,0,0, date(j, $row['date']), date(M, $row['date']), date(Y, $row['date']))); echo(strftime(%d, $row['date']) . . strftime(%b, $row['date']). . strftime(%Y, $row['date'])); echo(date(d,$row['date'] ) . . date(M, $row['date']) . . date(Y,$row['date'] )); thanks in advance angelo -- Angelo Zanetti Z Logic [c] +27 72 441 3355 [t] +27 21 464 1363 [f] +27 21 464 1371 www.zlogic.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert date format-SOLVED
Angelo, slightly OT , but as a point of interest perhaps, $row['date'] seemed to indicate that your date comes out of a DB - you can date format stuff with sql too - I find that useful sometimes... With MySQL for example, if your date field is called 'myDate' you can do the following in the query: SELECT ... DATE_FORMAT(myDate, %d %b %Y) AS date ,FROM. which formats $row['date'] as '25 mar 2005'... rgds chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert date format-SOLVED
yeah i know but its used for other calculations thats why i format it with PHP!! thanks anyway Chris Ramsay wrote: Angelo, slightly OT , but as a point of interest perhaps, $row['date'] seemed to indicate that your date comes out of a DB - you can date format stuff with sql too - I find that useful sometimes... With MySQL for example, if your date field is called 'myDate' you can do the following in the query: SELECT ... DATE_FORMAT(myDate, %d %b %Y) AS date ,FROM. which formats $row['date'] as '25 mar 2005'... rgds chris -- Angelo Zanetti Z Logic [c] +27 72 441 3355 [t] +27 21 464 1363 [f] +27 21 464 1371 www.zlogic.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SQL statement - please help
Try a MySQL list. Or possibly even php-db. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] Re: Destroying the Session Object
Jacques wrote: How can I destroy the session object for a particular user when that user leaves my web site without properly signing out? Jacques The most important part of this is garbage collection. You can't really know for 100% sure that a user has left without properly signing out, but there are several things you can do to mitigate the problem: - Only set session cookies (i.e. browser should destroy the cookie when the browser is closed) - Modify the following php.ini directives in a way that fits you: - http://php.net/manual/en/ref.session.php#ini.session.gc-probability - (also look at the next several gc_* entries) -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] Listing directory, return none if only one file
it's better for getting help if you could show your code. On Thu, 24 Mar 2005 12:15:11 +0200, Alexandru Martin [EMAIL PROTECTED] wrote: I have a script that lists the files in a directory, but when i have only ONE file , it won't display it ( here is the code : http://www.pastebin.com/262050 ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Sincerely, Forest Liu(?) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Listing directory, return none if only one file
Forest Liu wrote: it's better for getting help if you could show your code. He did show his code, he even put it in one of those nice pastebin sites! Hurrah! On Thu, 24 Mar 2005 12:15:11 +0200, Alexandru Martin [EMAIL PROTECTED] wrote: I have a script that lists the files in a directory, but when i have only ONE file , it won't display it ( here is the code : http://www.pastebin.com/262050 ) OK so I looked it over, but honestly that is some ugly looking code. Did you try to optimize it at the cost of readability? I've already spent 15 minutes looking at your code which is more time than it should have taken me to diagnose this problem. Your problem lies somewhere within the logic of your darn while() loop... but your coding practices have made it difficult for me (someone that codes PHP from the command-line :-/) to help you. Maybe someone else will look at this problem for you. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
RE: [PHP] SQL statement - please help
[snip] $sql = Select tblchatglobal.cgid, tblchatglobal.cgdateposted, tblchatglobal.cgtimeposted, tblchatglobal.uid, tblchatglobal.cgmsg, tblusers.uid, tblusers.uusername from tblchatglobal, tblusers where (tblchatglobal.uid = tblusers.uid) and (DATE_SUB(CURDATE(),INTERVAL 1 HOUR) = tblchatglobal.cgtimeposted) order by tblchatglobal.cgtimeposted desc; [/snip] One of the MySQL lists will be really helpful to you. http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html AND (DATE_SUB(CURDATE(),INTERVAL 1 HOUR)= tblchatglobal.cgtimeposted) CURDATE is wrong here, as it only returns a date. NOW() returns a datetime. Try AND (DATE_SUB(NOW(),INTERVAL 1 HOUR)= tblchatglobal.cgtimeposted) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Q: static method working in PHP4 and PHP5
Hi, An example script: ?php error_reporting(4095); class Foo { function test() { } } Foo::test(); ? would produce in PHP5 error: PHP Strict Standards: Non-static method Foo::test() should not be called statically in ... line 8 I have two questions: 1. Could it be possible that under specific circumstances such a call can produce fatal error Non-static method Foo::test() cannot be called statically? 2. Is there a proper way to write such a class that would work properly in both PHP4 and PHP5, without Strict errors? Best regards, -- Piotr Klaban -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL statement - please help
Hi, Thursday, March 24, 2005, 6:50:38 PM, you wrote: J Dear all J Please, I realy need your help. I am trying to extract only those records J that were entered during the past hour from my MySQL database. The J following SQL statement extracts all the records. As soon as I change the J INTERVAL to 1 HOUR I see all the records in my database. When I change J CURDATE() to CURTIME() no records are extracted from the database. The J cgtimeposted field is a time data type. J Please advise me as to how I can formulate my SQL statement so that only J those records entered within the past hour displays on my page. J Here is my current SQL statement - this statement displays all the records: J $sql = Select tblchatglobal.cgid, tblchatglobal.cgdateposted, J tblchatglobal.cgtimeposted, tblchatglobal.uid, tblchatglobal.cgmsg, J tblusers.uid, tblusers.uusername from tblchatglobal, tblusers where J (tblchatglobal.uid = tblusers.uid) and J (DATE_SUB(CURDATE(),INTERVAL 1 HOUR) J = tblchatglobal.cgtimeposted) order by J tblchatglobal.cgtimeposted desc; J Jacques You cannot do this with just a time field as what happens at midnight and now() becomes 00:00:00, you will need to work with a full date_time field. The other problem is CURDATE has no time component, it is just a date so subtracting 1 hour will always return 23:00:00. So change the time field to a timestamp and try ... AND tblchatglobal.cgtimeposted (DATE_SUB(NOW(),INTERVAL 1 HOUR)) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Q: static method working in PHP4 and PHP5
Piotr Klaban wrote: Hi, An example script: ?php error_reporting(4095); class Foo { function test() { } } Foo::test(); ? would produce in PHP5 error: PHP Strict Standards: Non-static method Foo::test() should not be called statically in ... line 8 I have two questions: 1. Could it be possible that under specific circumstances such a call can produce fatal error Non-static method Foo::test() cannot be called statically? no 2. Is there a proper way to write such a class that would work properly in both PHP4 and PHP5, without Strict errors? no, unless you keep this code and turn off E_STRICT error_reporting Best regards, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] NetFlix Drag and Drop Row Ordering
I don't see anything special about my Netflix queue. Am I missing something there? And I have no idea what Flex is referring to, so I'll check that out if anyone lets me know where. :o) Martin Austin Burhan Khalid [EMAIL PROTECTED] 03/24/2005 12:27 AM To: Graham Anderson [EMAIL PROTECTED] cc: php-general@lists.php.net Subject:Re: [PHP] NetFlix Drag and Drop Row Ordering Graham Anderson wrote: For those who have netflix, does anyone know how you would recreate their 'drag and drop' queue widget? basically, you can drag and drop movies in the order you choose is this a combination of javascript and php ? how would you go about creating something like this to order rows in your own CMS ? I don't have an account with Netflix, but Flex has a great drag and drop widget. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] checkbox value
Hello, I have a checkbox in a form. How can I determine if the user has set the checkbox on or not? Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Listing directory, return none if only one file
Hi, Thursday, March 24, 2005, 8:15:11 PM, you wrote: AM I have a script that lists the files in a directory, but when i have AM only ONE file , it won't display it ( here is the code : AM http://www.pastebin.com/262050 ) After you sort the $filename array its index changes from 1 to 0 so your $i is 1 ahead of the array. -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] checkbox value
isset($_POST['checkboxname']) or isset($_GET['checkboxname']) depending on the method of your form. a good thing to do is to do var_dump($_POST) or var_dump($_GET) to see all the values posted from the form... hth ken On Thu, 24 Mar 2005 15:42:10 +0200, William Stokes [EMAIL PROTECTED] wrote: Hello, I have a checkbox in a form. How can I determine if the user has set the checkbox on or not? Thanks -Will -- 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] convert date format
try preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}))#', $row['date'], $matches); $month = array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); $converted_date = $matches[3]. .$month[$matches[2]]. .$matches[1]; untested... On Thu, 24 Mar 2005 12:52:04 +0200, Angelo Zanetti [EMAIL PROTECTED] wrote: hi guys, I need to convert a date from this format: 2005-03-25 to 25 mar 2005. I have tried the mktime, strftime and the date functions but they all take a time stamp but I only have the dates in the format of 2005-03-25. These are what i tried where $row['date'] is 2005-02-24 but they all return 01 Jan 1970??? echo(mktime(0,0,0, date(j, $row['date']), date(M, $row['date']), date(Y, $row['date']))); echo(strftime(%d, $row['date']) . . strftime(%b, $row['date']). . strftime(%Y, $row['date'])); echo(date(d,$row['date'] ) . . date(M, $row['date']) . . date(Y,$row['date'] )); thanks in advance angelo -- 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] if statement probable bug
Probably this is the wrong place to put this but I couldn't search for the bug and what I saw in the bugs newsgroup was a bit strange and seem to be a log for the bugs forms. So here is what I would call a bug, but maybe it's thought to be so: ?php $var1 = 0; $var2 = AS; if($var1 == AS){ echo brWhy is this printed; } if(0 == AS){ echo brAt least this should not be printed; } if($var2 == AS){ echo brOnly this should; } ? I didn't expect it. I use php 5.02 and have the zend debugger installed. Does anybody see every echo and finds this strange in a typeless language? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if statement probable bug
Probably this is the wrong place to put this but I couldn't search for the bug and what I saw in the bugs newsgroup was a bit strange and seem to be a log for the bugs forms. So here is what I would call a bug, but maybe it's thought to be so: ?php $var1 = 0; $var2 = AS; if($var1 == AS){ echo brWhy is this printed; } if(0 == AS){ echo brAt least this should not be printed; } if($var2 == AS){ echo brOnly this should; } ? I didn't expect it. I use php 5.02 and have the zend debugger installed. Does anybody see every echo and finds this strange in a typeless language? Sebastian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] delete file
Hello, How can I let user delete a uploaded image file in the server's directory? Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if statement probable bug
Hello TheI2eptile, Thursday, March 24, 2005, 2:05:14 PM, you wrote: T So here is what I would call a bug, but maybe it's thought to be so: Try it with strict (data-type) comparisons, i.e.: if ($var === AS) Then you won't get the bug. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] delete file
[snip] How can I let user delete a uploaded image file in the server's directory? [/snip] http://www.php.net/unlink -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete file
Hello William, Thursday, March 24, 2005, 2:08:13 PM, you wrote: WS How can I let user delete a uploaded image file in the server's WS directory? unlink() Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] checkbox value
# index.php form method=post action=index.php ?php $checked = ($_POST['CheckThis'] == 'Yes') ? 'checked' : '' ; input type=checkbox name=CheckThis value=Yes ?= $checked ? input type=Submit value=Submit /form -afan William Stokes wrote: Hello, I have a checkbox in a form. How can I determine if the user has set the checkbox on or not? Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if statement probable bug
TheI2eptile wrote: Probably this is the wrong place to put this but I couldn't search for not at all the wrong place, having said that the only thing probable with regard to you/your post is that you are not fully aware of the nature of data types in php and the way auto-typecasting works (in terms of precedence and conversion)... which is not surprising, most people get bitten by this at some time :-) because often when looking at the behaviour from the point of view of other langs (or as a complete beginner) the logic behind it may not seem at all logical... I recommend searching for some more info on (auto)typecasting in php, by the sounds of things you're capable of grokking the whys and wherefores without much trouble :-) the bug and what I saw in the bugs newsgroup was a bit strange and seem to be a log for the bugs forms. So here is what I would call a bug, but maybe it's thought to be so: ?php $var1 = 0; $var2 = AS; if($var1 == AS){ echo brWhy is this printed; } int has higher precendence... therefore AS is converted to an int ... AS when converted to an int is zero... the order of the operands does not matter in this case, try the following one liner: ?php var_dump( (0 == AS), (AS == 0) ); ? if(0 == AS){ echo brAt least this should not be printed; } same rules applies here. if($var2 == AS){ echo brOnly this should; } ? I didn't expect it. I use php 5.02 and have the zend debugger installed. Does anybody see every echo and finds this strange in a typeless language? php is not typeless! its dynamically typed. I wonder if there are typeless langs at all :-) btw: yes I see every echo, no I don't find it strange (anymore!) as someone else already mentioned: use the strict equality operator (===) to tell php not to do auto-typecasting on the vars you want to check for equality. rgds, Jochem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] NetFlix Drag and Drop Row Ordering
I've used drag and drop row ordering before. The only PHP I used was to read a record set and write it out for the different items. The piece of code I used worked with JavaScript and html. Basically there was a large div, and each element inside of the main div was a div. It grabbed the onclick event, grabbed the coordinates of where you're moving the piece, and when you dropped it, the JavaScript bumped everything down, or up depending on what you did. I put each item into a form, then submitted that when the page was finished. It's pretty simple code if you're good at JavaScript, if not search the internet for a while you'll find some examples. Best of luck. Nate Tobik (412)661-5700 x206 VigilantMinds -Original Message- From: Graham Anderson [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 23, 2005 10:45 PM To: php-general@lists.php.net Subject: [PHP] NetFlix Drag and Drop Row Ordering For those who have netflix, does anyone know how you would recreate their 'drag and drop' queue widget? basically, you can drag and drop movies in the order you choose is this a combination of javascript and php ? how would you go about creating something like this to order rows in your own CMS ? extremely cool g -- 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] count with match probelm
Richard Lynch wrote: ... $how_many = mysql_result(mysql_query(SELECT COUNT(*), MATCH(ad_sub, ad_text) AGAINST('$words') AS score from .$tcname.ads WHERE MATCH(ad_sub, ad_text) AGAINST('$words') FROM .$tcname.ads where is_confirmed=1),0); H. Actually, I *can* tell you that you shouldn't have FROM in there twice. You've messed up your query something awful with that. also he just wants the count with this statement so: 'MATCH(ad_sub,ad_text) AGAINST('$words') AS score' shouldn't be part of this query, instead: SELECT COUNT(*) FROM .$tcname.ads where is_confirmed=1 WHERE MATCH(ad_sub,ad_text) AGAINST('$words') -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How can I destroy parameters by page
Hello friends. IHow Can I destroy some variable that I pass by url, exmple: http://webadmin/paginas/personalidades.php?ac2=deleteitem=18# then when i get the varibale ac2 and item, I want to delete the value of this variable. how can I do? regards TOMAS - Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27 en el dominio de correo angerona.cult.cu y no se encontro ninguna coincidencia. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Meed a multiple merchant shopping cart please
Hi. I am looking for a shopping cart where we can have teh following : 1. Multiple vendors on our site, 2. Have accounts for all these vendors on how much sales, profits etc for each seller. 3. Have a delivery module 4. Warehouse inventory 5. Customer complaints Can anyone suggest a good PHP software for this please? Thanks in advance. DM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Meed a multiple merchant shopping cart please
freshmeat.net and search shopping carts check X-Cart (x-cart.com) - shopping mall version (I think it's xcart pro ili something like that) -afan Denis L. Menezes wrote: Hi. I am looking for a shopping cart where we can have teh following : 1. Multiple vendors on our site, 2. Have accounts for all these vendors on how much sales, profits etc for each seller. 3. Have a delivery module 4. Warehouse inventory 5. Customer complaints Can anyone suggest a good PHP software for this please? Thanks in advance. DM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How can I destroy parameters by page
[snip] IHow Can I destroy some variable that I pass by url, exmple: http://webadmin/paginas/personalidades.php?ac2=deleteitem=18# then when i get the varibale ac2 and item, I want to delete the value of this variable. how can I do? [/snip] http://www.php.net/unset -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I destroy parameters by page
I sorry I can't destroy of value variable by pass url I try this. unset($_SERVER['QUERY_STRING']); but the url have the same value. don't delete this value. what can i do? somebody can help me. regards TOMAS - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Tomás Rodriguez Orta [EMAIL PROTECTED]; [php] PHP General List php-general@lists.php.net Sent: Thursday, March 24, 2005 8:23 AM Subject: RE: [PHP] How can I destroy parameters by page [snip] IHow Can I destroy some variable that I pass by url, exmple: http://webadmin/paginas/personalidades.php?ac2=deleteitem=18# then when i get the varibale ac2 and item, I want to delete the value of this variable. how can I do? [/snip] http://www.php.net/unset -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27 en el dominio de correo angerona.cult.cu y no se encontro ninguna coincidencia. - Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27 en el dominio de correo angerona.cult.cu y no se encontro ninguna coincidencia. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XHTML to pdf converter
Dear friends, after an research on the subject, I have not been able to find an open source converter from XHTML to pdf, with full suport for CSS, with full support for tables. Is there anything like that out there that yu know about? -- symbulos partners -.- symbulos - ethical services for your organisation http://www.symbulos.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Preorder Modified Tree Traversal
Burhan Khalid mailto:[EMAIL PROTECTED] on Wednesday, March 23, 2005 10:25 PM said: Sitepoint has a great article that has PHP snippets on both pmtt and the flat drill-down method. http://www.sitepoint.com/article/hierarchical-data-database I would like to add that this is the article where I found out about pmtt. It's also the article where I got the functions for traversing/adjusting pmtt. In other words, the building blocks for whatever you need regarding pmtt are probably in that article. (At least that was the case for me.) Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How can I destroy parameters by page
Tomás Rodriguez Orta mailto:[EMAIL PROTECTED] on Thursday, March 24, 2005 12:19 PM said: IHow Can I destroy some variable that I pass by url, exmple: http://webadmin/paginas/personalidades.php?ac2=deleteitem=18# then when i get the varibale ac2 and item, I want to delete the value of this variable. how can I do? http://www.php.net/unset -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I destroy parameters by page
how about... just leave it? Why do you need to destroy it anyway? :S Tomás Rodriguez Orta wrote: I sorry I can't destroy of value variable by pass url I try this. unset($_SERVER['QUERY_STRING']); but the url have the same value. don't delete this value. what can i do? somebody can help me. regards TOMAS - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Tomás Rodriguez Orta [EMAIL PROTECTED]; [php] PHP General List php-general@lists.php.net Sent: Thursday, March 24, 2005 8:23 AM Subject: RE: [PHP] How can I destroy parameters by page [snip] IHow Can I destroy some variable that I pass by url, exmple: http://webadmin/paginas/personalidades.php?ac2=deleteitem=18# then when i get the varibale ac2 and item, I want to delete the value of this variable. how can I do? [/snip] http://www.php.net/unset -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27 en el dominio de correo angerona.cult.cu y no se encontro ninguna coincidencia. - Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27 en el dominio de correo angerona.cult.cu y no se encontro ninguna coincidencia. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] image problem
Hello, I really can't figure this out. Can someone help please. I've wasted hours already with this one. I'm trying to print image to a web page using fpassthru. Here's the code: $name = path/to/the/image/folder/img1.jpeg; $fp = fopen($name, 'rb'); // send the right headers header(Content-Type: image/jpeg); //also tested with type pjpeg header(Content-Length: . filesize($name)); // dump the picture fpassthru($fp); Help Appeciated. Thanks. -Will This code is basically straight from manual. I have verified that the images path is correct. When I test this I get a browserfull of junk like this: ñQÎ$ìÙåòpv{º:S¤d䱧'AêסöfçnßgýqZ;ji²ÃxYÝ3¬çõ:f±±-,ímfcNÒþÂ×Æéá³-ÔnÚ?÷IÛU`r÷¹ßùñê6Ú-Ky®Ó ÀZÛ-?ÕµîþÂç^w1®¨ºAdÀoV?Öν_ZÏÇY±bµÌÇ$Ay?Îä9¿êmo¤ßôKï°Të[/µÍsÆYôUØáÇ×^ ÐÉK$^û[»¥` 'DfüY¤å Ü{{q»Ò±«¼{zç4AñzÿºµòXZ}PX]\'à\[ÃÚ~·èØ~¨üçÐÄTÛßÏYêªm±ò\Ûê-Óasµjí¶q¹YKÇ¿?ößò'Õ_GÿÔàw;MzI÷fTï nãð¹)h÷a.fÆs'xUìÎÛí¨4ÿ(Jo~YÑs8P¶_s1ñêu·ZàÊë`Üç9ßE¬húNR{d *¨ç½îÞò\ï³Ò¬È§?ìp,±¤XƼs=Z5edPhy©Ä:Æ'°?0¡h±²Û?¬ÏÑ©S.}{ \Xö¦ÑËOþê+¢ ê¹ÿY°:eÛoçß`ÝVOéÿwÑ¢¯å»þ¶¸Îµõªu£éä¼U^Ó,ĪEr¬Y~Cÿ.gö-v=ûYaq{ýîsO-7îü¸Ä'áÅ?w-udË)i°J\ݤññOxOo$nY£0Úö'MÏ£ÿ,nSçv5¿Í¿/ßöwúvYúU.OOL1²ku7Òí-Tñiså?F*`æVç8áÁîÁ}ÐgTF¸ l±Æ{è{¤Hb¢tüKÓr;L'Ýæn\|[EMAIL PROTECTED] YØ?u·8öÁ,Bä-'?=Ö2ªsë-´?W[so÷¬®¶7Ü÷½ßA«S#oH¦Ü,rÔlkªÎÊa6ÛÓ°zßûo¨f7ùïè~ÿ«ú¯½`½Ý7§z¦Çú?i²oªú,Üæ~sn¹îû%Yàÿ]·ùÆT³sh@;)À³}:-ÛÍf84í /¨?_V?'Áü¶¦f-½?¿z#\K|'î?¾û}»$B°Ø'÷ê~~Èhè^ï¢BQWuù- Cº®/Øz\üü:úy?u´T ïéZwÒ{±ªß.Óàë¿þãzyYjg_vV5øîÙ}oßKÇ-±'eOþÍj2ÚÔ7cÚF£TNÒ¯õÜz*êV¿zz.[kÌÆgµä±¹M©±þ,Ë,Çÿ¬ª-ú[{¤:è)«*{üT[¢$§Ð4z'oÿÖâ² YI'¹kGÄ.G¦ãßöpFU¢tÞÿMþrYW·o£Xäaÿ©gýùXè¶6Z±vXpkªÄɾ'Ò{[Qoòc÷±mc¿ý$ÝW*OO»?g 0ð^ïEÆ[Ã}ù6ríÿ.ÈTÚéË8pNÃÛÀYÁN4aê»GéãÆ?Y,X§sqüòHøkP²_²-G/0ZÆíÇ ãh|?®Ho媺1¨oʱÝsGÍçîî?³aæÂ]òá¿ôQÙ~KfiÄÌIH[ü¾äF'¾ú¨î?íø;OÝCOÜZê/¥ Û[~Ò%®ZAþ[eS»Nþ¡S{4~T Ðä ˱ÕþÑò'èÓ~¾8ÙZÏü:¥WÝÏ õ®õ~ãYÜu,¶-ô`8ÿÒQ~Ðpí?sSf.9÷|ãðAk£§rs¢`îWå;vÿ[ÓOµ¯ÿ×ó¾ªÝ×zoÇ°ü,®]ú:nïQØï?Òj·vÛ]kwdíüSL?:-}ícè§ðÕxùËoðlÐFû?òÉûÖ÷ÕÆÓZ.,vE'Ö?a-¥õ9¤îýc{«¿ÛüÏóÿQsXnp{Ú磻?µý- óOÞ(ؤêØÔÕÔþÏOíØÁÓP$9Á¿KcË ú?£»óØ YO`æö¿9VÄlÜ]à?*;½ù½~Ùù'~RxÒZþM¦6??ömv.=÷º¦4W3¹ÖWK\ÝzíߤBf ¦Â̳¨ST\î¥áâ9Ð?iü¦Æö'Ìzi4AìõyØõ³êh¶o?Ù[1ð.Ñ.¯ºÊ±=?mOc= Yh²Ï´þzåóZzóþÎkÂ7Øö³oÓc2ßðMýpU?ÜjsÃ'êºöº¹5Ö÷3ÐûK]`ßöYL¿ÒfÿÐÛúÇôSý%ÏÑ8Æ?hqORc¨k×ðuC¿ìk7õ,ÇüN ïê#wzSïP¥Òzf0æÑvKÇò²®skÿÙl\wªRÑN£Äø'Ãaõ,rÝ#G¨ðÎÜ»áûªÖæÌùþMz$ò|IåNJ¢Þ¯ÿÐóË^öÛÃd±ße¿æ¹FêÉnfÜù¿Ä(c¿Ôcê:[EMAIL PROTECTED],wg ºÂ~A6F+?àø6pÛ .îJ.ZäZ|,z?mM5IÎñNå OVÝg² Í÷15¢D©¡BZä¿æ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Remove rows from a MySQL table?
Is it possible to remove a row(s) from a MySQL table? I looked through the PHP manual and didn't see anything about it. Phil Neeb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Remove rows from a MySQL table?
Phil Neeb mailto:[EMAIL PROTECTED] on Thursday, March 24, 2005 9:35 AM said: Is it possible to remove a row(s) from a MySQL table? I looked through the PHP manual and didn't see anything about it. Use the word delete instead of remove. In any case you have to tell MySQL which records you want to delete. DELETE FROM `table` WHERE `columnA` = 'valueA'; HTH, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Converting to a string
you could just use the time() or numbers of the date function From: PartyPosters [EMAIL PROTECTED] To: php-general@lists.php.net Subject: [PHP] Converting to a string Date: Wed, 23 Mar 2005 20:43:30 - MIME-Version: 1.0 Received: from lists.php.net ([216.92.131.4]) by mc10-f11.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 23 Mar 2005 12:46:08 -0800 Received: from ([216.92.131.4:3752] helo=lists.php.net)by pb1.pair.com (ecelerity HEAD r(5268)) with SMTPid 6E/E2-06694-265D1424 for [EMAIL PROTECTED]; Wed, 23 Mar 2005 15:45:22 -0500 Received: (qmail 40045 invoked by uid 1010); 23 Mar 2005 20:43:52 - Received: (qmail 39914 invoked by uid 1010); 23 Mar 2005 20:43:41 - X-Message-Info: JGTYoYF78jGnXCyUPttfpp6UKiZEgipk++L9rr4c6Ms= Return-Path: [EMAIL PROTECTED] X-Host-Fingerprint: 216.92.131.4 lists.php.net Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk list-help: mailto:[EMAIL PROTECTED] list-unsubscribe: mailto:[EMAIL PROTECTED] list-post: mailto:php-general@lists.php.net Delivered-To: mailing list php-general@lists.php.net Delivered-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] X-Host-Fingerprint: 62.241.163.7 blaster.systems.pipex.net Linux 2.4/2.6 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600. X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600. X-OriginalArrivalTime: 23 Mar 2005 20:46:08.0620 (UTC) FILETIME=[572A42C0:01C52FE9] Hello guys, i am using date(l dS of F Y h:i:s A) and want to put the value in a database as a string, How do I converting it to a string, this is what I have got so far:- $v_ship_date = date(l dS of F Y h:i:s A); Lots of thanks. - Original Message - From: PartyPosters To: php-general@lists.php.net Sent: Tuesday, March 22, 2005 10:01 PM Subject: Passing Arrays between pages Hello, Please can someone tell me how you pass arrays between PHP pages. I have tried something like this and have tried many variations of this but nothing working yet ; Page 1 $testArray[0] =Apple; $testArray[1] =Banana; $testArray[2] =Peach; echo INPUT NAME = \kcompany[]\ TYPE = \hidden\ VALUE=\$testArray\; Page2 echo $testArray[1]; On different variations of this I keep on getting 'Array' when I to return the variable on the second page Many Thanks. Kaan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remove rows from a MySQL table?
Phil Neeb wrote: Is it possible to remove a row(s) from a MySQL table? I looked through the PHP manual and didn't see anything about it. Call me crazy, but the MySQL manual _might_ have something about it. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] collapse SELECT from multiple tables
I'm trying to figure out the best way to handle a SELECT from multiple tables where a single ID in tableA relates to multiple ID's in tableB: SELECT tableA.ID, tableB.data FROM tableA, tableB WHERE tableA.ID=3 AND tableA.ID=tableB.tableAID What I'm trying to product is an array output similar to: | ID | data | | 3 | data1, data2, data3 | if the table data is represented by this: tableA | ID | something | | 1 | something1 | | 2 | something2 | | 3 | something3 | tableB | ID | tableAID | data | | 1 | 3| data1 | | 2 | 3| data2 | | 3 | 3| data2 | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 5.0.4RC2 rolled
All, There have been several fixes since RC1. If there are no show stoppers found, we hope to release the final 5.0.4 early next week. Source: http://downloads.php.net/zeev/php-5.0.4RC2.tar.gz http://downloads.php.net/zeev/php-5.0.4RC2.tar.bz2 Windows binaries: http://downloads.php.net/edink/php-5.0.4RC2-Win32.zip http://downloads.php.net/edink/php-debug-pack-5.0.4RC2-Win32.zip http://downloads.php.net/edink/pecl-5.0.4RC2-Win32.zip Test away! Zeev -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] collapse SELECT from multiple tables
David Christensen wrote: snip non php stuff Comeon guys, this is the PHP mailing list. The MySQL mailing list is over on the next block. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] html image
i would like to produce a script that can make an image (screenshot) based only on the site url. so that i enter an URL and php makes the picture. can such a thing be done by php? if not, maybe by some other language? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] html image
I have done this sort of thing with PDF's but I have never done it with images. It has also always been a web page that is on my site -- I get the impression that you want to read in someone else's url and do this. I would start off by looking at the ob_start and other related functions. Once you have the url in a variable I would think you can do whatever you want with it. ?php /* Stephen Johnson c | eh The Lone Coder http://www.thelonecoder.com [EMAIL PROTECTED] 562.924.4454 (office) 562.924.4075 (fax) continuing the struggle against bad code */ ? From: delos [EMAIL PROTECTED] Date: Thu, 24 Mar 2005 20:48:50 +0200 To: php-general@lists.php.net Subject: [PHP] html image i would like to produce a script that can make an image (screenshot) based only on the site url. so that i enter an URL and php makes the picture. can such a thing be done by php? if not, maybe by some other language? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] collapse SELECT from multiple tables
[snip] I'm trying to figure out the best way to handle a SELECT from multiple tables where a single ID in tableA relates to multiple ID's in tableB: SELECT tableA.ID, tableB.data FROM tableA, tableB WHERE tableA.ID=3 AND tableA.ID=tableB.tableAID What I'm trying to product is an array output similar to: | ID | data | | 3 | data1, data2, data3 | [/snip] SELECT a.foo, b.foobar FROM tableA a LEFT OUTER JOIN tableB b ON(a.id = b.id) SELECT p.users FROM php.list p LEFT OUTER JOIN mysql.list m ON (p.phpuserid = m.mysqluserid) GROUP BY p.users HAVING clue 0; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Preorder Modified Tree Traversal
Yeah, I read this article, and it works, but it doesn't set you up for a drill down scenario... Matt Babineau Criticalcode w: http://www.criticalcode.com p: 858.733.0160 e: [EMAIL PROTECTED] -Original Message- From: Chris W. Parker [mailto:[EMAIL PROTECTED] Sent: Thursday, March 24, 2005 8:55 AM To: Burhan Khalid; Matt Babineau Cc: php-general@lists.php.net Subject: RE: [PHP] Preorder Modified Tree Traversal Burhan Khalid mailto:[EMAIL PROTECTED] on Wednesday, March 23, 2005 10:25 PM said: Sitepoint has a great article that has PHP snippets on both pmtt and the flat drill-down method. http://www.sitepoint.com/article/hierarchical-data-database I would like to add that this is the article where I found out about pmtt. It's also the article where I got the functions for traversing/adjusting pmtt. In other words, the building blocks for whatever you need regarding pmtt are probably in that article. (At least that was the case for me.) Chris. -- 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] Remove rows from a MySQL table?
John Nichel wrote: Phil Neeb wrote: Is it possible to remove a row(s) from a MySQL table? I looked through the PHP manual and didn't see anything about it. Call me crazy, but the MySQL manual _might_ have something about it. Oh c'mon, you expect me to go look at a second website? That'd require effort! Thanks though. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] collapse SELECT from multiple tables
Jay Blanchard wrote: snip SELECT p.users FROM php.list p LEFT OUTER JOIN mysql.list m ON (p.phpuserid = m.mysqluserid) GROUP BY p.users HAVING clue 0; /snip I got zero results returned. ;) -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Preorder Modified Tree Traversal
Matt Babineau mailto:[EMAIL PROTECTED] on Thursday, March 24, 2005 10:49 AM said: Yeah, I read this article, and it works, but it doesn't set you up for a drill down scenario... I guess I don't understand what you mean then. I can display a tree just fine... Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] collapse SELECT from multiple tables
Your example doesn't produce the desired the results! The reason I posted to the PHP list was I thought I would have to apply some ARRAY functions to produce the output I'm looking for. Your example did nothing more than mine produced. On Thu, 2005-03-24 at 12:48 -0600, Jay Blanchard wrote: [snip] I'm trying to figure out the best way to handle a SELECT from multiple tables where a single ID in tableA relates to multiple ID's in tableB: SELECT tableA.ID, tableB.data FROM tableA, tableB WHERE tableA.ID=3 AND tableA.ID=tableB.tableAID What I'm trying to product is an array output similar to: | ID | data | | 3 | data1, data2, data3 | [/snip] SELECT a.foo, b.foobar FROM tableA a LEFT OUTER JOIN tableB b ON(a.id = b.id) SELECT p.users FROM php.list p LEFT OUTER JOIN mysql.list m ON (p.phpuserid = m.mysqluserid) GROUP BY p.users HAVING clue 0; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PhpUnit2 - Unit test framework
Hi, I am trying to use PHPUnit2 package under pear to run unit test for php scripts. Finally after pulling lotta hairs from my head, I am able to run phpunit command line utilty to run test. I am still not sure how to get the result of the test in xml (or text or html) format. phpUnit --help says by using it like this: /* Usage: phpunit [switches] UnitTest [UnitTest.php] --testdox-html file Log test progress in TestDox/HTML format to file. --testdox-text file Log test progress in TestDox/Text format to file. --log-xml file Log test progress in XML format to file. --loader loader TestSuiteLoader implementation to use. --skeleton Generate skeleton UnitTest class for Unit in Unit.php. --wait Waits for a keystroke after each test. --help Prints this usage information. --version Prints the version and exits. */ I tried using the following: 1) phpUnit Run.php It gives the result of test and other things on system out. (monitor) 2) phpUnit --testdox-html myHtmlFile.html UnitTest Run.php It still givest the result of the test on system output. 3) phpUnit --log-xml mylog.xml UnitTest Run.php The system cannot find the file specified. 4) phpUnit --log-xml mylog.xml UnitTest Run.php Still on system out. 5)phpUnit --log-xml c:/../../mylog.xml UnitTest Run.php Still on system out. Has anybody used this framework. I went to its site (http://www.phpunit.de/en/index.php) and still no detail documentation about its usage. Any help in this would be highly appreciated. Thanks! Regards, Dipesh
Re: [PHP] NetFlix Drag and Drop Row Ordering
thanks for the tip I am pretty unfamilar with javascript.. But for my purposes, I guess I better learn it I am fairly conversant in a couple of languages so hopefully it won't be too bad recommend a good book ? Essentially, I want CMS users to be order their own playlist of multimedia tracks. Is there any reason not to take a javascript approach ? because this would be for a CMS only the javascript does not have to work for EVERY browser Out of curiosity, are you still using this approach? Or, was it too problematic ? g On Mar 24, 2005, at 7:01 AM, Nathan Tobik wrote: I've used drag and drop row ordering before. The only PHP I used was to read a record set and write it out for the different items. The piece of code I used worked with JavaScript and html. Basically there was a large div, and each element inside of the main div was a div. It grabbed the onclick event, grabbed the coordinates of where you're moving the piece, and when you dropped it, the JavaScript bumped everything down, or up depending on what you did. I put each item into a form, then submitted that when the page was finished. It's pretty simple code if you're good at JavaScript, if not search the internet for a while you'll find some examples. Best of luck. Nate Tobik (412)661-5700 x206 VigilantMinds -Original Message- From: Graham Anderson [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 23, 2005 10:45 PM To: php-general@lists.php.net Subject: [PHP] NetFlix Drag and Drop Row Ordering For those who have netflix, does anyone know how you would recreate their 'drag and drop' queue widget? basically, you can drag and drop movies in the order you choose is this a combination of javascript and php ? how would you go about creating something like this to order rows in your own CMS ? extremely cool g -- 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] collapse SELECT from multiple tables
David Christensen mailto:[EMAIL PROTECTED] on Thursday, March 24, 2005 11:24 AM said: Your example doesn't produce the desired the results! The reason I posted to the PHP list was I thought I would have to apply some ARRAY functions to produce the output I'm looking for. Your example did nothing more than mine produced. Yeah but did you try the second query? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] collapse SELECT from multiple tables
[snip] Your example doesn't produce the desired the results! The reason I posted to the PHP list was I thought I would have to apply some ARRAY functions to produce the output I'm looking for. Your example did nothing more than mine produced. [/snip] It produces EXACTLY what you asked for in the OP. You didn't ask how do I make this look pretty with PHP? In order to do that, do this... echo tr; echo td.$id./td; while($id){ echo td.$data./td } echo /tr; Is that better Sparky? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] collapse SELECT from multiple tables
YES! All it does differently is truncate the output to one row per entry in tableA. On Thu, 2005-03-24 at 11:35 -0800, Chris W. Parker wrote: David Christensen mailto:[EMAIL PROTECTED] on Thursday, March 24, 2005 11:24 AM said: Your example doesn't produce the desired the results! The reason I posted to the PHP list was I thought I would have to apply some ARRAY functions to produce the output I'm looking for. Your example did nothing more than mine produced. Yeah but did you try the second query? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] collapse SELECT from multiple tables
NO Spanky! I figured it was implied that I was looking for a PHP solution since I posted to a PHP list! I also didn't ask for help with HTML output. I was asking for help with PHP output! Let me try to explain it a little better... I need to produce an array of results from two tables. The first table contains the unique records, let's call it 'customers'. The second table, let's call it 'orders', contains records that are referenced to 'customers' via a 'customerID' field that correlates to the 'ID' (primary_key) field in 'customers'. What I'm after is a multidimensional array that contains a list of information which includes 'ID' from customers, 'name' from customers and 'order_info' from 'orders' which is collapsed into a field of the new multidimensional array similar to the following: OUTPUT equivalent to $array[0] = array('ID' = 1, 'name' = 'joe', 'order_info' = 'part1, part2, part3'); $array[1] = array('ID' = 2, 'name' = 'jim', 'order_info' = 'part1, part5, part9'); $array[2] = array('ID' = 3, 'name' = 'moe', 'order_info' = 'part2, part3, part7'); 'customers' | ID | name | | 1 | joe | | 2 | jim | | 3 | moe | 'orders' | ID | customerID | part | | 1 | 1 | part1 | | 2 | 1 | part2 | | 3 | 1 | part3 | | 4 | 2 | part1 | | 5 | 2 | part5 | | 6 | 2 | part9 | | 7 | 3 | part2 | | 8 | 3 | part3 | | 9 | 3 | part7 | Hope this clears it up a bit. On Thu, 2005-03-24 at 13:46 -0600, Jay Blanchard wrote: [snip] Your example doesn't produce the desired the results! The reason I posted to the PHP list was I thought I would have to apply some ARRAY functions to produce the output I'm looking for. Your example did nothing more than mine produced. [/snip] It produces EXACTLY what you asked for in the OP. You didn't ask how do I make this look pretty with PHP? In order to do that, do this... echo tr; echo td.$id./td; while($id){ echo td.$data./td } echo /tr; Is that better Sparky? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] collapse SELECT from multiple tables
[snip] I figured it was implied that I was looking for a PHP solution since I posted to a PHP list! [/snip] Bad assumption. [snip] I also didn't ask for help with HTML output. I was asking for help with PHP output! [/snip] I did it with PHP [snip] Let me try to explain it a little better... [/snip] Finally, a smarter question... [snip] blah, blah, blah about multidimensional arrays [/snip] Simply take the output that I performed for PHP-HTML and convert to PHP-array...it works the same way. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Storing Arrays in a database
Hey, I was curious if anyone here stores arrays in MySQL... and how r u doing this... are you converting the values to a delimited string or is there another way? Thanks Joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] collapse SELECT from multiple tables
David Christensen mailto:[EMAIL PROTECTED] on Thursday, March 24, 2005 12:07 PM said: NO Spanky! I figured it was implied that I was looking for a PHP solution since I posted to a PHP list! I also didn't ask for help with HTML output. I was asking for help with PHP output! Yikes. Let me try to explain it a little better... I need to produce an array of results from two tables. The first table contains the unique records, let's call it 'customers'. The second table, let's call it 'orders', contains records that are referenced to 'customers' via a 'customerID' field that correlates to the 'ID' (primary_key) field in 'customers'. Yes, this is called a one-to-many relationship. What I'm after is a multidimensional array that contains a list of information which includes 'ID' from customers, 'name' from customers and 'order_info' from 'orders' which is collapsed into a field of the new multidimensional array similar to the following: OUTPUT equivalent to $array[0] = array('ID' = 1, 'name' = 'joe', 'order_info' = 'part1, part2, part3'); $array[1] = array('ID' = 2, 'name' = 'jim', 'order_info' = 'part1, part5, part9'); $array[2] = array('ID' = 3, 'name' = 'moe', 'order_info' = 'part2, part3, part7'); Did you read the manual? The PHP functions for MySQL already do this automatically! In fact they organize the output even better! Start here: http://us4.php.net/mysql. (HINT: mysql_fetch_array().) Next time don't be hostile and post a more clearly worded question[1]. You'll save everyone a lot of time. Chris. [1] Read here: www.catb.org/~esr/faqs/smart-questions.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Storing Arrays in a database
Joe Harman mailto:[EMAIL PROTECTED] on Thursday, March 24, 2005 12:15 PM said: I was curious if anyone here stores arrays in MySQL... and how r u doing this... are you converting the values to a delimited string or is there another way? http://php.net/serialize and http://php.net/unserialize are probably what you want. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing Arrays in a database
check serialize() and unserialize() in manual. implode() and explode() functions too. -afan Joe Harman wrote: Hey, I was curious if anyone here stores arrays in MySQL... and how r u doing this... are you converting the values to a delimited string or is there another way? Thanks Joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing Arrays in a database
Joe Harman wrote: Hey, I was curious if anyone here stores arrays in MySQL... and how r u doing this... are you converting the values to a delimited string or is there another way? Thanks Joe http://us4.php.net/serialize -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Storing Arrays in a database
k.. in the past i have been using implode and explode... i have yet to try serialize yet... but i will be giving it a whirled in about 5 minutes... Thanks... just looking for a better way to do things Cheers thanks for the help! Joe On Thu, 24 Mar 2005 14:23:05 -0600, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: check serialize() and unserialize() in manual. implode() and explode() functions too. -afan Joe Harman wrote: Hey, I was curious if anyone here stores arrays in MySQL... and how r u doing this... are you converting the values to a delimited string or is there another way? Thanks Joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] html image
Hello delos, Thursday, March 24, 2005, 11:48:50 AM, you wrote: d i would like to produce a script that can make an image d (screenshot) based only on the site url. so that i enter an URL d and php makes the picture. Hmmm. It can be done. See http://www.whois.sc/www.php.net But I'm just not sure quite how. I can think of a lot of scenarios, but I don't know if I'm even in the right ballpark. You might be able to e-mail those guys and ask how they do it. You might get lucky. If you figure it out, let us know though. It's kinda neat. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.9 Return (pre-beta) under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with header in an if
/* send the errors to the interface and exit*/ if('' !== $errorsReported){ for($i = 0; $i count($errorsReported); $i++){ echo $errorsReported[$i]; } } else { /* reload the empty interface */ header(Location: adminTicketMgmtCreationForm.php); } The above does not work on the else statement. If $errorsReported is blank the header statement does not work, the script just exits. I have had a long day and I may not be seeing something correctly, can anyone see an error with this? If so, can you tell me where I am going wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Full-text searches sucks?
Ryan A [EMAIL PROTECTED] writes: Hey, I dont want to do that as its only mysql 4.1+ compatable, IN BOOLEAN MODE was added in version 4.0.1 not 4.1, for what it's worth. Oops, thats what i meant. The problem is a LOT of hosts are still on 3.23.xx so I dont want to do the BOOLEAN MODE thing. Here is the workaround that I used. - If the search term is smaller than 3 words, I did a LIKE. - If the search term is greater than 3 words, do a fulltext search i.e. MATCH AGAINST (no BOOLEAN MODE) - If the fulltext search did not find any results, do the search again, but this time use LIKE instead of MATCH AGAINST. This gave me good enough results. -- Raj Shekhar Y! : Operations Engineer MySQL DBA, programmer and slacker Y!IM : lunatech3007 home : http://rajshekhar.net blog : http://rajshekhar.net/blog/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] NetFlix Drag and Drop Row Ordering
Here is the code we used at the time: http://dhtmlkitchen.com/scripts/draglib/index.jsp I modified it a bit to meet our needs, if you're doing an open-source project it's free to use. In my experience if you take your time JavaScript can be made to work in any browser. We actually don't use the code anymore, the needs of the application changed, so we went from the drag and drop ordering to a sorting method using arrows to indicate up and down. It is still driven by JavaScript. I never read any books on JavaScript, it's similar syntactically to PHP or any language like that, the big thing is to learn the JavaScript DOM. I just found some good reference pages and learned from there. I have the most useful ones memorized, anything else I'll Google for it. If you can code in PHP JavaScript will be a piece of cake. The advantage of JavaScript over PHP is that it's client side. This means you don't have to do a page reload for each action a user takes. You can sort tracks in your application with PHP but each time a user selects an item to move up you have to submit the page, then re-present the page. With JavaScript the user can reorder all they want, then submit the page once. I then take the list of items in the new order and submit them to the DB. Best of luck... Nate Tobik (412)661-5700 x206 VigilantMinds -Original Message- From: Graham Anderson [mailto:[EMAIL PROTECTED] Sent: Thursday, March 24, 2005 2:29 PM To: php-general@lists.php.net; Nathan Tobik Subject: Re: [PHP] NetFlix Drag and Drop Row Ordering thanks for the tip I am pretty unfamilar with javascript.. But for my purposes, I guess I better learn it I am fairly conversant in a couple of languages so hopefully it won't be too bad recommend a good book ? Essentially, I want CMS users to be order their own playlist of multimedia tracks. Is there any reason not to take a javascript approach ? because this would be for a CMS only the javascript does not have to work for EVERY browser Out of curiosity, are you still using this approach? Or, was it too problematic ? g -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] collapse SELECT from multiple tables
My apologies! I thought I was giving what I was getting as far as the angle of my post. I still don't think everyone is understanding what I'm after here though. I know how to use the mysql functions in PHP. That is not my problem. I'm trying to avoid having to make multiple queries to the db in order to combine two array results. I understand this is a one-to-many relationship, but I'm not really after the default output that produces. I want the 'many' to be a single element in the customer line array (referencing my last post.) So if the result is that customer '1' has ordered 3 items, and each item is a separate line in the 'orders' table that get returned from the query, I want an array of: $array[0] = ('ID' = 1, 'name' = 'joe', 'items' = 'part1, part2, part3'); I don't know how to say it any plainer than that. The original post would have produced the following: 1, 'joe', 'part1' 1, 'joe', 'part2' 1, 'joe', 'part3' but what I'd like to get is: 1, 'joe', 'part1, part2, part3' Thanks for your help. I think I may have to redesign this thing to make this easier or I maybe I just don't have the vocabulary to ask the question correctly. On Thu, 2005-03-24 at 12:17 -0800, Chris W. Parker wrote: David Christensen mailto:[EMAIL PROTECTED] on Thursday, March 24, 2005 12:07 PM said: NO Spanky! I figured it was implied that I was looking for a PHP solution since I posted to a PHP list! I also didn't ask for help with HTML output. I was asking for help with PHP output! Yikes. Let me try to explain it a little better... I need to produce an array of results from two tables. The first table contains the unique records, let's call it 'customers'. The second table, let's call it 'orders', contains records that are referenced to 'customers' via a 'customerID' field that correlates to the 'ID' (primary_key) field in 'customers'. Yes, this is called a one-to-many relationship. What I'm after is a multidimensional array that contains a list of information which includes 'ID' from customers, 'name' from customers and 'order_info' from 'orders' which is collapsed into a field of the new multidimensional array similar to the following: OUTPUT equivalent to $array[0] = array('ID' = 1, 'name' = 'joe', 'order_info' = 'part1, part2, part3'); $array[1] = array('ID' = 2, 'name' = 'jim', 'order_info' = 'part1, part5, part9'); $array[2] = array('ID' = 3, 'name' = 'moe', 'order_info' = 'part2, part3, part7'); Did you read the manual? The PHP functions for MySQL already do this automatically! In fact they organize the output even better! Start here: http://us4.php.net/mysql. (HINT: mysql_fetch_array().) Next time don't be hostile and post a more clearly worded question[1]. You'll save everyone a lot of time. Chris. [1] Read here: www.catb.org/~esr/faqs/smart-questions.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with header in an if
Jay Blanchard mailto:[EMAIL PROTECTED] on Thursday, March 24, 2005 12:34 PM said: I don't know if either of these two things will make a difference but here they are anyway. /* send the errors to the interface and exit*/ if('' !== $errorsReported){ Why not if(!empty($errorsReported))? } else { /* reload the empty interface */ header(Location: adminTicketMgmtCreationForm.php); } Also the Location header should(?) receive a FQDN (although I know it works sans FQDN) and I think I read in the manual or somewhere that you should put an exit; after it. .02 Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP MYSQL table locking
I understand table locking with MYSQL. My concern is this. What happens if a php script issues a LOCK, and then somehow crashes without issuing an UNLOCK? All other scripts will not be able to access the LOCKed tables. What is the solution for a situation like this? It will be pretty unlikely, but I'm curious if there is anything I can do to mitigate this situation. -- -James Tu --- ESI Design 111 Fifth Avenue 12th floor New York, NY 10003 (212) 989-3993 ext. 357 (212) 673-4061 (fax) --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header in an if
/* send the errors to the interface and exit*/ if('' !== $errorsReported){ for($i = 0; $i count($errorsReported); $i++){ echo $errorsReported[$i]; } } else { /* reload the empty interface */ header(Location: adminTicketMgmtCreationForm.php); } Jay, Maybe try... if(!empty($errorsReported)) { instead of... if('' !== $errorsReported){ David
RE: [PHP] Problem with header in an if
[snip] /* send the errors to the interface and exit*/ if('' !== $errorsReported){ for($i = 0; $i count($errorsReported); $i++){ echo $errorsReported[$i]; } } else { /* reload the empty interface */ header(Location: adminTicketMgmtCreationForm.php); } [/snip] I have tried ... 0 count($errorsReported) 0 != 0 !== isset($errorReported) !empty '' != '' !== I tried reversing the order in the statement itself, no go. And Chris, thanks for the heads up, I put the exit() and the FQDN in there. I am headed out for the afternoon, perhaps a clearer head will prevail in the morning! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] collapse SELECT from multiple tables
David Christensen mailto:[EMAIL PROTECTED] on Thursday, March 24, 2005 12:34 PM said: I don't know how to say it any plainer than that. The original post would have produced the following: 1, 'joe', 'part1' 1, 'joe', 'part2' 1, 'joe', 'part3' but what I'd like to get is: 1, 'joe', 'part1, part2, part3' I think this is the explanation we needed. Serious question: Is it that you want someone to write the loop for your do you just need some ideas? Thanks for your help. I think I may have to redesign this thing to make this easier or I maybe I just don't have the vocabulary to ask the question correctly. A redesign sounds good. Maybe instead of trying to make an oddly structured array you can instead adjust the code that receives the array to receive the unmodified array? Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fopen problems
Hello all, I have an install of php on a Red Hat Ent. server that is giving me fits. I have been trying to use the fopen command to retreive files from external sites and have been getting this error: Warning: fopen(http://us3.php.net/images/php.gif): failed to open stream: HTTP request failed! in /home/test/public_html/declare.php on line 2 My code is as follows: ? if($handle=fopen(http://us3.php.net/images/php.gif,r;)) { echo \n\nOPENED REMOTE FILE\n\n; while (!feof($handle)) { $buffer = fgets($handle,4096); echo $buffer; } fclose($handle); } else echo \n\nFAILED TO OPEN REMOTE FILE\n\n; ? My Fopen section of my php.ini file. ;; ; Fopen wrappers ; ;; ; Whether to allow the treatment of URLs (like http:// or ftp://) as files. allow_url_fopen = On ; Define the anonymous ftp password (your email address) ;from=[EMAIL PROTECTED] ; Define the User-Agent string ; user_agent=PHP ; Default timeout for socket based streams (seconds) default_socket_timeout = 60 ; If your scripts have to deal with files from Macintosh systems, ; or you are running on a Mac and need to deal with files from ; unix or win32 systems, setting this flag will cause PHP to ; automatically detect the EOL character in those files so that ; fgets() and file() will work regardless of the source of the file. ; auto_detect_line_endings = Off As I stated before This is on a Red Hat Ent Server that is connected to the internet behind a SonicWall (300 I believe) firewall appliance. I am able to use the fget command to retrieve files from sites that are also behind said firewall. Any help anyone could give me would be greatly appreciated. AJ Lemke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] collapse SELECT from multiple tables
Thanks, I just use my original SQL and setup a foreach loop to compare the 'ID' to see whether or not a record was returned with multiple row results. I was just hoping someone had all ready figured out some kool, neato, voodoo-magic way to handle a one-to-many result like this. On Thu, 2005-03-24 at 13:02 -0800, Chris W. Parker wrote: David Christensen mailto:[EMAIL PROTECTED] on Thursday, March 24, 2005 12:34 PM said: I don't know how to say it any plainer than that. The original post would have produced the following: 1, 'joe', 'part1' 1, 'joe', 'part2' 1, 'joe', 'part3' but what I'd like to get is: 1, 'joe', 'part1, part2, part3' I think this is the explanation we needed. Serious question: Is it that you want someone to write the loop for your do you just need some ideas? Thanks for your help. I think I may have to redesign this thing to make this easier or I maybe I just don't have the vocabulary to ask the question correctly. A redesign sounds good. Maybe instead of trying to make an oddly structured array you can instead adjust the code that receives the array to receive the unmodified array? Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Storing data structires in DB
Output of serialize() is barely readable and definetely is not suited for manual editing. It is quite simple to create var_export() clone that does not add junk to it's output. But then I would need to exec() the string to get a data structure back, which is bad security practice. Is there any good way to store/retrieve data structures (multidimetional arrays) to/from database? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with header in an if
Jay Blanchard mailto:[EMAIL PROTECTED] on Thursday, March 24, 2005 1:00 PM said: I have tried ... 0 count($errorsReported) 0 != 0 !== isset($errorReported) !empty '' != '' !== Have you tried explicitly setting $errorsReported to to see where it goes? $errorsReported = ; if(!empty($errorsReported)) { // do loop } else { // do redirect } Also, are you sure your program is even GETTING that far? Maybe the program is stopping before the point in question. And Chris, thanks for the heads up, I put the exit() and the FQDN in there. In that case may I suggest the following function: function redirect($location) { header(Location: .FQDN_CONSTANT.$location); exit; } Makes things easier down the road. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Storing data structires in DB
GamblerZG mailto:[EMAIL PROTECTED] on Thursday, March 24, 2005 1:15 PM said: Output of serialize() is barely readable and definetely is not suited for manual editing. [snip /] Is there any good way to store/retrieve data structures (multidimetional arrays) to/from database? Maybe I missed something... So why is serialize not any good? Is it because of the way it looks when it's printed? Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pagination
I am wanting to paginate records from a MySQL Database. I want there to be 5 records on a page, on multiple pages. example for selecting page of records from mysql table: $sql=sprintf( SELECT SQL_CALC_FOUND_ROWS * FROM table LIMIT %d, %d, $position*$records, $records ); after get count of all records: $sql='SELECT FOUND_ROWS()'; (I would like there to be a next and previous.) you can use http://pear.php.net/package/Pager -- Pavel Vrany http://ogi.cz/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: fopen problems
AJ Lemke wrote: Hello all, I have an install of php on a Red Hat Ent. server that is giving me fits. I have been trying to use the fopen command to retreive files from external sites and have been getting this error: Warning: fopen(http://us3.php.net/images/php.gif): failed to open stream: HTTP request failed! in /home/test/public_html/declare.php on line 2 Servers are occasionally down. I think the us3 mirror was down for quite a while today (us4, us2 and www all worked when I tried them earlier). In my signature do you notice how I have the php.net site without indicating which mirror I want? That's because making the request in *that* way will let the php.net site determine which mirror to use for your request. Perhaps you will have better luck in the future if you try to; ?php fopen('http://php.net/images/php.gif', 'r'); ? -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
Re: [PHP] Storing data structires in DB
GamblerZG wrote: Output of serialize() is barely readable and definetely is not suited for manual editing. It is quite simple to create var_export() clone that does not add junk to it's output. But then I would need to exec() the string to get a data structure back, which is bad security practice. Is there any good way to store/retrieve data structures (multidimetional arrays) to/from database? Huh? Why would you _manually_ edit a serialized array??? One would think you would UNSERIALIZE (http://us4.php.net/unserialize) the serialized array *before* working with the data. But that's just me. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I destroy parameters by page
IHow Can I destroy some variable that I pass by url, exmple: http://webadmin/paginas/personalidades.php?ac2=deleteitem=18# then when i get the varibale ac2 and item, I want to delete the value of this variable. unset($_GET['item']) ? http://www.php.net/manual/en/function.unset.php -- Pavel Vrany http://ogi.cz/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting the process ID
Hi All, I am doing some work where I want to do locking, and prevent scripts from running in parallel. I see that I could use the semaphore mechanism, but I'd like for my code to be portable, and that extension is not enabled in many places. I need some way for a process to uniquely identify itself. It can then look at the storage container (flat file, DB, whatever is appropriate in context), check to see if the requested semaphore is available, and if it is, acquire it and then mark itself as the owner. It can then check that it did in fact get ownership (as opposed to another process which attempted to acquire it at the exact same moment) before proceeding. However I am stumped at the point where it needs to indicate ownership. How does the PHP script identify itself? It can't use the script name, obviously - lots of instances of the script may be running. It can't use session ID - the user might submit duplicate requests, and they would both have the same session ID. The best I have been able to think of is to use the sha1(microtime()) to generate a unique key. But this isn't quite foolproof, as it is theoretically possible, though unlikely, for two requests to be at the exact same instant. The answer that comes to my mind would be to use the process ID. This is necessarily unique across the entire server, correct? It seems to be exactly what I need. But I can't seem to figure out how to determine the current process ID from within PHP. Is this even possible? Apache 1.3.x/PHP5.0.3 Any ideas? -Josh p.s. Please forgive me if I have misused the term semaphore - I know it only from the context I have seen/heard it used in, I don't know the textbook definition. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Storing data structires in DB
GamblerZG [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Output of serialize() is barely readable and definetely is not suited for manual editing. It is quite simple to create var_export() clone that does not add junk to it's output. But then I would need to exec() the string to get a data structure back, which is bad security practice. Is there any good way to store/retrieve data structures (multidimetional arrays) to/from database? You should look into the WDDX functions - http://php.net/wddx/ - they give you an XML document that you can edit by hand much more easily than the bytestream you get from serialize. However it is not as compact as serialize, and not only that it suffers from what I consider a showstopped bug. This bug in the WDDX serialization causes you to run into trouble if you have a numerically indexed array that does not start at 0. For instance: //$data[0] = 'uncomment me and things will work'; $data[1] = foo; $data[2] = bar; $serialized = wddx_serialize_value($data); $result = wddx_deserialize($serialized); echo gettype($result[1]); The output is NULL - it is now impossible directly access anything in the $result array. It is still there - you can see this if you var_dump($result) or iterate through it with foreach($result as $entry). HTH, -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting the process ID
Joshua Beall wrote: I am doing some work where I want to do locking, and prevent scripts from running in parallel. I see that I could use the semaphore mechanism, but I'd like for my code to be portable, and that extension is not enabled in many places. Sort of defeats the whole concept of a web server, but to answer just your process id question, use getmypid() -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Getting the process ID
Rasmus Lerdorf [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Joshua Beall wrote: I am doing some work where I want to do locking, and prevent scripts from running in parallel. I see that I could use the semaphore mechanism, but I'd like for my code to be portable, and that extension is not enabled in many places. Sort of defeats the whole concept of a web server, but to answer just your process id question, use getmypid() http://php.net/manual/en/function.getmypid.php It says Process IDs are not unique I really only need it to be unique at any given instant. I can do sha1(microtime().getmypid()) to generate a unique ID. But of course it is only guaranteed to be unique if indeed the process ID is not shared. The problem I am having is that people are double-submitting certain transactions. My first attempt to prevent this was to store a flag in the session record indicating whether or not certain transactions had been completed, but this turned out to be insufficient at times because users could try and initiate a second transaction before the first transaction had finished (and thus the system had not yet flagged the transaction completed in the session record). They then both completed in parallel, and voila, duplicate transactions again. I realized that this sort of problem would always exist unless I had some sort of semaphore mechanism. Once a user has *started* a transaction, they need to be prevented from initiating a second transaction until the first transaction has been completed. I am open to suggestions on how to do this. What is the best way? -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header in an if
Jay Blanchard wrote: /* send the errors to the interface and exit*/ if('' !== $errorsReported){ for($i = 0; $i count($errorsReported); $i++){ echo $errorsReported[$i]; } } else { /* reload the empty interface */ a quick echo statement here to check that this block is running when you expect it to might tell you something... but you have probably already plastered your code with echo/print statements to determine the flow :-) header(Location: adminTicketMgmtCreationForm.php); } The above does not work on the else statement. If $errorsReported is blank the header statement does not work, the script just exits. I have had a long day and I may not be seeing something correctly, can anyone see an error with this? If so, can you tell me where I am going wrong? having read the other replies to this post I'm a little perplexed... I was wondering if adminTicketMgmtCreationForm.php isn't crashing? I sometimes get into a situation where an include file has a syntax error that causes complete failure (blank screen, nothing in log), I have had the same on occasion with require_once() statements that fail so maybe the redirect is working only the destination page is silently dying on you I assume that you are not outputting anything before the call to header. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image problem
Hi, Friday, March 25, 2005, 3:27:41 AM, you wrote: WS Hello, WS I really can't figure this out. Can someone help please. I've wasted hours WS already with this one. WS I'm trying to print image to a web page using fpassthru. Here's the code: WS $name = path/to/the/image/folder/img1.jpeg; WS $fp = fopen($name, 'rb'); WS // send the right headers WS header(Content-Type: image/jpeg); //also tested with type pjpeg WS header(Content-Length: . filesize($name)); WS // dump the picture WS fpassthru($fp); WS Help Appeciated. Thanks. WS -Will Make sure you don't have any whitespace after the trailing ? if there is one, better still get rid of it. Also I use readfile($name); ... can't remember why Here is a bit of code I use for passing PDF files which also handles caching control you can adapt easily for images. ?php $cache_time = false; $requested_time = false; $filename = $_REQUEST{'filename']; if(file_exists($filename)){ $len = filesize[$filename); $mtime = filemtime($filename); $cache_time = gmdate('D, d M Y H:i:s', $mtime) . ' GMT'; header('Last-Modified: '.$cache_time); $rt = false; if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])){ $rt = $_SERVER['HTTP_IF_MODIFIED_SINCE']; } if($rt) $requested_time = strtotime($rt); if($requested_time $cache_time){ if($requested_time == $cache_time){ Header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified'); exit; } } header(Accept-Ranges: bytes); header('Cache-Control: no-cache, must-revalidate'); header(Content-type: application/pdf); header(Content-Length: $len); readfile($filename); } -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php