php-general Digest 12 Nov 2006 17:40:42 -0000 Issue 4455
php-general Digest 12 Nov 2006 17:40:42 - Issue 4455 Topics (messages 244512 through 244523): Re: How do you do the ? mark after a filename 244512 by: John Meyer Re: PEAR and MDB2 244513 by: Alain Roger 244517 by: Roman Neuhauser 244521 by: Alain Roger 244522 by: Alain Roger Re: Staff log-in 244514 by: IMADICA_MOKULEN PEAR::MDB2 andquery 244515 by: Alain Roger Max File Upload Size 244516 by: Tom Chubb 244518 by: T.Lensselink spot the mistake 244519 by: Ross Re: convert postgres date to PHP 244520 by: Roman Neuhauser PHP product licensing... 244523 by: Jon Anderson 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--- the ? is a delimiter between the url and the get variables, which are set by the script itself, either through forms or by scripts. Thomas Bonham wrote: Hi All, I keep seeing the ? mark after many file names index.php?id=234. So what I would like to know is how do you make them. I have heard that they can make a programs life sampler when doing somethings with a database. Thank you, Thomas ---End Message--- ---BeginMessage--- so when i have this code : $options = array('debug' = 2, 'portability' = MDB2_PORTABILITY_ALL, ); $query = 'SELECT * from sp_u_001(\'all\')'; $db2 = new MDB2_Driver_pgsql(); $db2-connect($dsn); if (PEAR::isError($db2)) { die(Error connection : .$db2-getMessage()); } $res = $db2-exec($query); if (PEAR::isError($res)) { die(Error connection : .$res-getMessage()); } i get this error == Error connection : MDB2 Error: unknown error (from $res control) Alain On 11/11/06, Roman Neuhauser [EMAIL PROTECTED] wrote: # [EMAIL PROTECTED] / 2006-11-11 12:02:37 +0100: require_once 'Pear/MDB2.php'; $dsn = 'pgsql://login:[EMAIL PROTECTED]'; $mdb2 = MDB2::connect($dsn); if (PEAR::isError($mdb2)) { die($mdb2-getMessage()); } $res = $mdb2-query('SELECT * FROM articles'); if (PEAR::isError($res)) { die($res-getMessage()); } while ($row = $res-fetchRow(MDB2_FETCHMODE_ASSOC)) { echo $row['title'] . ', ' . $row['content'] . \n; } $res-free(); -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 ---End Message--- ---BeginMessage--- # [EMAIL PROTECTED] / 2006-11-12 09:46:34 +0100: so when i have this code : $options = array('debug' = 2, 'portability' = MDB2_PORTABILITY_ALL, ); $query = 'SELECT * from sp_u_001(\'all\')'; $db2 = new MDB2_Driver_pgsql(); $db2-connect($dsn); if (PEAR::isError($db2)) { die(Error connection : .$db2-getMessage()); } $res = $db2-exec($query); if (PEAR::isError($res)) { die(Error connection : .$res-getMessage()); } i get this error == Error connection : MDB2 Error: unknown error (from $res control) http://pear.php.net/manual/en/package.database.mdb2.intro-query.php says: exec() should be used for manipulation queries. IOW, you should use query() for SELECTS, exec() for other statements. Perhaps that's your problem? -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 ---End Message--- ---BeginMessage--- but the problem is before: $mdb2 = MDB2::connect($dsn); if (PEAR::isError($mdb2)) { die($mdb2-getMessage().brbr.$db2-getUserinfo()); } generate a : MDB2 Error: not found connect: [Error message: extension pgsql is not compiled into PHP] ** pgsql(pgsql)://login:[EMAIL PROTECTED]:5432/mydbname how is it possible ? when i control the php.ini and phpinfo() i see that pgsql is install and activated. So, what did i miss ? Al. On 11/12/06, Roman Neuhauser [EMAIL PROTECTED] wrote: # [EMAIL PROTECTED] / 2006-11-12 09:46:34 +0100: so when i have this code : $options = array('debug' = 2, 'portability' = MDB2_PORTABILITY_ALL, ); $query = 'SELECT * from sp_u_001(\'all\')'; $db2 = new MDB2_Driver_pgsql(); $db2-connect($dsn); if (PEAR::isError($db2)) { die(Error connection : .$db2-getMessage()); } $res = $db2-exec($query); if (PEAR::isError($res)) { die(Error connection : .$res-getMessage()); } i get this error == Error connection : MDB2 Error:
php-general Digest 13 Nov 2006 05:47:23 -0000 Issue 4456
php-general Digest 13 Nov 2006 05:47:23 - Issue 4456 Topics (messages 244524 through 244542): Re: spot the mistake 244524 by: Jochem Maas 244529 by: Robert Cummings 244530 by: Curt Zirzow 244531 by: Robert Cummings Re: activation through email 244525 by: Jochem Maas Re: PHP product licensing... 244526 by: Rory Browne Re: Encoder efficiency 244527 by: Jochem Maas Re: PEAR::MDB2 andquery 244528 by: Alain Roger Parsing brackets in text 244532 by: Dotan Cohen 244533 by: Chris 244534 by: Dotan Cohen 244535 by: Dotan Cohen 244536 by: Chris 244537 by: Chris 244538 by: Dotan Cohen Mysql strategy 244539 by: Dotan Cohen 244540 by: Chris Re: How do you do the ? mark after a filename 244541 by: Thomas Bonham 244542 by: J R 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--- Ross wrote: echo ('a href=# onclick=window.open(\'news/old_news_list.php?month=$jamp;year='.$i.'\',\'\',\'width=700,height=500\'); return false \ $thisMonth/a'); t my first guess is that you've back-slashed something you shouldn't have - try breaking it down (and/or looking at the html source) ... $url = news/old_news_list.php?month=$jamp;year=$i; $js = window.open('%s','','width=700,height=500'); return false;; $lnk = 'a href=# onclick=.$js. %s/a printf($lnk, $url, $thisMonth); I am trying to get this to open in a popup however it doess not open and I cannot work out why. Must be a syntax arror as the page displays ok. Ross ---End Message--- ---BeginMessage--- On Sun, 2006-11-12 at 15:21 +, Ross wrote: echo ('a href=# onclick=window.open(\'news/old_news_list.php?month=$jamp;year='.$i.'\',\'\',\'width=700,height=500\'); return false \ $thisMonth/a'); I am trying to get this to open in a popup however it doess not open and I cannot work out why. Must be a syntax arror as the page displays ok. $j and $thisMonth need to be moved outside of the string so that PHP will expand their values. Not sure if that will fix the popup not opening at all issue. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' ---End Message--- ---BeginMessage--- On 11/12/06, Ross [EMAIL PROTECTED] wrote: echo ('a href=# onclick=window.open(\'news/old_news_list.php?month=$jamp;year='.$i.'\',\'\',\'width=700,height=500\'); return false \ $thisMonth/a'); Just remove any question on what is wrong: $thisUrl = news/old_news_list.php?month=$jamp;year=$i; ? a href=?php echo $thisUrl;? onClick=window.open('?php echo $thisUrl;','','width=700,height=500'); return false; $thisMonth/a ?php - No wierd escaping stuff. (.\',\'\',\''.'\',') - Clear on what you are doing. - javascript broke? it will still work I am trying to get this to open in a popup however it doess not open and I cannot work out why. Must be a syntax arror as the page displays ok. if it was a syntax error, the page would not display. curt. ---End Message--- ---BeginMessage--- On Sun, 2006-11-12 at 11:36 -0800, Curt Zirzow wrote: On 11/12/06, Ross [EMAIL PROTECTED] wrote: echo ('a href=# onclick=window.open(\'news/old_news_list.php?month=$jamp;year='.$i.'\',\'\',\'width=700,height=500\'); return false \ $thisMonth/a'); Just remove any question on what is wrong: $thisUrl = news/old_news_list.php?month=$jamp;year=$i; ? a href=?php echo $thisUrl;? onClick=window.open('?php echo $thisUrl;','','width=700,height=500'); return false; $thisMonth/a ?php Switching in and out of PHP mode... YUCK :B Yeah, yeah I know... cue the PHP was originally designed as a template language... *barf* ;) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. |
Re: [PHP] PEAR and MDB2
so when i have this code : $options = array('debug' = 2, 'portability' = MDB2_PORTABILITY_ALL, ); $query = 'SELECT * from sp_u_001(\'all\')'; $db2 = new MDB2_Driver_pgsql(); $db2-connect($dsn); if (PEAR::isError($db2)) { die(Error connection : .$db2-getMessage()); } $res = $db2-exec($query); if (PEAR::isError($res)) { die(Error connection : .$res-getMessage()); } i get this error == Error connection : MDB2 Error: unknown error (from $res control) Alain On 11/11/06, Roman Neuhauser [EMAIL PROTECTED] wrote: # [EMAIL PROTECTED] / 2006-11-11 12:02:37 +0100: require_once 'Pear/MDB2.php'; $dsn = 'pgsql://login:[EMAIL PROTECTED]'; $mdb2 = MDB2::connect($dsn); if (PEAR::isError($mdb2)) { die($mdb2-getMessage()); } $res = $mdb2-query('SELECT * FROM articles'); if (PEAR::isError($res)) { die($res-getMessage()); } while ($row = $res-fetchRow(MDB2_FETCHMODE_ASSOC)) { echo $row['title'] . ', ' . $row['content'] . \n; } $res-free(); -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991
Re: [PHP] Staff log-in
Hello, everybody, I read about the staff log-in interestingly. I need a little php script. Staff log in by entering username and password and then the next time they enter their username and password they log out. The script has to take down the time they log in and log out. Then I should be able to read old log-ins and log-outs. I unfortunately can't make it myself because I don't have the knowledge, can anyone of you do this for me? It's for a small non-profit orginisation. If you want to learn about the security risk of log-inout-system quickly,you need to download a lot of free and non-free(the latter is better)programs and to verify which part of the program was upgraded (eg:v0.9 = v1.00 = v1.03)by the author of the program. I am trying to keep the security of my poor php-loginout system by setting properly my apache and my LAN and my kernel.It is impossible to keep my log-inout-program and my members information safely only by the PHP program I wrote.If you want to keep your log-inout-program and your member information safely only by PHP program you wrote (eg:you are going to provide your loginout-system for your members on a rental-www-server), you need to get the programming-ability of the developer level of PHP. You can verify on the amazon book-store if there is a book which gathered the fragilitas of the log-in system ( whether or not it is written in PHP ) . The book about the fragilitas of the log-inout system ( whether or not it is written in PHP ) doesn't exist in Japan(yet). Madoca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PEAR::MDB2 andquery
Hi, I'm still wondering how are linked MDB2 class and MDB2_Driver_pgsql class. when i analyze the code of DB.php and pgsql.php, it's clear that DB.phpcheck a class based on phptype and therefore include the pgsql.php file. But i did not find something similar in MDB2.php. i would like to understand how can i do execute a query via MDB2 class on a postgreSQL DB. here is my code and for sure it does not work. the $db2-query(); is not a function from MDB2...only from MDB2_Driver_pgsql class. global $dsn; $options = array('debug' = 2, 'portability' = MDB2_PORTABILITY_ALL, ); $query = 'SELECT * from sp_u_001(\'all\')'; $db2 = new MDB2(); $db2-connect($dsn); if (MDB2::isError($db2)) { die(Error connection : .$db2-getMessage().brbr.$res-getUserinfo()); } $res =$db2-query($query); if (MDB2::isError($res)) { die(Error connection : .$res-getMessage().brbr.$res-getUserinfo()); } -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5
[PHP] Max File Upload Size
This is a really stupid question, but I've not been able to find an answer for it. I have always thought that your max upload size is limited to the value in the php.ini file. However I recently changed a site to a new server which had problems with memory on one of the image resizing scripts. I managed to work around it by inserting one line at the start of the problem script: ini_set(memory_limit,32M); Can a similar thing be done with the upload_max_filesize? Assuming that it can't, what is a good workaround? Using FTP within a script? This is for uploading an audio file, typically 4MB. Thanks in advance, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Max File Upload Size
Have a look on this page for all the ini settings.. It will also say if it is changeable http://nl2.php.net/manual/en/ini.php#ini.list Tom Chubb wrote: This is a really stupid question, but I've not been able to find an answer for it. I have always thought that your max upload size is limited to the value in the php.ini file. However I recently changed a site to a new server which had problems with memory on one of the image resizing scripts. I managed to work around it by inserting one line at the start of the problem script: ini_set(memory_limit,32M); Can a similar thing be done with the upload_max_filesize? Assuming that it can't, what is a good workaround? Using FTP within a script? This is for uploading an audio file, typically 4MB. Thanks in advance, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR and MDB2
# [EMAIL PROTECTED] / 2006-11-12 09:46:34 +0100: so when i have this code : $options = array('debug' = 2, 'portability' = MDB2_PORTABILITY_ALL, ); $query = 'SELECT * from sp_u_001(\'all\')'; $db2 = new MDB2_Driver_pgsql(); $db2-connect($dsn); if (PEAR::isError($db2)) { die(Error connection : .$db2-getMessage()); } $res = $db2-exec($query); if (PEAR::isError($res)) { die(Error connection : .$res-getMessage()); } i get this error == Error connection : MDB2 Error: unknown error (from $res control) http://pear.php.net/manual/en/package.database.mdb2.intro-query.php says: exec() should be used for manipulation queries. IOW, you should use query() for SELECTS, exec() for other statements. Perhaps that's your problem? -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] spot the mistake
echo ('a href=# onclick=window.open(\'news/old_news_list.php?month=$jamp;year='.$i.'\',\'\',\'width=700,height=500\'); return false \ $thisMonth/a'); I am trying to get this to open in a popup however it doess not open and I cannot work out why. Must be a syntax arror as the page displays ok. Ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert postgres date to PHP
# [EMAIL PROTECTED] / 2006-11-11 16:59:19 +0100: Hi, in my database PosgreSQL i have stored some date in the following format : -MM-DD HH:MM:SS this is a real TimeStamp without time zone field format. Under PHP i would like to display this field as text with the following format DD.MM. How can i do that ? http://www.postgresql.org/docs/8.1/static/functions-formatting.html Pay attention to the to_char() function. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP] PEAR and MDB2
but the problem is before: $mdb2 = MDB2::connect($dsn); if (PEAR::isError($mdb2)) { die($mdb2-getMessage().brbr.$db2-getUserinfo()); } generate a : MDB2 Error: not found connect: [Error message: extension pgsql is not compiled into PHP] ** pgsql(pgsql)://login:[EMAIL PROTECTED]:5432/mydbname how is it possible ? when i control the php.ini and phpinfo() i see that pgsql is install and activated. So, what did i miss ? Al. On 11/12/06, Roman Neuhauser [EMAIL PROTECTED] wrote: # [EMAIL PROTECTED] / 2006-11-12 09:46:34 +0100: so when i have this code : $options = array('debug' = 2, 'portability' = MDB2_PORTABILITY_ALL, ); $query = 'SELECT * from sp_u_001(\'all\')'; $db2 = new MDB2_Driver_pgsql(); $db2-connect($dsn); if (PEAR::isError($db2)) { die(Error connection : .$db2-getMessage()); } $res = $db2-exec($query); if (PEAR::isError($res)) { die(Error connection : .$res-getMessage()); } i get this error == Error connection : MDB2 Error: unknown error (from $res control) http://pear.php.net/manual/en/package.database.mdb2.intro-query.php says: exec() should be used for manipulation queries. IOW, you should use query() for SELECTS, exec() for other statements. Perhaps that's your problem? -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5
Re: [PHP] PEAR and MDB2
it does not matter, query or exec produce the same error message : Error connection : MDB2 Error: not found connect: [Error message: extension pgsql is not compiled into PHP] :-( On 11/12/06, Roman Neuhauser [EMAIL PROTECTED] wrote: # [EMAIL PROTECTED] / 2006-11-12 09:46:34 +0100: so when i have this code : $options = array('debug' = 2, 'portability' = MDB2_PORTABILITY_ALL, ); $query = 'SELECT * from sp_u_001(\'all\')'; $db2 = new MDB2_Driver_pgsql(); $db2-connect($dsn); if (PEAR::isError($db2)) { die(Error connection : .$db2-getMessage()); } $res = $db2-exec($query); if (PEAR::isError($res)) { die(Error connection : .$res-getMessage()); } i get this error == Error connection : MDB2 Error: unknown error (from $res control) http://pear.php.net/manual/en/package.database.mdb2.intro-query.php says: exec() should be used for manipulation queries. IOW, you should use query() for SELECTS, exec() for other statements. Perhaps that's your problem? -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5
[PHP] PHP product licensing...
I'll get right to the point, then explain after... I'm looking to release some PHP code as partially open-source. Basically a GPL-like license for non-commercial use, and proprietary license for anyone else. I'm wondering about people's experience with various licenses (open-source or not). I'd be really glad to hear opinions and experiences about any successes and failures. As for my reasoning: As I understand it (correct me if I'm wrong), the GPL leaves some holes with regards to code used internally within a company (especially web stuff) where GPL'd PHP code can be used and changed internally by that company without returning changes even if the code is used in a public-facing website - so long as they don't re-distribute the software. I've read through a bunch of other licenses, but I'm no lawyer. So rather than jumping blindly, I thought I'd seek out the opinions of those who've been there. There's no substitute for the concrete experience. :-) I really like the idea of open-source software, so I would very much like to release my code so that it can benefit the open-source community, but make sure that commercial use is appropriately controlled at the same time. Please reply to the list only, no need to cc. Cheers, jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] spot the mistake
Ross wrote: echo ('a href=# onclick=window.open(\'news/old_news_list.php?month=$jamp;year='.$i.'\',\'\',\'width=700,height=500\'); return false \ $thisMonth/a'); t my first guess is that you've back-slashed something you shouldn't have - try breaking it down (and/or looking at the html source) ... $url = news/old_news_list.php?month=$jamp;year=$i; $js = window.open('%s','','width=700,height=500'); return false;; $lnk = 'a href=# onclick=.$js. %s/a printf($lnk, $url, $thisMonth); I am trying to get this to open in a popup however it doess not open and I cannot work out why. Must be a syntax arror as the page displays ok. Ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] activation through email
Ahmad Al-Twaijiry wrote: Hi everyone I have a site with around 1000 new users everyday, and when every user register my scripts will send a random password to his email. that many users everyday? might be time to invest in a programmer or 2? even if your site generates no income there must be some revenue generation potential that could attract investment. no? the problem is that I got many users (specially hotmail users) complain that they didn't receive any email (even in the hotmail junk box). I know that hotmail is filtering me as a possibly a spammer (because I use a shared mail server) and there is nothing I can do about this. there are probably quite a few things you can do to make you emails appear less spammy than they do now - don't use HTML, include a valid sender address, er ... check the web and the archives for plenty of good advice on making emails your site send less spammy-looking. now I stooped sending the password to the users email and I just make the user chose his own password and he can login directly without the need to check his email for the password. but the problem now is that many users are registering with a fake emails :( so I want to ask you if you have any solution for this ? how can I (in someway) make my scripts check if the email is valid and exists email before I register him without the need to send any password or activation link to his email ? someone else pointed out that you could use the MX server to ask whether an account exists ... this is a potentiall slow process and should be done as a batch job (e.g. using cron to run a email addr checking script once a day) do you have any idea ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP product licensing...
Google for ASP Loophole. On 11/12/06, Jon Anderson [EMAIL PROTECTED] wrote: I'll get right to the point, then explain after... I'm looking to release some PHP code as partially open-source. Basically a GPL-like license for non-commercial use, and proprietary license for anyone else. I'm wondering about people's experience with various licenses (open-source or not). I'd be really glad to hear opinions and experiences about any successes and failures. As for my reasoning: As I understand it (correct me if I'm wrong), the GPL leaves some holes with regards to code used internally within a company (especially web stuff) where GPL'd PHP code can be used and changed internally by that company without returning changes even if the code is used in a public-facing website - so long as they don't re-distribute the software. I've read through a bunch of other licenses, but I'm no lawyer. So rather than jumping blindly, I thought I'd seek out the opinions of those who've been there. There's no substitute for the concrete experience. :-) I really like the idea of open-source software, so I would very much like to release my code so that it can benefit the open-source community, but make sure that commercial use is appropriately controlled at the same time. Please reply to the list only, no need to cc. Cheers, jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encoder efficiency
Sancar Saran wrote: Hi, What is Zend Encoder efficency. dunno, ask Zend. ;-) After encoding shall we assume our code was safe... well safety != efficiency for one, secondly it depends on you definition of safe. it's fairly safe from people trying to read/understand the source code - although I doubt it's 100% safe from someone with the skills and desire to decode (and/or unobsfucate) the source enough to get a reasonable understanding of the inner workings. if you code is safe in terms of usage ... that depends on whether what you wrote ... no ammount of encoding will fix any XSS, SQl-injection,etc vulnerabilities your code may contain. Or what should we expected Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PEAR::MDB2 andquery
I'm still debugging the MDB2 issue that i have. in fact, my problem comes from : if (!PEAR::loadExtension($this-phptype)) { return $this-raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'extension '.$this-phptype.' is not compiled into PHP', __FUNCTION__); } from connect function located in MDB2. even if the extension php_pgsql.dll is loaded by php.ini, it seems that PEAR is not able to see it. Maybe creators of this package could track this bug or at least investigate with. Because when i control via phpinfo(), pgsql module is loaded normally... the proof is that i can use pgsql without PEAR on my web pages without problem. So i will investigate more, the PEAR::loadExtension($this-phptype) function because there is the mistake. Alain On 11/12/06, Alain Roger [EMAIL PROTECTED] wrote: Hi, I'm still wondering how are linked MDB2 class and MDB2_Driver_pgsql class. when i analyze the code of DB.php and pgsql.php, it's clear that DB.phpcheck a class based on phptype and therefore include the pgsql.php file. But i did not find something similar in MDB2.php. i would like to understand how can i do execute a query via MDB2 class on a postgreSQL DB. here is my code and for sure it does not work. the $db2-query(); is not a function from MDB2...only from MDB2_Driver_pgsql class. global $dsn; $options = array('debug' = 2, 'portability' = MDB2_PORTABILITY_ALL, ); $query = 'SELECT * from sp_u_001(\'all\')'; $db2 = new MDB2(); $db2-connect($dsn); if (MDB2::isError($db2)) { die(Error connection : .$db2-getMessage().brbr.$res-getUserinfo()); } $res =$db2-query($query); if (MDB2::isError($res)) { die(Error connection : .$res-getMessage().brbr.$res-getUserinfo()); } -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5 -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.0.58 PHP 5
Re: [PHP] spot the mistake
On Sun, 2006-11-12 at 15:21 +, Ross wrote: echo ('a href=# onclick=window.open(\'news/old_news_list.php?month=$jamp;year='.$i.'\',\'\',\'width=700,height=500\'); return false \ $thisMonth/a'); I am trying to get this to open in a popup however it doess not open and I cannot work out why. Must be a syntax arror as the page displays ok. $j and $thisMonth need to be moved outside of the string so that PHP will expand their values. Not sure if that will fix the popup not opening at all issue. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] spot the mistake
On 11/12/06, Ross [EMAIL PROTECTED] wrote: echo ('a href=# onclick=window.open(\'news/old_news_list.php?month=$jamp;year='.$i.'\',\'\',\'width=700,height=500\'); return false \ $thisMonth/a'); Just remove any question on what is wrong: $thisUrl = news/old_news_list.php?month=$jamp;year=$i; ? a href=?php echo $thisUrl;? onClick=window.open('?php echo $thisUrl;','','width=700,height=500'); return false; $thisMonth/a ?php - No wierd escaping stuff. (.\',\'\',\''.'\',') - Clear on what you are doing. - javascript broke? it will still work I am trying to get this to open in a popup however it doess not open and I cannot work out why. Must be a syntax arror as the page displays ok. if it was a syntax error, the page would not display. curt. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] spot the mistake
On Sun, 2006-11-12 at 11:36 -0800, Curt Zirzow wrote: On 11/12/06, Ross [EMAIL PROTECTED] wrote: echo ('a href=# onclick=window.open(\'news/old_news_list.php?month=$jamp;year='.$i.'\',\'\',\'width=700,height=500\'); return false \ $thisMonth/a'); Just remove any question on what is wrong: $thisUrl = news/old_news_list.php?month=$jamp;year=$i; ? a href=?php echo $thisUrl;? onClick=window.open('?php echo $thisUrl;','','width=700,height=500'); return false; $thisMonth/a ?php Switching in and out of PHP mode... YUCK :B Yeah, yeah I know... cue the PHP was originally designed as a template language... *barf* ;) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing brackets in text
I need to replace text enclosed in brackets with links. How can I get that text, though? I've tried numerous variations of the following, with no success: $articleText=preg_replace('/\[[a-z]]/i' , makeLink($1), $articleText); I cannot get the text between the brackets send to the makeLink function. Could someone push me in the right direction? An example of the text would be: $articleText=Ajax is an acronym of Asynchronous [JavaScript] and [XML]; Where I'd like the strings JavaScript and XML sent to the makeLink function. Thanks in advance. Dotan Cohen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing brackets in text
Dotan Cohen wrote: I need to replace text enclosed in brackets with links. How can I get that text, though? I've tried numerous variations of the following, with no success: $articleText=preg_replace('/\[[a-z]]/i' , makeLink($1), $articleText); I cannot get the text between the brackets send to the makeLink function. Could someone push me in the right direction? An example of the text would be: $articleText=Ajax is an acronym of Asynchronous [JavaScript] and [XML]; Where I'd like the strings JavaScript and XML sent to the makeLink function. Thanks in advance. Don't know if this is your problem but you need to escape the trailing ] as well: preg_replace('/\[[a-z]\]/i', . -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing brackets in text
On 12/11/06, Chris [EMAIL PROTECTED] wrote: Dotan Cohen wrote: I need to replace text enclosed in brackets with links. How can I get that text, though? I've tried numerous variations of the following, with no success: $articleText=preg_replace('/\[[a-z]]/i' , makeLink($1), $articleText); I cannot get the text between the brackets send to the makeLink function. Could someone push me in the right direction? An example of the text would be: $articleText=Ajax is an acronym of Asynchronous [JavaScript] and [XML]; Where I'd like the strings JavaScript and XML sent to the makeLink function. Thanks in advance. Don't know if this is your problem but you need to escape the trailing ] as well: preg_replace('/\[[a-z]\]/i', . Thanks, but that wasn't quite it, either. This code: ?php function makeLink($title) { $returnString=b$title/b; return $returnString; } $articleText=This is a very [long] string.; $articleText=preg_replace('/\[[a-z]\]/i' , makeLink($1), $articleText); print $articleText; ? produces this error: Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/user/public_html/testpage.php on line 9 I'm sorry that I didn't include the error message in my original email. Also, I got the same error with and without the last closing bracket escaped. Dotan Cohen http://simplesniff.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing brackets in text
On 13/11/06, Chris [EMAIL PROTECTED] wrote: Dotan Cohen wrote: On 12/11/06, Chris [EMAIL PROTECTED] wrote: Dotan Cohen wrote: I need to replace text enclosed in brackets with links. How can I get that text, though? I've tried numerous variations of the following, with no success: $articleText=preg_replace('/\[[a-z]]/i' , makeLink($1), $articleText); I cannot get the text between the brackets send to the makeLink function. Could someone push me in the right direction? An example of the text would be: $articleText=Ajax is an acronym of Asynchronous [JavaScript] and [XML]; Where I'd like the strings JavaScript and XML sent to the makeLink function. Thanks in advance. Don't know if this is your problem but you need to escape the trailing ] as well: preg_replace('/\[[a-z]\]/i', . Thanks, but that wasn't quite it, either. This code: ?php function makeLink($title) { $returnString=b$title/b; return $returnString; } $articleText=This is a very [long] string.; $articleText=preg_replace('/\[[a-z]\]/i' , makeLink($1), $articleText); print $articleText; ? produces this error: Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/user/public_html/testpage.php on line 9 I'm sorry that I didn't include the error message in my original email. Also, I got the same error with and without the last closing bracket escaped. Ah, completely missed that part. You can't pass $1 through like that. You have to do some funky quoting to do what you want in one go. http://php.net/preg_replace Check Example 4. Using the 'e' modifier or use a callback: http://www.php.net/manual/en/function.preg-replace-callback.php I had looked at both of those already- with neither luck nor understanding. I can fuddle my way through a simple regex, but that monster has me bewildered. I'm pretty sure that preg_replace is all I need, but I can't figure out the correct syntax for referencing a chunk of the data. I'm of course not asking anybody to write the regex for me, rather to show me how it must be so that I'll know how to construct them. I saw another, similar example on ilovejackdaniels.com where the author had parsed Google query strings, but that example was even more confounded than the one in TFphpM. Dotan Cohen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing brackets in text
Dotan Cohen wrote: On 12/11/06, Chris [EMAIL PROTECTED] wrote: Dotan Cohen wrote: I need to replace text enclosed in brackets with links. How can I get that text, though? I've tried numerous variations of the following, with no success: $articleText=preg_replace('/\[[a-z]]/i' , makeLink($1), $articleText); I cannot get the text between the brackets send to the makeLink function. Could someone push me in the right direction? An example of the text would be: $articleText=Ajax is an acronym of Asynchronous [JavaScript] and [XML]; Where I'd like the strings JavaScript and XML sent to the makeLink function. Thanks in advance. Don't know if this is your problem but you need to escape the trailing ] as well: preg_replace('/\[[a-z]\]/i', . Thanks, but that wasn't quite it, either. This code: ?php function makeLink($title) { $returnString=b$title/b; return $returnString; } $articleText=This is a very [long] string.; $articleText=preg_replace('/\[[a-z]\]/i' , makeLink($1), $articleText); print $articleText; ? produces this error: Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/user/public_html/testpage.php on line 9 I'm sorry that I didn't include the error message in my original email. Also, I got the same error with and without the last closing bracket escaped. Ah, completely missed that part. You can't pass $1 through like that. You have to do some funky quoting to do what you want in one go. http://php.net/preg_replace Check Example 4. Using the 'e' modifier or use a callback: http://www.php.net/manual/en/function.preg-replace-callback.php -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing brackets in text
Dotan Cohen wrote: On 13/11/06, Chris [EMAIL PROTECTED] wrote: Dotan Cohen wrote: On 12/11/06, Chris [EMAIL PROTECTED] wrote: Dotan Cohen wrote: I need to replace text enclosed in brackets with links. How can I get that text, though? I've tried numerous variations of the following, with no success: $articleText=preg_replace('/\[[a-z]]/i' , makeLink($1), $articleText); I cannot get the text between the brackets send to the makeLink function. Could someone push me in the right direction? An example of the text would be: $articleText=Ajax is an acronym of Asynchronous [JavaScript] and [XML]; Where I'd like the strings JavaScript and XML sent to the makeLink function. Thanks in advance. Don't know if this is your problem but you need to escape the trailing ] as well: preg_replace('/\[[a-z]\]/i', . Thanks, but that wasn't quite it, either. This code: ?php function makeLink($title) { $returnString=b$title/b; return $returnString; } $articleText=This is a very [long] string.; $articleText=preg_replace('/\[[a-z]\]/i' , makeLink($1), $articleText); print $articleText; ? produces this error: Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/user/public_html/testpage.php on line 9 I'm sorry that I didn't include the error message in my original email. Also, I got the same error with and without the last closing bracket escaped. Ah, completely missed that part. You can't pass $1 through like that. You have to do some funky quoting to do what you want in one go. http://php.net/preg_replace Check Example 4. Using the 'e' modifier or use a callback: http://www.php.net/manual/en/function.preg-replace-callback.php I had looked at both of those already- with neither luck nor understanding. I can fuddle my way through a simple regex, but that monster has me bewildered. I'm pretty sure that preg_replace is all I need, but I can't figure out the correct syntax for referencing a chunk of the data. I'm of course not asking anybody to write the regex for me, rather to show me how it must be so that I'll know how to construct them. I saw another, similar example on ilovejackdaniels.com where the author had parsed Google query strings, but that example was even more confounded than the one in TFphpM. ?php function makeLink($matches) { $returnString=b . $matches[1] . /b; return $returnString; } $articleText=This is a very [long] string.; $articleText=preg_replace_callback('/\[([a-z]+)\]/i' , makeLink, $articleText); print $articleText . \n; ? The callback takes whatever the regular expressions returns (alpha characters between [ and ]) and runs it through function makeLink. Not sure how that will go with multiple []'s etc in the same string but it should get you started. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing brackets in text
On 13/11/06, Chris [EMAIL PROTECTED] wrote: ?php function makeLink($matches) { $returnString=b . $matches[1] . /b; return $returnString; } $articleText=This is a very [long] string.; $articleText=preg_replace_callback('/\[([a-z]+)\]/i' , makeLink, $articleText); print $articleText . \n; ? The callback takes whatever the regular expressions returns (alpha characters between [ and ]) and runs it through function makeLink. Not sure how that will go with multiple []'s etc in the same string but it should get you started. I didn't know that I had to call the function like that- I don't remember ever seeing it called that way. Also, I must google the meaning of the (~+) in the regex. Thank you very much, Chris. I very much appreciate the assistance. Know that I am learning, not just asking for hand-holding! Dotan Cohen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mysql strategy
If I have to perform 30 LIKE searches for different keywords in a varchar field, which strategy would be recommended: 1) 30 searches, one for each keyword 2) To select the varchar field from all the rows, and search through them with php's array functions? There are about 500 rows in the table, and growing. The mysql server is on localhost, and the machine is a dedicated server running RHEL. It's not my machine, so I'd like to be responsible with resources, as much as I can be. Thanks in advance for any advice. Dotan Cohen http://what-is-what.com/what_is/ajax.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mysql strategy
Dotan Cohen wrote: If I have to perform 30 LIKE searches for different keywords in a varchar field, which strategy would be recommended: 1) 30 searches, one for each keyword No. Horribly inefficient. 2) To select the varchar field from all the rows, and search through them with php's array functions? No. Make the database do the work. Use full text indexing: http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do you do the ? mark after a filename
Thank you for that, it was a big help. Can I also call function that way? Again thank you for your help. Thomas Tom Chubb wrote: On 12/11/06, Thomas Bonham [EMAIL PROTECTED] wrote: Hi All, I keep seeing the ? mark after many file names index.php?id=234. So what I would like to know is how do you make them. I have heard that they can make a programs life sampler when doing somethings with a database. Thank you, Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You can retrieve variables from the URL using the GET method. This is similar to using the POST method with data from forms. A typical url with something like www.domain.com/index.php?id=35format=html would provide the page with two variables, id format. It's the equivalent of putting the following in the page. $id = 35; $format = 'html'; This is popular with simple CMS/Templating systems where you use a standard page and the id variable loads the relevant article text. Hope that helps. Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do you do the ? mark after a filename
using form method=get..., it is automatically generated but you can also do it manually in your anchor tag like so: a href= www.domain.com/index.php?id=35format=htmlclick me/a in your php you can get its value by use of the $_GET variable. hth, john On 11/13/06, Thomas Bonham [EMAIL PROTECTED] wrote: Thank you for that, it was a big help. Can I also call function that way? Again thank you for your help. Thomas Tom Chubb wrote: On 12/11/06, Thomas Bonham [EMAIL PROTECTED] wrote: Hi All, I keep seeing the ? mark after many file names index.php?id=234. So what I would like to know is how do you make them. I have heard that they can make a programs life sampler when doing somethings with a database. Thank you, Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You can retrieve variables from the URL using the GET method. This is similar to using the POST method with data from forms. A typical url with something like www.domain.com/index.php?id=35format=html would provide the page with two variables, id format. It's the equivalent of putting the following in the page. $id = 35; $format = 'html'; This is popular with simple CMS/Templating systems where you use a standard page and the id variable loads the relevant article text. Hope that helps. Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- GMail Rocks!!!