php-general Digest 10 Feb 2008 11:59:02 -0000 Issue 5285

2008-02-10 Thread php-general-digest-help
php-general Digest 10 Feb 2008 11:59:02 - Issue 5285 Topics (messages 269014 through 269022): Better DB Class MySQL 269014 by: nihilism machine 269015 by: Larry Garfield 269016 by: Nathan Nobbe 269017 by: Robert Cummings urgent !!! Please Help preg_replace

Re: [PHP] urgent !!! Please Help preg_replace !!!!!!!!!!!!!!!!!!!!!

2008-02-10 Thread LKSunny
this i know already, but i think can do it single regex Robert Cummings [EMAIL PROTECTED] ¼¶¼g©ó¶l¥ó·s»D:[EMAIL PROTECTED] On Sun, 2008-02-10 at 14:33 +0800, LKSunny wrote: //please run this script, you can get what problem i got $html = eof a href=aaa.htmlaaa/a a href=bbb.htmlcfdfd/a a

[PHP] strtotime

2008-02-10 Thread Ron Piggott
I am trying to calculate what was the date 18 months ago. When I give the command: $18_months_ago = strtotime(-18 months); It comes back with: Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE How would you calculate 18 months ago from today? Ron -- PHP General Mailing

[PHP] Re: strtotime

2008-02-10 Thread Ron Piggott
I see I broke a rule. The variable can't start with a number. Still strtotime doesn't work with -18 months How would you handle this? Ron On Sun, 2008-02-10 at 06:46 -0500, Ron Piggott wrote: I am trying to calculate what was the date 18 months ago. When I give the command:

Re: [PHP] strtotime

2008-02-10 Thread Per Jessen
Ron Piggott wrote: I am trying to calculate what was the date 18 months ago. When I give the command: $18_months_ago = strtotime(-18 months); It comes back with: Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE That's a plain syntactical error, it's not related

Re: [PHP] Better DB Class MySQL

2008-02-10 Thread Richard Heyes
// Terminator Style Function simply in coolness public function Terminator($tbl) { } Terminator? Is this something I don't know about or is it simply a method that goes around killing other methods? Anyhoo, you may want to look at this:

Re: [PHP] Better DB Class MySQL

2008-02-10 Thread Richard Heyes
Larry Garfield wrote: http://www.php.net/pdo All the cool kids are doing it. Except that converting to converting PDO is, undoubtedly, far more work and will entail far more gotchas than the original poster wanted -- Richard Heyes http://www.websupportsolutions.co.uk Knowledge Base and

[PHP] strtotime

2008-02-10 Thread Ron Piggott
I figured out what went wrong. Ron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: strtotime

2008-02-10 Thread Per Jessen
Ron Piggott wrote: I see I broke a rule. The variable can't start with a number. Still strtotime doesn't work with -18 months How would you handle this? Ron Uh, it works fine here: php5 -r '$a=strtotime(-18 months); print strftime(%Y%m%d,$a); ': 20060810 /Per Jessen, Zürich -- PHP

[PHP] Gzipped output

2008-02-10 Thread Jakub
Hello, is it possible to make something like gzipped echo?. My idea was: $gzOut = gzopen('php://output','w'); but it fails with an error: bWarning/b: gzopen(php://output) [a href='function.gzopen'function.gzopen/a]: could not make seekable - php://output That script generates a large text

Re: [PHP] Gzipped output

2008-02-10 Thread Per Jessen
Jakub wrote: That script generates a large text file to download, so I thought I can gzip it somehow to make the downloads faster. The buffered way (to load all the output to some $buffer and then echo gzencode($buffer,6);) consumes too much memory. You could write it to a local file, then

Re: [PHP] Hex Strings Appended to Pathnames

2008-02-10 Thread Mick
Richard Lynch wrote: I don't know if it's before/after, but PHP can't change the GET request to something it wasn't... So THAT was the URL requested. You might have some kind of funky mod_rewrite rule messing you up... On Tue, January 29, 2008 5:22 am, Mick wrote: Richard Lynch wrote:

Re: [PHP] Better DB Class MySQL

2008-02-10 Thread Andrew Ballard
On Feb 9, 2008 7:39 PM, Larry Garfield [EMAIL PROTECTED] wrote: http://www.php.net/pdo All the cool kids are doing it. Tried it. (Actually, I am using it for some stuff.) But I seriously hope it works better for MySQL than it does for SQL Server. Andrew

Re: [PHP] Gzipped output

2008-02-10 Thread Jakub
Yes, I thought about this, but this has a big disadvantage - the client must wait for the file to be fully processed and compressed and then he can start downloading. I'd like to let the client start downloading the compressed parts while the further parts are still being processed and

Re: [PHP] Gzipped output

2008-02-10 Thread Per Jessen
Jakub wrote: Yes, I thought about this, but this has a big disadvantage - the client must wait for the file to be fully processed and compressed and then he can start downloading. I'd like to let the client start downloading the compressed parts while the further parts are still being

Re: [PHP] Better DB Class MySQL

2008-02-10 Thread Jochem Maas
Larry Garfield schreef: http://www.php.net/pdo All the cool kids are doing it. not true - some of them use firebird ;-) On Saturday 09 February 2008, nihilism machine wrote: Looking to really beef up my DB class, any suggestions for functions to add that will be more time saving for a web

Re: [PHP] Better DB Class MySQL

2008-02-10 Thread Richard Heyes
Jochem Maas wrote: Larry Garfield schreef: http://www.php.net/pdo All the cool kids are doing it. not true - some of them use firebird ;-) Fire - what? :-) -- Richard Heyes http://www.websupportsolutions.co.uk Knowledge Base and Helpdesk software for £299 hosted for you - no

Re: [PHP] strtotime

2008-02-10 Thread Floor Terra
On 2/10/08, Ron Piggott [EMAIL PROTECTED] wrote: I figured out what went wrong. Ron Care to share it with us? Floor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Hex Strings Appended to Pathnames

2008-02-10 Thread Nathan Nobbe
On Feb 10, 2008 9:09 AM, Mick [EMAIL PROTECTED] wrote: There is no rewrite rule. It's an extremely strange problem. is this a production box; or more specifically, are you adverse to throwing xdebug on there? i suspect you could use the function tracing in xdebug to at least find out where

Re: [PHP] strtotime

2008-02-10 Thread Ron Piggott
The date value I was assigning was for a mySQL query ... a date range query. I was running my query when I hadn't assigned a date to the other date range variable. I didn't realized I hadn't copied my DATE() syntax to this area of my code. Ron On Sun, 2008-02-10 at 18:22 +0100, Floor Terra

Re: [PHP] urgent !!! Please Help preg_replace !!!!!!!!!!!!!!!!!!!!!

2008-02-10 Thread Robert Cummings
On Sun, 2008-02-10 at 16:46 +0800, LKSunny wrote: this i know already, but i think can do it single regex Considering you marked the email as urgent, perhaps you have better things to do than try to squeeze your problem into a regex. Feel free to post your single regex when you find it... a

[PHP] mysql question

2008-02-10 Thread nihilism machine
i have this functuon: public function select_one($sql) { $this-last_query = $sql; $r = mysql_query($sql); if (!$r) { $this-last_error = mysql_error(); return false; }

Re: [PHP] mysql question

2008-02-10 Thread Nathan Nobbe
On Feb 10, 2008 12:52 PM, Per Jessen [EMAIL PROTECTED] wrote: nihilism machine wrote: $ret = mysql_result($r, 0); mysql_free_result($r); if ($this-auto_slashes) return stripslashes($ret); else return $ret; } what is $ret, an array? No, it's a mysql result object. no, its the

Re: [PHP] mysql question

2008-02-10 Thread Per Jessen
nihilism machine wrote: $ret = mysql_result($r, 0); mysql_free_result($r); if ($this-auto_slashes) return stripslashes($ret); else return $ret; } what is $ret, an array? No, it's a mysql result object. if so how can i access the individual rows in it? Look up mysql_fetch_assoc().

Re: [PHP] urgent !!! Please Help preg_replace !!!!!!!!!!!!!!!!!!!!!

2008-02-10 Thread tedd
At 12:38 PM -0500 2/10/08, Robert Cummings wrote: On Sun, 2008-02-10 at 16:46 +0800, LKSunny wrote: this i know already, but i think can do it single regex Considering you marked the email as urgent, perhaps you have better things to do than try to squeeze your problem into a regex. Feel free

Re: [PHP] Better DB Class MySQL

2008-02-10 Thread Nathan Nobbe
On Feb 10, 2008 1:08 PM, Jason Pruim [EMAIL PROTECTED] wrote: Fire - what? :-) Isn't that a car? :) ya; but mustangs are cooler :) -nathan

[PHP] mysql question #2

2008-02-10 Thread nihilism machine
Ok, I read the php.net info. so with this function though: public function select_one($sql) { $this-last_query = $sql; $r = mysql_query($sql); if (!$r) { $this-last_error = mysql_error();

Re: [PHP] Better DB Class MySQL

2008-02-10 Thread Jason Pruim
On Feb 10, 2008, at 10:39 AM, Richard Heyes wrote: Jochem Maas wrote: Larry Garfield schreef: http://www.php.net/pdo All the cool kids are doing it. not true - some of them use firebird ;-) Fire - what? :-) Isn't that a car? :) -- Jason Pruim Raoset Inc. Technology Manager MQC

Re: [PHP] mysql question

2008-02-10 Thread Per Jessen
Nathan Nobbe wrote: what is $ret, an array? No, it's a mysql result object. no, its the contents of the first cell in the first record of the result set; from the doc on mysql_result(), http://www.php.net/manual/en/function.mysql-result.php which is what the function is using. Yep,

Re: [PHP] urgent !!! Please Help preg_replace !!!!!!!!!!!!!!!!!!!!!

2008-02-10 Thread Robert Cummings
On Sun, 2008-02-10 at 12:55 -0500, tedd wrote: At 12:38 PM -0500 2/10/08, Robert Cummings wrote: On Sun, 2008-02-10 at 16:46 +0800, LKSunny wrote: this i know already, but i think can do it single regex Considering you marked the email as urgent, perhaps you have better things to do

Re: [PHP] urgent !!! Please Help preg_replace !!!!!!!!!!!!!!!!!!!!!

2008-02-10 Thread Nathan Nobbe
On Feb 10, 2008 12:55 PM, tedd [EMAIL PROTECTED] wrote: Where do we get people like this? the late-night homework challenge? -nathan

Re: [PHP] mysql question #2

2008-02-10 Thread Nathan Nobbe
On Feb 10, 2008 1:12 PM, nihilism machine [EMAIL PROTECTED] wrote: Ok, I read the php.net info. so with this function though: public function select_one($sql) { $this-last_query = $sql; $r = mysql_query($sql); if (!$r) {

[PHP] Re: mysql question #2

2008-02-10 Thread Shawn McKenzie
nihilism machine wrote: Ok, I read the php.net info. so with this function though: public function select_one($sql) { $this-last_query = $sql; $r = mysql_query($sql); if (!$r) { $this-last_error = mysql_error(); return false; }

Re: [PHP] Gzipped output

2008-02-10 Thread Jakub
That would do the trick if it was allowed at the server but it isn't :( And it's not my server and I can't change its settings. Jakub Čermák [EMAIL PROTECTED] ICQ 159971304 Per Jessen napsal(a): Jakub wrote: Yes, I thought about this, but this has a big disadvantage - the client

RE: [PHP] Gzipped output

2008-02-10 Thread Andrés Robinet
-Original Message- From: Jakub [mailto:[EMAIL PROTECTED] Sent: Sunday, February 10, 2008 1:36 PM To: php-general@lists.php.net Subject: Re: [PHP] Gzipped output That would do the trick if it was allowed at the server but it isn't :( And it's not my server and I can't change

Re: [PHP] mysql question #2

2008-02-10 Thread Zoltán Németh
2008. 02. 10, vasárnap keltezéssel 13.12-kor nihilism machine ezt írta: Ok, I read the php.net info. so with this function though: public function select_one($sql) { $this-last_query = $sql; $r = mysql_query($sql); if (!$r) {

Re: [PHP] How to Protect Against SQL Injection Attacks While Using SQLite?

2008-02-10 Thread Nathan Nobbe
On Feb 10, 2008 2:38 PM, NotReally GonnaTell [EMAIL PROTECTED] wrote: Hello all, I am wondering how I should prevent SQL injection attacks while using SQLite, MySQL has the trusted mysqli_real_escape_string, but SQLite doesn't have it's own custom function, i've tried str_replace in my code,

RE: [PHP] Gzipped output

2008-02-10 Thread Per Jessen
Andrés Robinet wrote: How about something like this? (Needs debugging and testing, but... just a hint after all) ?php ob_start(ob_gzhandler); while ($someString = getTheNextPartOfTheLargeFile()) { echo $someString; ob_flush(); } ? I like it from a coding point of view (it's

[PHP] How to Protect Against SQL Injection Attacks While Using SQLite?

2008-02-10 Thread NotReally GonnaTell
Hello all, I am wondering how I should prevent SQL injection attacks while using SQLite, MySQL has the trusted mysqli_real_escape_string, but SQLite doesn't have it's own custom function, i've tried str_replace in my code, but SQLite returns an error whenever I use a '. I've tried googling around,

Re: [PHP] How to Protect Against SQL Injection Attacks While Using SQLite?

2008-02-10 Thread NotReally GonnaTell
Is there any other way to do this? I'd rather not use PDO. On Feb 10, 2008 2:46 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Feb 10, 2008 2:38 PM, NotReally GonnaTell [EMAIL PROTECTED] wrote: Hello all, I am wondering how I should prevent SQL injection attacks while using SQLite, MySQL

Re: [PHP] How to Protect Against SQL Injection Attacks While Using SQLite?

2008-02-10 Thread Nathan Nobbe
On Feb 10, 2008 3:14 PM, NotReally GonnaTell [EMAIL PROTECTED] wrote: Is there any other way to do this? I'd rather not use PDO. what version of php are you using and what version of sqlite? this relevant info from the manual: Moreover, since PHP 5.1.0 SQLite depends on

Re: [PHP] Better DB Class MySQL

2008-02-10 Thread Chris
Nathan Nobbe wrote: On Feb 9, 2008 7:03 PM, nihilism machine [EMAIL PROTECTED] wrote: Looking to really beef up my DB class, any suggestions for functions to add that will be more time saving for a web 2.0 app, or ways to improve existing methods? thank you everyone in advance. first of

Re: [PHP] PHP variable values

2008-02-10 Thread Nathan Nobbe
On Feb 10, 2008 6:30 PM, Ron Piggott [EMAIL PROTECTED] wrote: What is the command which shows the value of all the variables in memory? Ron get_defined_vars() -nathan

[PHP] PHP variable values

2008-02-10 Thread Ron Piggott
What is the command which shows the value of all the variables in memory? Ron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Ajax, an HTML form being saved in mySQL

2008-02-10 Thread Ron Piggott
I am trying to bring my programming skills together ... but I have hit a road block. I am writing my own ledger (accounting) software. I am needing help to pass 2 variables generated by Ajax through my form to be saved in a mySQL table. A sample of what ledger_select_account.js outputs is as

[PHP] Trouble with PHP server script

2008-02-10 Thread Robert Cox
Is it possible to use the $_SERVER['PHP_AUTH_USER']; construct in a URL forwarded site? I am trying to find the authorised user id so that I can access an SQL database with it. Anyone got some ideas? PHP looks like this ?php //Get User $user = $_SERVER['PHP_AUTH_USER']; // Get

Re: [PHP] Trouble with PHP server script

2008-02-10 Thread Nirmalya Lahiri
--- Robert Cox [EMAIL PROTECTED] wrote: Is it possible to use the $_SERVER['PHP_AUTH_USER']; construct in a URL forwarded site? I am trying to find the authorised user id so that I can access an SQL database with it. Anyone got some ideas? PHP looks like this ?php //Get User

Re: [PHP] urgent !!! Please Help preg_replace !!!!!!!!!!!!!!!!!!!!!

2008-02-10 Thread Michael Moyle
Rob, $reps = array ( array ( 'match' = '#a.*/a#Uims', Can you explain what the 'U' from #Uims does? Does it have to do with Unicode? I can't find it anywhere (preg_match doc, man perlre, man perlop). Thanks! Michael -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Trouble with PHP server script

2008-02-10 Thread Jim Lucas
Robert Cox wrote: Is it possible to use the $_SERVER['PHP_AUTH_USER']; construct in a URL forwarded site? I am trying to find the authorised user id so that I can access an SQL database with it. Anyone got some ideas? PHP looks like this ?php //Get User $user =

Re: [PHP] urgent !!! Please Help preg_replace !!!!!!!!!!!!!!!!!!!!!

2008-02-10 Thread Robert Cummings
On Mon, 2008-02-11 at 13:42 +0900, Michael Moyle wrote: Rob, $reps = array ( array ( 'match' = '#a.*/a#Uims', Can you explain what the 'U' from #Uims does? Does it have to do with Unicode? I can't find it anywhere (preg_match doc, man perlre, man perlop).

[PHP] Re: Ajax, an HTML form being saved in mySQL

2008-02-10 Thread Manuel Lemos
Hello, on 02/11/2008 12:19 AM Ron Piggott said the following: I am trying to bring my programming skills together ... but I have hit a road block. I am writing my own ledger (accounting) software. I am needing help to pass 2 variables generated by Ajax through my form to be saved in a