Re: [PHP] code quest

2010-11-27 Thread Ashley Sheridan
On Fri, 2010-11-26 at 20:27 -0500, Bastien wrote:

> 
> 
> 
> On 2010-11-26, at 7:33 PM, Adam Richardson  wrote:
> 
> > On Fri, Nov 26, 2010 at 7:03 PM, Kirk Bailey 
> > wrote:
> > 
> >> Hello all, my name is Kirk Bailey, and I am new to php, so please be
> >> forbearing. I code in python, and am trying to learn this language as our
> >> new client runs a web business based in it.
> >> 
> >> I need a routine that will return a list of every directory immediately
> >> under the current directory- but nothing else, just a list of directories, 
> >> 1
> >> level deep, NO FILES, no listing of current dir or prior dir either.
> >> 
> >> Now in python, I would use os.walk, and use the list of dirs and throw the
> >> other 2 lists away, but this ain't Kansas anymore. Does php even DO lists?
> >> 
> >> Um, a list is a 1 dimenional array, if have a list ALIST and you plug in 3,
> >> you get back the contents of cell 3 in the list, whaqtever that content is.
> >> so if cell 3 in a 6 celled list was "Ruby" then ALIST[3] would return the
> >> string "ruby".
> >> 
> >> It's easy to iterate lists. For instance:
> >> 
> >>  print ''
> >>  for dir in ALIST:
> >>  print '",dir,'
> >>  print '
> >> 
> >> This would let me produce an ordered list of directories, each a link to
> >> that directory.
> >> This way, when a client installs a new product, the home page area listing
> >> products offered automatically updates.
> >> 
> >> Further embellishment would let me replace the dir name with a BRIEF
> >> description from a descriptor file read from that dir. Now how to do this 
> >> in
> >> php?
> >> 
> >> --
> >> end
> >> 
> >> Very Truly yours,
> >>   - Kirk Bailey,
> >> Largo Florida
> >> 
> >> kniht+-+
> >>| BOX |   +-+think
> >> 
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >> 
> >> 
> > To get you started:
> > 
> > function get_directories($path)
> > {
> >   $files_and_dirs = scandir($path);
> >   $dirs = array_filter($files_and_dirs, function($elem) { return
> > is_dir($elem); });
> >   // $dirs also contains "." and "..", but you can get rid of them quite
> > easily
> >   return $dirs;
> > }
> > 
> > Happy coding :)
> > 
> > Adam
> > 
> > -- 
> > Nephtali:  PHP web framework that functions beautifully
> > http://nephtaliproject.com
> 
> 
> Code igniter, a php framework can do this with one call. It could be worth 
> looking into
> 
> Bastien Koert
> 905-904-0334
> Sent from my iPhone



I'm not sure CodeIgniter would be of any help here. I don't recall any
function in the CodeIgniter framework that lists directories like this,
so he'd still have to end up coding it himself.

Also, python tends to be used more for command line stuff than websites.
CodeIgniter does have a CLI extension, but the app would just be
severely bloated running an entire PHP framework for what might only
need a light script. Bit like using a sledgehammer to hammer in a thumb
tack, can be done, but not really the best tool for the job.

Thanks,
Ash
http://www.ashleysheridan.co.uk




RE: [PHP] PHP Add +1 mysql updates by 2?

2010-11-27 Thread Ashley Sheridan
On Fri, 2010-11-26 at 22:29 -0800, Tommy Pham wrote:

> > -Original Message-
> > From: Richard West [mailto:p...@cbnisp.com]
> > Sent: Friday, November 26, 2010 9:40 PM
> > To: Peter Lind
> > Cc: Tommy Pham; Tamara Temple; PHP General Mailing List
> > Subject: Re: [PHP] PHP Add +1 mysql updates by 2?
> > 
> > I took that into consideration so I added the update at the very end of
> > document...
> > Still the same,
> > RD
> > 
> 
> 
> Things to consider as part of your application design/flow:
> 
> 1) Are you doing all PHP processing (application initialization, DB
> retrieval, user preference settings, etc.) before any header, echo, print,
> printf, output buffer, etc... ?  At which point is the update done?
> 2) Are you sure the DB update is only called for or included/required once
> for that particular URL request?
> 3) Do you any have other page (js - or in page ajax calls, css, php, html,
> etc) that requests the page (with the update) again, as Peter mentioned?
> 
> It will help you if you do an UML or a flow chart of the application flow.
> 
> Regards,
> Tommy
> 
> 


Because you're running the query as a response to a GET call, the
browser is allowed to call it multiple times and grab select parts of
the output to speed up rendering of the page. I've run into this before,
and it's annoying.

There are basically two ways to prevent this. Have the page called as
part of a POST request, which is preferred as GET requests should never
change data, hence why browsers are allowed to request them in a
slightly different way to speed up the page display times.

The second way is to also update a timestamp in the DB, and then before
you update check to see if it has been updated within a certain time
period. Depending on what you're updating this for (stat counter, etc)
then this may not work.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] PHP Add +1 mysql updates by 2?

2010-11-27 Thread Richard West
First let me say thanks to everyone who replied!

Ashley, I got it fixed but I have not a clue what did it :)
RD


On Nov 27, 2010, at 6:49 AM, Ashley Sheridan wrote:

> On Fri, 2010-11-26 at 22:29 -0800, Tommy Pham wrote:
>> 
>> > -Original Message-
>> > From: Richard West [mailto:p...@cbnisp.com]
>> > Sent: Friday, November 26, 2010 9:40 PM
>> > To: Peter Lind
>> > Cc: Tommy Pham; Tamara Temple; PHP General Mailing List
>> > Subject: Re: [PHP] PHP Add +1 mysql updates by 2?
>> > 
>> > I took that into consideration so I added the update at the very end of
>> > document...
>> > Still the same,
>> > RD
>> > 
>> 
>> 
>> Things to consider as part of your application design/flow:
>> 
>> 1) Are you doing all PHP processing (application initialization, DB
>> retrieval, user preference settings, etc.) before any header, echo, print,
>> printf, output buffer, etc... ?  At which point is the update done?
>> 2) Are you sure the DB update is only called for or included/required once
>> for that particular URL request?
>> 3) Do you any have other page (js - or in page ajax calls, css, php, html,
>> etc) that requests the page (with the update) again, as Peter mentioned?
>> 
>> It will help you if you do an UML or a flow chart of the application flow.
>> 
>> Regards,
>> Tommy
>> 
>> 
> 
> Because you're running the query as a response to a GET call, the browser is 
> allowed to call it multiple times and grab select parts of the output to 
> speed up rendering of the page. I've run into this before, and it's annoying.
> 
> There are basically two ways to prevent this. Have the page called as part of 
> a POST request, which is preferred as GET requests should never change data, 
> hence why browsers are allowed to request them in a slightly different way to 
> speed up the page display times.
> 
> The second way is to also update a timestamp in the DB, and then before you 
> update check to see if it has been updated within a certain time period. 
> Depending on what you're updating this for (stat counter, etc) then this may 
> not work.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 



Re: [PHP] PHP Add +1 mysql updates by 2?

2010-11-27 Thread Richard West
PS: PEBKAC I figure :)



On Nov 27, 2010, at 6:49 AM, Ashley Sheridan wrote:

> On Fri, 2010-11-26 at 22:29 -0800, Tommy Pham wrote:
> 
>>> -Original Message-
>>> From: Richard West [mailto:p...@cbnisp.com]
>>> Sent: Friday, November 26, 2010 9:40 PM
>>> To: Peter Lind
>>> Cc: Tommy Pham; Tamara Temple; PHP General Mailing List
>>> Subject: Re: [PHP] PHP Add +1 mysql updates by 2?
>>> 
>>> I took that into consideration so I added the update at the very end of
>>> document...
>>> Still the same,
>>> RD
>>> 
>> 
>> 
>> Things to consider as part of your application design/flow:
>> 
>> 1) Are you doing all PHP processing (application initialization, DB
>> retrieval, user preference settings, etc.) before any header, echo, print,
>> printf, output buffer, etc... ?  At which point is the update done?
>> 2) Are you sure the DB update is only called for or included/required once
>> for that particular URL request?
>> 3) Do you any have other page (js - or in page ajax calls, css, php, html,
>> etc) that requests the page (with the update) again, as Peter mentioned?
>> 
>> It will help you if you do an UML or a flow chart of the application flow.
>> 
>> Regards,
>> Tommy
>> 
>> 
> 
> 
> Because you're running the query as a response to a GET call, the
> browser is allowed to call it multiple times and grab select parts of
> the output to speed up rendering of the page. I've run into this before,
> and it's annoying.
> 
> There are basically two ways to prevent this. Have the page called as
> part of a POST request, which is preferred as GET requests should never
> change data, hence why browsers are allowed to request them in a
> slightly different way to speed up the page display times.
> 
> The second way is to also update a timestamp in the DB, and then before
> you update check to see if it has been updated within a certain time
> period. Depending on what you're updating this for (stat counter, etc)
> then this may not work.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Problem with RegEx for BBCode

2010-11-27 Thread Asmann, Roland
Hi all,

I am playing around with PHP and BBCodes and have found some regex's 
that should transform my BBCode into correct HTML when rendering. 
However, I have found that if the BBCode is not correct (eg missing 
closing tag), the regex completely eats my input and my page is empty!

The regex I'm using is:
/\[i\]((\s|.)+?)\[\/i\]/

And with an input like:
This is [i]italic.

I get nothing back.

What I would like is that when no closing tag is found, the opening tag 
should just be shown as-is. Anybody have any idea how I can do this?

Thanks!

-- 
Roland Asmann
Senior Software Engineer

adesso Austria GmbH
Floridotower 26. Stock  T +43 1 2198790-27
Floridsdorfer Hauptstr. 1   F +43 1 2198790-927
A-1210 Wien M +43 664 88657566
E roland.asm...@adesso.at
W www.adesso.at

-
 >>> business. people. technology. <<<
-

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Possible issue in mail() function?

2010-11-27 Thread Tom Hendrikx
On 26/11/10 16:54, Richard Quadling wrote:
> On 26 November 2010 15:12, Tom Hendrikx  wrote:
>> On 26/11/10 15:54, Richard Quadling wrote:
>>> On 25 November 2010 21:30, Tom Hendrikx  wrote:
 Hi,

 I noticed that the mail() function in php 5.3.3 on gentoo linux triggers
 a warning when used. A simple debug script with the contents:

 >>> // recipient, subject, body
 mail("s...@example.com", "mail() test", "This is a test");
 ?>

 does send mail, but it also raises a warning:

 Warning: mail(1): failed to open stream: Permission denied in
 /var/www/www.example.com/htdocs/test-mail/index.php on line 5

 After some googling [1] and fiddling with permissions, the message
 disappears when php has write permissions to the file
 /var/www/www.example.com/htdocs/test-mail/1 , in which it writes the
 following data:
>>>
>>> Are you logging your emails via the ini setting mail.log? Maybe this
>>> is the issue.
>>>
>>
>> Erh, actually, yes I am. Documentation of the setting is rather sparse,
>> but I enabled it some time ago, expecting it to send the data to the
>> logging facility (syslog in my case), after which I forgot to check if
>> that actually happens. The current implementation is rather useless (to
>> me), so I turned it off again.
>>
>> Thanks for the tip, but I think that this is actually a bug? Current way
>> of logging is not very useful, since the file '1' is overwritten (in
>> stead of appended to) with new data at every run of the mail() function.
>>
>> --
>> Regards,
>>Tom
>>
>>
> 
> I'm on windows and my mail.log shows me all the mail I've sent using
> the mail() command since I turned it on.
> 
> But according to
> http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/ext/standard/mail.c?view=markup#l227,
> the mail.log file is opened in append mode.
> 
> I'm guessing PHP isn't responsible here.
> 

Actually, now I understand. I set mail.log to '1', enabling it as a
boolean and expecting it to send the output to whatever error_log points
to. In stead, mail.log expects a string, the path where to log to.

Documentation of the setting is quite sparse, and I failed to notice
that the config option wants a string and no boolean. Mystery solved :)

--
Regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with RegEx for BBCode

2010-11-27 Thread Daniel P. Brown
On Sat, Nov 27, 2010 at 08:57, Asmann, Roland  wrote:
> Hi all,
>
> I am playing around with PHP and BBCodes and have found some regex's
> that should transform my BBCode into correct HTML when rendering.
> However, I have found that if the BBCode is not correct (eg missing
> closing tag), the regex completely eats my input and my page is empty!
[snip!]
>
> What I would like is that when no closing tag is found, the opening tag
> should just be shown as-is. Anybody have any idea how I can do this?


Have you checked into the built-in BBCode library?

http://php.net/bbcode

-- 

Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Strange Query Error...

2010-11-27 Thread Don Wieland

Hi gang,

I am executing a query via PHP that gives me a PHP error:

You have an error in your SQL syntax; check the manual that  
corresponds to your MySQL server version for the right syntax to use  
near 'AND m.`Preferred_First_Name` LIKE 'Don' AND  
m.`Preferred_Last_Name` LIKE 'Wielan' at line 1


but when I copy the ECHO of the select query and run it in Sequel Pro  
Query, it returns no error.


Here is the query:

select m.* from Members m inner join Member_Years my on m.aucciim_id =  
my.member_id where now() < DATE_ADD(DATE_SUB(concat(`member_year` +  
1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND  
m.`Preferred_First_Name` LIKE 'Don' AND m.`Preferred_Last_Name` LIKE  
'Wieland' group by m.AUCCIIM_ID order by m.preferred_last_name


What is causing it to choke via PHP?

Thanks!

Don

Re: [PHP] code quest

2010-11-27 Thread Daniel P. Brown
On Fri, Nov 26, 2010 at 19:03, Kirk Bailey  wrote:
>
> I need a routine that will return a list of every directory immediately
> under the current directory- but nothing else, just a list of directories, 1
> level deep, NO FILES, no listing of current dir or prior dir either.

Simple:

'.$d.''.PHP_EOL;
}
}
?>

   If you want something more powerful - and often quicker - check
into SPL: specifically FilesystemIterator[1], DirectoryIterator[2],
and RecursiveDirectoryIterator[3].  A quick example to link all child
files and directories with relative linking:

 $v) {
if (!preg_match('/\./',$v)) {
$v = str_replace($path.'/',null,$v); // We only want
relative linking
echo ''.$v.''.PHP_EOL;
}
}
?>

-- 

Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with RegEx for BBCode

2010-11-27 Thread Asmann, Roland
On 27-11-10 17:24, Daniel P. Brown wrote:
> On Sat, Nov 27, 2010 at 08:57, Asmann, Roland 
> wrote:
>  > Hi all,
>  >
>  > I am playing around with PHP and BBCodes and have found some regex's
>  > that should transform my BBCode into correct HTML when rendering.
>  > However, I have found that if the BBCode is not correct (eg missing
>  > closing tag), the regex completely eats my input and my page is empty!
> [snip!]
>  >
>  > What I would like is that when no closing tag is found, the opening tag
>  > should just be shown as-is. Anybody have any idea how I can do this?
>
>
> Have you checked into the built-in BBCode library?
>
> http://php.net/bbcode

I'm afraid that is not an option, I don't have that package installed 
and am not allowed to install anything on the server either...

-- 
Roland Asmann
Senior Software Engineer

adesso Austria GmbH
Floridotower 26. Stock  T +43 1 2198790-27
Floridsdorfer Hauptstr. 1   F +43 1 2198790-927
A-1210 Wien M +43 664 88657566
E roland.asm...@adesso.at
W www.adesso.at

-
 >>> business. people. technology. <<<
-

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code quest

2010-11-27 Thread Daniel P. Brown
On Sat, Nov 27, 2010 at 12:36, Daniel P. Brown
 wrote:
>
>   If you want something more powerful - and often quicker - check
> into SPL: specifically FilesystemIterator[1], DirectoryIterator[2],
> and RecursiveDirectoryIterator[3].  A quick example to link all child
> files and directories with relative linking:

Might help to provide the key as well, eh?  Sorry

^1: http://php.net/filesystemiterator
^2: http://php.net/directoryiterator
^3: http://php.net/recursivedirectoryiterator

-- 

Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with RegEx for BBCode

2010-11-27 Thread Asmann, Roland
On 27-11-10 18:44, Asmann, Roland wrote:
> On 27-11-10 17:24, Daniel P. Brown wrote:
>  > On Sat, Nov 27, 2010 at 08:57, Asmann, Roland 
>  > wrote:
>  > > Hi all,
>  > >
>  > > I am playing around with PHP and BBCodes and have found some regex's
>  > > that should transform my BBCode into correct HTML when rendering.
>  > > However, I have found that if the BBCode is not correct (eg missing
>  > > closing tag), the regex completely eats my input and my page is empty!
>  > [snip!]
>  > >
>  > > What I would like is that when no closing tag is found, the opening tag
>  > > should just be shown as-is. Anybody have any idea how I can do this?
>  >
>  >
>  > Have you checked into the built-in BBCode library?
>  >
>  > http://php.net/bbcode
>
> I'm afraid that is not an option, I don't have that package installed
> and am not allowed to install anything on the server either...

Besides, what I don't really understand is WHY does this happen? Any 
other language that has RegEx doesn't match a thing in my example and 
just returns the original input. Why is PHP different in this regard?

-- 
Roland Asmann
Senior Software Engineer

adesso Austria GmbH
Floridotower 26. Stock  T +43 1 2198790-27
Floridsdorfer Hauptstr. 1   F +43 1 2198790-927
A-1210 Wien M +43 664 88657566
E roland.asm...@adesso.at
W www.adesso.at

-
 >>> business. people. technology. <<<
-

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with RegEx for BBCode

2010-11-27 Thread Daniel P. Brown
On Sat, Nov 27, 2010 at 12:50, Asmann, Roland  wrote:
>
> Besides, what I don't really understand is WHY does this happen? Any
> other language that has RegEx doesn't match a thing in my example and
> just returns the original input. Why is PHP different in this regard?

All we've seen is your regexp, not your code - not even which
regexp library you're using.  So that's a pretty ambiguous question,
really.

-- 

Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Strange Query Error...

2010-11-27 Thread Bastien

On 2010-11-27, at 12:30 PM, Don Wieland  wrote:

> Hi gang,
> 
> I am executing a query via PHP that gives me a PHP error:
> 
> You have an error in your SQL syntax; check the manual that corresponds to 
> your MySQL server version for the right syntax to use near 'AND 
> m.`Preferred_First_Name` LIKE 'Don' AND m.`Preferred_Last_Name` LIKE 'Wielan' 
> at line 1
> 
> but when I copy the ECHO of the select query and run it in Sequel Pro Query, 
> it returns no error.
> 
> Here is the query:
> 
> select m.* from Members m inner join Member_Years my on m.aucciim_id = 
> my.member_id where now() < DATE_ADD(DATE_SUB(concat(`member_year` + 
> 1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND m.`Preferred_First_Name` 
> LIKE 'Don' AND m.`Preferred_Last_Name` LIKE 'Wieland' group by m.AUCCIIM_ID 
> order by m.preferred_last_name
> 
> What is causing it to choke via PHP?
> 
> Thanks!
> 
> Don

Try removing the backticks around the table names. If you do use them, then all 
values (field names and table names) need it.

Bastien Koert
Sent from my iPhone


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Strange Query Error...

2010-11-27 Thread Daniel P. Brown
On Sat, Nov 27, 2010 at 12:30, Don Wieland  wrote:
> Hi gang,
>
> I am executing a query via PHP that gives me a PHP error:
>
> You have an error in your SQL syntax; check the manual that corresponds to
> your MySQL server version for the right syntax to use near 'AND
> m.`Preferred_First_Name` LIKE 'Don' AND m.`Preferred_Last_Name` LIKE
> 'Wielan' at line 1
>
> but when I copy the ECHO of the select query and run it in Sequel Pro Query,
> it returns no error.
>
> Here is the query:
>
> select m.* from Members m inner join Member_Years my on m.aucciim_id =
> my.member_id where now() < DATE_ADD(DATE_SUB(concat(`member_year` +
> 1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND m.`Preferred_First_Name`
> LIKE 'Don' AND m.`Preferred_Last_Name` LIKE 'Wieland' group by m.AUCCIIM_ID
> order by m.preferred_last_name
>
> What is causing it to choke via PHP?

This is actually better-suited to the DB list (CC'd) than the
General list, but one primary question: are you using the mysql_*
family, mysqli_* family, or another method of interfacing with MySQL?

-- 

Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Strange Query Error...

2010-11-27 Thread Don Wieland

On Nov 27, 2010, at 10:07 AM, Bastien wrote:

Try removing the backticks around the table names. If you do use  
them, then all values (field names and table names) need it.


I tried that and still chokes...

select m.* from Members m inner join Member_Years my on m.aucciim_id =  
my.member_id where now() < DATE_ADD(DATE_SUB(concat(member_year +  
1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND  
m.Preferred_First_Name LIKE 'Don%' group by m.AUCCIIM_ID order by  
m.preferred_last_name


ERROR: You have an error in your SQL syntax; check the manual that  
corresponds to your MySQL server version for the right syntax to use  
near 'AND m.Preferred_First_Name LIKE 'Don%'' at line 1


Sigh...

Don

Re: [PHP] Strange Query Error...

2010-11-27 Thread Don Wieland

On Nov 27, 2010, at 10:08 AM, Daniel P. Brown wrote:


one primary question: are you using the mysql_*
family, mysqli_* family, or another method of interfacing with MySQL?


mysql_

$results = mysql_query($query) or die(mysql_error());

Don

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Strange Query Error...

2010-11-27 Thread Tommy Pham
> -Original Message-
> From: Don Wieland [mailto:d...@dwdataconcepts.com]
> Sent: Saturday, November 27, 2010 10:18 AM
> To: Bastien
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Strange Query Error...
> 
> On Nov 27, 2010, at 10:07 AM, Bastien wrote:
> 
> > Try removing the backticks around the table names. If you do use them,
> > then all values (field names and table names) need it.
> 
> I tried that and still chokes...
> 
> select m.* from Members m inner join Member_Years my on m.aucciim_id =
> my.member_id where now() < DATE_ADD(DATE_SUB(concat(member_year
> + 1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND
> m.Preferred_First_Name LIKE 'Don%' group by m.AUCCIIM_ID order by
> m.preferred_last_name
> 
> ERROR: You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use near
> 'AND m.Preferred_First_Name LIKE 'Don%'' at line 1
> 
> Sigh...
> 
> Don

Don,

Have you tried to run the query in either MySQL workbench or the command
line to ensure that query is SQL syntax error free?  From the error message,
it sounds more like a SQL syntax error.  If you're able to run the query
fine in the workbench or the command line, then it's a possibility there's a
bug with the mysql extension which I highly doubt.

Regards,
Tommy


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Strange Query Error...

2010-11-27 Thread Daniel P. Brown
On Sat, Nov 27, 2010 at 13:18, Don Wieland  wrote:
> On Nov 27, 2010, at 10:07 AM, Bastien wrote:
>
>> Try removing the backticks around the table names. If you do use them,
>> then all values (field names and table names) need it.
>
> I tried that and still chokes...
>
> select m.* from Members m inner join Member_Years my on m.aucciim_id =
> my.member_id where now() < DATE_ADD(DATE_SUB(concat(member_year +
> 1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND m.Preferred_First_Name
> LIKE 'Don%' group by m.AUCCIIM_ID order by m.preferred_last_name
>
> ERROR: You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use near
> 'AND m.Preferred_First_Name LIKE 'Don%'' at line 1

Note how you keep changing case here.  For example, m.aucciim_id
vs. m.AUCCIIM_ID.  Also note that all of this is cAsE-sEnSiTiVe.

-- 

Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with RegEx for BBCode

2010-11-27 Thread Daniel P. Brown
Please be sure to hit Reply-All so that the list is CC'd on each
response as well.

On Sat, Nov 27, 2010 at 13:55, Asmann, Roland  wrote:
>
> I'm currently running this on a default XAMPP installation on my PC,
> because I was told something similar is running on the server. I thought
> this had a default RegEx lib, or does it have something extra for that?

No, I mistyped, it's not your fault.  I meant: which function are
you using to execute the regexp?

> As for the code, here's the part that I think *should* work, but doesn't
> do the trick for me:
>
> $s = preg_replace("/\[i\]((\s|.)+?)\[\/i\]/", "\\1", $s);

This is exactly what I meant when I erroneously said, "library."

-- 

Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with RegEx for BBCode

2010-11-27 Thread Daniel P. Brown
On Sat, Nov 27, 2010 at 14:05, Daniel P. Brown
 wrote:
> On Sat, Nov 27, 2010 at 13:55, Asmann, Roland  wrote:
>>
>> $s = preg_replace("/\[i\]((\s|.)+?)\[\/i\]/", "\\1", $s);
>
>    This is exactly what I meant when I erroneously said, "library."

Without seeing the rest of your code, try adjusting this
particular preg_replace() line as follows:

$s = preg_replace("/\[i\](.*)\[\/i\]/Us","$1",$s);



-- 

Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with RegEx for BBCode

2010-11-27 Thread Asmann, Roland
Sorry people for not replying over the list...

On 27-11-10 20:08, Daniel P. Brown wrote:
> On Sat, Nov 27, 2010 at 14:05, Daniel P. Brown
>  wrote:
>  > On Sat, Nov 27, 2010 at 13:55, Asmann, Roland
>  wrote:
>  >>
>  >> $s = preg_replace("/\[i\]((\s|.)+?)\[\/i\]/", "\\1", $s);
>  >
>  >This is exactly what I meant when I erroneously said, "library."
>
> Without seeing the rest of your code, try adjusting this
> particular preg_replace() line as follows:
>
> $s = preg_replace("/\[i\](.*)\[\/i\]/Us","$1",$s);

That seems to have done the trick! Thank you!

-- 
Roland Asmann
Senior Software Engineer

adesso Austria GmbH
Floridotower 26. Stock  T +43 1 2198790-27
Floridsdorfer Hauptstr. 1   F +43 1 2198790-927
A-1210 Wien M +43 664 88657566
E roland.asm...@adesso.at
W www.adesso.at

-
 >>> business. people. technology. <<<
-

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Strange Query Error...

2010-11-27 Thread Don Wieland

On Nov 27, 2010, at 10:44 AM, Daniel P. Brown wrote:


   Note how you keep changing case here.  For example, m.aucciim_id
vs. m.AUCCIIM_ID.  Also note that all of this is cAsE-sEnSiTiVe.


You are right. But it still chokes in PHP:

select m.* from Members m inner join Member_Years my on m.AUCCIIM_ID =  
my.member_id where now() < DATE_ADD(DATE_SUB(concat(member_year +  
1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND  
m.Preferred_First_Name LIKE 'Don%' group by m.AUCCIIM_ID order by  
m.preferred_last_name


Don 

Re: [PHP] Strange Query Error...

2010-11-27 Thread Don Wieland

On Nov 27, 2010, at 10:39 AM, Tommy Pham wrote:


Don,

Have you tried to run the query in either MySQL workbench or the  
command
line to ensure that query is SQL syntax error free?  From the error  
message,
it sounds more like a SQL syntax error.  If you're able to run the  
query
fine in the workbench or the command line, then it's a possibility  
there's a

bug with the mysql extension which I highly doubt.


Yes, Tommy. Works fine in mySQL Workbench

Strange...  I have no idea what to do. I got to run it via PHP.

Don

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Strange Query Error...

2010-11-27 Thread Daniel P. Brown
On Sat, Nov 27, 2010 at 14:30, Don Wieland  wrote:
>
> Strange...  I have no idea what to do. I got to run it via PHP.

Don, on which table is the column `member_year` located?  Is that
on `Members`?

-- 

Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Strange Query Error...

2010-11-27 Thread Don Wieland


On Nov 27, 2010, at 11:35 AM, Daniel P. Brown wrote:


Strange...  I have no idea what to do. I got to run it via PHP.


   Don, on which table is the column `member_year` located?  Is that
on `Members`?


it is "Member_Years". I thought of that. I change the query:

select m.* from Members m inner join Member_Years my on m.AUCCIIM_ID =  
my.member_id where now() < DATE_ADD(DATE_SUB(concat(my.member_year +  
1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND  
m.Preferred_First_Name LIKE 'd%' group by m.AUCCIIM_ID order by  
m.Preferred_Last_Name


Still PHP choking and running perfectly in mySQL Workbench.

If someone is feeling generous to assist real-time, I am available on  
SKYPE (skypename = dwdata) and can facilitate a GoToMeeting session.


Pretty please - I just want to get this working and move on ;-)

Don

Re: [PHP] Strange Query Error...

2010-11-27 Thread Daniel P. Brown
On Sat, Nov 27, 2010 at 14:45, Don Wieland  wrote:
> Pretty please - I just want to get this working and move on ;-)

At this point, can you just send the whole related snippet?  The
cases keep changing and there's a lot of other suggestions that you
said you've tried.  Just doing that on my local machine works without
error, so it's likely the result of another part of the code --- hence
why the query works externally.

-- 

Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Strange Query Error...

2010-11-27 Thread Don Wieland

On Nov 27, 2010, at 12:09 PM, Daniel P. Brown wrote:


At this point, can you just send the whole related snippet?  The
cases keep changing and there's a lot of other suggestions that you
said you've tried.  Just doing that on my local machine works without
error, so it's likely the result of another part of the code --- hence
why the query works externally.


Thanks Daniel,

I did search my code prior to call and found an illegal invisible  
character. Working now...


Don

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: [PHP-DB] Re: [PHP] Strange Query Error...

2010-11-27 Thread Karl DeSaulniers


On Nov 27, 2010, at 1:24 PM, Don Wieland wrote:


On Nov 27, 2010, at 10:44 AM, Daniel P. Brown wrote:


   Note how you keep changing case here.  For example, m.aucciim_id
vs. m.AUCCIIM_ID.  Also note that all of this is cAsE-sEnSiTiVe.


You are right. But it still chokes in PHP:

select m.* from Members m inner join Member_Years my on  
m.AUCCIIM_ID = my.member_id where now() < DATE_ADD(DATE_SUB(concat 
(member_year + 1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND  
m.Preferred_First_Name LIKE 'Don%' group by m.AUCCIIM_ID order by  
m.preferred_last_name


Don



Don't know if you necessarily need this but I found it while checking  
to see if one letter names are a good idea in MySQL statements.

Might help in your like query.

http://techonthenet.com/sql/like.php

HTH,
Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php