Re: [PHP] Newbie question. What is the best structure of a php-app?

2011-08-16 Thread Richard Quadling
On 16 August 2011 09:53, Dajka Tamás vi...@vipernet.hu wrote: Hi, Surely there's a wiki/doc somewhere :) But for the start: 1) plan what exactly you want to accomplish ( functionality ) 2) complexity        - if simple, just throw it in one php ( like index.php )        - if more

RE: [PHP] Syntax Question

2011-08-03 Thread admin
-Original Message- From: Gates, Jeff [mailto:gat...@si.edu] Sent: Wednesday, August 03, 2011 10:23 AM To: php-general@lists.php.net Subject: [PHP] Syntax Question I, too, am a super newbie. I have a beginning knowledge of being able to read php and understand its syntax but I

Re: [PHP] Syntax Question

2011-08-03 Thread Gates, Jeff
On 8/3/11 10:41 AM, ad...@buskirkgraphics.com ad...@buskirkgraphics.com wrote: -Original Message- From: Gates, Jeff [mailto:gat...@si.edu] Sent: Wednesday, August 03, 2011 10:23 AM To: php-general@lists.php.net Subject: [PHP] Syntax Question I, too, am a super newbie. I have a

Re: [PHP] Path question.

2011-07-28 Thread Nilesh Govindarajan
On 07/28/2011 05:43 PM, Paul Halliday wrote: I have a few scripts that use ../location/file Is this interpreted differently on some systems? Thanks. I have no idea about it, but I generally use realpath() to avoid any such problems. Windows may have, because it uses backward slashes

Re: [PHP] Path question.

2011-07-28 Thread vikash . iitb
On 28 July 2011 18:06, Nilesh Govindarajan cont...@nileshgr.com wrote: On 07/28/2011 05:43 PM, Paul Halliday wrote: I have a few scripts that use ../location/file Is this interpreted differently on some systems? Thanks. Use __DIR__.../location/file otherwise files using these

RE: [PHP] Path question.

2011-07-28 Thread Dajka Tamas
Yes, can be. There is a predefined variable DIRECTORY_SEPARATOR, which you can use: on index.php let's say define('DS',DIRECTORY_SEPARATOR'); define('MY_APP_ROOT',dirname(realpath(__FILE__))); define('LIB_DIR',MY_APP_ROOT.DSDS.location.DS.file); Cheers, Tamas -Original

Re: [PHP] Path question.

2011-07-28 Thread Richard Quadling
On 28 July 2011 13:36, Nilesh Govindarajan cont...@nileshgr.com wrote: On 07/28/2011 05:43 PM, Paul Halliday wrote: I have a few scripts that use ../location/file Is this interpreted differently on some systems? Thanks. I have no idea about it, but I generally use realpath() to avoid any

Re: [PHP] A Question On Web Graphics

2011-07-12 Thread Chris Stinemetz
  Also I have successfully experimented with Apache and PHP but have not yet identified graphics applications for this venue either! Ideas? You may want to look into PHP:GD link to manual: http://php.net/manual/en/book.image.php HTH, Chris -- PHP General Mailing List

Re: [PHP] A Question On Web Graphics

2011-07-12 Thread Mike Mackintosh
On Jul 12, 2011, at 3:10 PM, Thomas Dineen wrote: Gentle People: Sorry if this appears off topic but I am not sure where to post the question. Please do not get mad, just recommend a better venue! Currently I am quite experienced with C and learning C++ but I have never written

RE: [PHP] Foreach question

2011-07-06 Thread Dajka Tamás
, July 05, 2011 5:47 PM To: Robert Cummings Cc: Dajka Tamás; php-general@lists.php.net Subject: Re: [PHP] Foreach question Just use count($arr) in your for-header, as it get's executed again for each loop. ?php $arr = array(array('id'=1), array('id'=2)); for($i=0;$icount($arr);$i

Re: [PHP] Foreach question

2011-07-05 Thread Louis Huppenbauer
Hi there I think that foreach in your first example just knowns that this should be the last loop (as the array only contains 1 element at start) and so stops there. In your 2nd example however the first loop isn't the last, so the array get's checked again, and now there's another element, so...

Re: [PHP] Foreach question

2011-07-05 Thread Robert Cummings
On 11-07-05 09:40 AM, Dajka Tamas wrote: Hi all, I've bumped into an interesting thing with foreach. I really don't know, if this is normal working, or why it is, so I got curious. The script: foreach ( $cats as$c ) { echo $c['id']; if ( $c['id'] 5 )

Re: [PHP] Foreach question

2011-07-05 Thread Louis Huppenbauer
Or maybe he tried to do the following? ?php foreach ( $cats as$c ) { echo $c['id']; if ($c['id'] 5) { $cats[] = array('id' = ($c['id'] + 1)); } } ? 2011/7/5 Robert Cummings rob...@interjinn.com: On 11-07-05 09:40 AM,

RE: [PHP] Foreach question

2011-07-05 Thread Dajka Tamás
: Robert Cummings [mailto:rob...@interjinn.com] Sent: Tuesday, July 05, 2011 4:06 PM To: Dajka Tamas Cc: php-general@lists.php.net Subject: Re: [PHP] Foreach question On 11-07-05 09:40 AM, Dajka Tamas wrote: Hi all, I've bumped into an interesting thing with foreach. I really don't know

RE: [PHP] Foreach question

2011-07-05 Thread Dajka Tamás
elements from the array... Cheers, Tamas -Original Message- From: Louis Huppenbauer [mailto:louis.huppenba...@gmail.com] Sent: Tuesday, July 05, 2011 4:12 PM To: Robert Cummings Cc: Dajka Tamas; php-general@lists.php.net Subject: Re: [PHP] Foreach question Or maybe he tried

Re: [PHP] Foreach question

2011-07-05 Thread Robert Cummings
On 11-07-05 10:20 AM, Dajka Tamás wrote: Hi, Yeah, I'm really want to do that, since I'm working with the elements of the original array ( skipped that part in sample code ). I've tried your suggestion, but it gives the same result, so on just one input is just gives back '1'. Ahhh... you

Re: [PHP] Foreach question

2011-07-05 Thread Louis Huppenbauer
I don't think that it does this: if ( count($elements) == 1 ) then loop 1; else loop normally; It's probably more something like that: $i=count($elements); loop: $i--; if($i == 0) $last_loop = true; else $last_loop = false if($last_loop) exit; else goto loop; But aside from

RE: [PHP] Foreach question

2011-07-05 Thread Dajka Tamás
with two elements? ( since the first elements copy is pushed as third element, etc ) -Original Message- From: Robert Cummings [mailto:rob...@interjinn.com] Sent: Tuesday, July 05, 2011 4:28 PM To: Dajka Tamás Cc: php-general@lists.php.net Subject: Re: [PHP] Foreach question On 11-07-05

Re: [PHP] Foreach question

2011-07-05 Thread Robert Cummings
On 11-07-05 10:39 AM, Dajka Tamás wrote: Ok, but if it would be that way I shouldn't get '122334455' for second output, no? The item count increments with every iteration of the loop. Or you're saying that, it checks for an existance of nextitem before every loop, and that will fail with

Re: [PHP] Foreach question

2011-07-05 Thread Robert Cummings
On 11-07-05 10:39 AM, Dajka Tamás wrote: Ok, but if it would be that way I shouldn't get '122334455' for second output, no? The item count increments with every iteration of the loop. Or you're saying that, it checks for an existance of nextitem before every loop, and that will fail with just

Re: [PHP] Foreach question

2011-07-05 Thread Robert Cummings
On 11-07-05 09:40 AM, Dajka Tamas wrote: foreach ( $cats as$c ) { echo $c['id']; if ( $c['id'] 5 ) { $c['id']++; $cats[] = $c; } } Given that you seem to want the above

Re: [PHP] Foreach question

2011-07-05 Thread Robert Cummings
On 11-07-05 10:48 AM, Dajka Tamás wrote: Thanks, that was interesting :) I think I got one step further in understanding PHP :) BTW, I've changed the loop to 'for' and it's working well :) Can you show us your for loop? I'm not immediately sure how you use a for loop to traverse a growing

Re: [PHP] Foreach question

2011-07-05 Thread Stuart Dallas
On Tue, Jul 5, 2011 at 2:40 PM, Dajka Tamas vi...@vipernet.hu wrote: I've bumped into an interesting thing with foreach. I really don't know, if this is normal working, or why it is, so I got curious. The script: foreach ( $cats as $c ) { echo $c['id']; if (

Re: [PHP] Foreach question

2011-07-05 Thread Louis Huppenbauer
Just use count($arr) in your for-header, as it get's executed again for each loop. ?php $arr = array(array('id'=1), array('id'=2)); for($i=0;$icount($arr);$i++) { echo $arr[$i]['id']; if($i 6) { $arr[] = array('id' =

Re: [PHP] Foreach question

2011-07-05 Thread Robert Cummings
On 11-07-05 11:46 AM, Louis Huppenbauer wrote: Just use count($arr) in your for-header, as it get's executed again for each loop. ?php $arr = array(array('id'=1), array('id'=2)); for($i=0;$icount($arr);$i++) { echo $arr[$i]['id']; if($i 6) {

Re: [PHP] simple question abt convert to integer

2011-05-25 Thread Vitalii Demianets
On Wednesday 25 May 2011 07:05:18 Negin Nickparsa wrote: my code is this: $query1=select * from patient where id=.$_POST['txt']; it works but Holy Jesus! Can't wait to send to your server POST request with txt=1;DROP DATABASE; -- Of course, if you'll switch to prepare statement instead of

Re: [PHP] simple question abt convert to integer

2011-05-25 Thread Bálint Horváth
Of course have to use filters and etc... Bálint Horváth On 25 May 2011 09:53, Vitalii Demianets vi...@nppfactor.kiev.ua wrote: On Wednesday 25 May 2011 07:05:18 Negin Nickparsa wrote: my code is this: $query1=select * from patient where id=.$_POST['txt']; it works but Holy Jesus! Can't

Re: [PHP] simple question abt convert to integer

2011-05-25 Thread Ashley Sheridan
Vitalii Demianets vi...@nppfactor.kiev.ua wrote: On Wednesday 25 May 2011 07:05:18 Negin Nickparsa wrote: my code is this: $query1=select * from patient where id=.$_POST['txt']; it works but Holy Jesus! Can't wait to send to your server POST request with txt=1;DROP DATABASE; -- Of course, if

Re: [PHP] simple question abt convert to integer

2011-05-25 Thread Andre Polykanine
Hello Negin, $query1=select * from patient where id=.$_POST['txt']; $result1=mysql_query($query1); $rows=mysql_num_rows($result1); Note: you *didn't* execute the query by calling mysql_query on it. -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion

Re: [PHP] simple question abt convert to integer

2011-05-25 Thread Negin Nickparsa
Tnx to all:D Paul you are absolutly right:D it was a bad mistake from me there was no need 2 convert it Balint helped me n with mysql_error i found that my code hasn't any mistake i just forgot the BIG thing! selecting db:D i totally forgot it because i had array keys with if statement n in there

Re: [PHP] simple question abt convert to integer

2011-05-25 Thread Bálint Horváth
The problem is that if you set the post directly to the query it's available to be an attach code in the field... (eg. DROP DATABASE;) it's called to SQL injection... what I mean on filtering: always check the values in query eg.: $id = $_POST['id']; if(is_numeric($id)){...}else{bad post} and at

Re: [PHP] simple question abt convert to integer

2011-05-25 Thread Negin Nickparsa
i got it tnx Balint

Re: [PHP] simple question abt convert to integer

2011-05-24 Thread Bálint Horváth
Hi, I've a simply idea... If you have integer in your mysql, don't use at that field in the query... Try this: $query=select * from patient where id=.$id.; There isn't apostrofy in the mysql query... Bálint Horváth On 25 May 2011 06:06, Negin Nickparsa nickpa...@gmail.com wrote: my code is

Re: [PHP] simple question abt convert to integer

2011-05-24 Thread Negin Nickparsa
$id=(int)$_POST['txt']; $query1=select * from patient where id=.$id.; echo $query1; $result1=mysql_query($query1); echo $result1; $num2=Mysql_num_rows($result1); $num3=Mysql_num_fields($result1); still it has previous error Here is my output:select * from patient where id=1 *Warning*:

Re: [PHP] simple question abt convert to integer

2011-05-24 Thread Negin Nickparsa
Bálint Horváth, the second post of me is using your idea your idea is working but why i have error still?

Re: [PHP] simple question abt convert to integer

2011-05-24 Thread Negin Nickparsa
$result1=mysql_query($query1); echo $result1; it can't echo $result1 i don't know why?

Re: [PHP] simple question abt convert to integer

2011-05-24 Thread Bálint Horváth
If the query is incorrect u get boolean: false, if its correct u get a resource id... Bálint Horváth On 25 May 2011 06:28, Negin Nickparsa nickpa...@gmail.com wrote:

Re: [PHP] simple question abt convert to integer

2011-05-24 Thread Negin Nickparsa
i recieve nothing not a resource id and nore false

Re: [PHP] simple question abt convert to integer

2011-05-24 Thread Paul M Foster
On Wed, May 25, 2011 at 08:57:18AM +0430, Negin Nickparsa wrote: $id=(int)$_POST['txt']; $query1=select * from patient where id=.$id.; You're not *thinking* about what you're doing. The above is silly. Think about it: you're sending a string to MySQL. If $_POST['txt'] returns a string which

Re: [PHP] simple question abt convert to integer

2011-05-24 Thread Bálint Horváth
Problem solved succesfully after changed the query integer apostrofyless.. and printed the mysql_errno() and mysql_error()... Remember: -In the script languages as php the apostrofy ' or or sg. like these means the string marker... -While ure developing show all error codes and messages... -If

RE: [PHP] htaccess question

2011-05-23 Thread admin
First turn your ReWriteEngine On. This can be done in the particular folder to allow them access to only the one file. You need to understand the conditions of mod_rewrite read below. http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html OR you can just use the http://cooletips.de/htaccess/

Re: [PHP] htaccess question

2011-05-23 Thread Alex Nikitin
On Mon, May 23, 2011 at 11:52 AM, Al n...@ridersite.org wrote: How can I prevent access to all files in a directory except one with an htaccess file. I've tried several approaches found with Googling; but, none seem to work. e.g., FilesMatch ^(makeScodeImg.php) Order Allow,Deny Deny from

Re: [PHP] Session question

2011-05-17 Thread Per Jessen
Paul Halliday wrote: Is it OK to have session_start as an include? Yes. -- Per Jessen, Zürich (18.1°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Explode Question

2011-05-17 Thread Marc Guay
$one = array(0 ='golf', 1 = 'field'); $two = array(0 = On the golf course or in the field of clover); $array_exp = explode($one, $two); What's the desired result? array('golf' = On the golf course or in the field of clover, 'field' = On the golf course or in the field of clover)); ? Marc

RE: [PHP] Explode Question

2011-05-17 Thread admin
: Tuesday, May 17, 2011 7:52 PM To: php-general@lists.php.net Subject: Re: [PHP] Explode Question $one = array(0 ='golf', 1 = 'field'); $two = array(0 = On the golf course or in the field of clover); $array_exp = explode($one, $two); What's the desired result? array('golf' = On the golf course

Re: [PHP] Explode Question

2011-05-17 Thread James Yerge
Message- From: Marc Guay [mailto:marc.g...@gmail.com] Sent: Tuesday, May 17, 2011 7:52 PM To: php-general@lists.php.net Subject: Re: [PHP] Explode Question $one = array(0 ='golf', 1 = 'field'); $two = array(0 = On the golf course or in the field of clover); $array_exp = explode($one, $two

Re: [PHP] Explode Question

2011-05-17 Thread James Yerge
Message- From: Marc Guay [mailto:marc.g...@gmail.com] Sent: Tuesday, May 17, 2011 7:52 PM To: php-general@lists.php.net Subject: Re: [PHP] Explode Question $one = array(0 ='golf', 1 = 'field'); $two = array(0 = On the golf course or in the field of clover); $array_exp = explode($one, $two

RE: [PHP] Explode Question

2011-05-17 Thread admin
Subject: Re: [PHP] Explode Question On 05/17/2011 07:53 PM, ad...@buskirkgraphics.com wrote: The desired result is. Array ( [0] = On the; [1] = course or in the; [2] = of colver; ); I am just not sure the delimiter can be an array in the Explode function. Richard L

Re: [PHP] Explode Question

2011-05-17 Thread James Yerge
...@buskirkgraphics.com Cc: 'Marc Guay'; php-general@lists.php.net Subject: Re: [PHP] Explode Question On 05/17/2011 07:53 PM, ad...@buskirkgraphics.com wrote: The desired result is. Array ( [0] = On the; [1] = course or in the; [2] = of colver; ); I am just not sure

RE: [PHP] Session question

2011-05-17 Thread Ross Hansen
13:01:19 +0200 To: php-general@lists.php.net Subject: Re: [PHP] Session question Paul Halliday wrote: Is it OK to have session_start as an include? Yes. -- Per Jessen, Zürich (18.1°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http

RE: [PHP] Session question

2011-05-17 Thread admin
Hansen [mailto:hansen.r...@live.com.au] Sent: Tuesday, May 17, 2011 11:16 PM To: php-general@lists.php.net Subject: RE: [PHP] Session question Unless your adding more code to your included file it isn't worth having it as an include as there is more typing/text involved. For management purposes

Re: [PHP] openssl question

2011-04-18 Thread Sean Greenslade
On Wed, Apr 6, 2011 at 3:41 PM, Kai Renz writeme...@googlemail.com wrote: Hi, i try to create a self signed certificate using this code: snip I'm using a windows box with xampp installed. regards. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Silly question

2011-04-11 Thread Stuart Dallas
On Monday, 11 April 2011 at 02:12, Curtis Maurand wrote: nevermind. There is a function: fgetcsv(); Ewww! http://blog.ericlamb.net/2010/01/parse-apache-log-files-with-php/ -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ Curtis Maurand wrote: Hello, I'm trying to run through an

Re: [PHP] Silly question

2011-04-11 Thread Curtis Maurand
Stuart Dallas wrote: On Monday, 11 April 2011 at 02:12, Curtis Maurand wrote: nevermind. There is a function: fgetcsv(); Ewww! Say what you want, it works.  Your solution is way more elegant.  regex's are not my strong suit.  I have to have the regex pocket reference to understand that

Re: [PHP] Silly question

2011-04-11 Thread Stuart Dallas
On Monday, 11 April 2011 at 13:17, Curtis Maurand wrote: Stuart Dallas wrote: On Monday, 11 April 2011 at 02:12, Curtis Maurand wrote: nevermind. There is a function: fgetcsv(); Ewww! Say what you want, it works. Your solution is way more elegant. regex's are not my strong suit. I

Re: [PHP] Silly question

2011-04-11 Thread Richard Quadling
On 11 April 2011 13:23, Stuart Dallas stu...@3ft9.com wrote: On Monday, 11 April 2011 at 13:17, Curtis Maurand wrote: Stuart Dallas wrote: On Monday, 11 April 2011 at 02:12, Curtis Maurand wrote: nevermind. There is a function: fgetcsv(); Ewww! Say what you want, it works. Your

Re: [PHP] Silly question

2011-04-10 Thread Curtis Maurand
nevermind.  There is a function: fgetcsv(); Thanks, Curtis Curtis Maurand wrote: Hello, I'm trying to run through an apache log file in an attempt to get all of the user agents. The question is how do I split the string?  I can't seem to find a workable delimiter.  Each section of

RE: [PHP] Security Question

2011-04-09 Thread tedd
At 2:53 PM -0500 4/8/11, Jay Blanchard wrote: [snip] whats the best way to learn about security in php? [/snip] Study, study, study! Chris Shiflett is a recognized expert on PHP security - http://shiflett.org/ He has a great book on PHP Security -

RE: [PHP] Security Question

2011-04-08 Thread Jay Blanchard
[snip] whats the best way to learn about security in php? [/snip] Study, study, study! Chris Shiflett is a recognized expert on PHP security - http://shiflett.org/ He has a great book on PHP Security - http://www.amazon.com/exec/obidos/ASIN/059600656X/ref=nosim/chrisshiflet t-20 -- PHP

RE: [PHP] Security Question

2011-04-08 Thread Alex Nikitin
Best way to learn about security of something is to learn how to break it... On Apr 8, 2011 3:55 PM, Jay Blanchard jblanch...@pocket.com wrote: [snip] whats the best way to learn about security in php? [/snip] Study, study, study! Chris Shiflett is a recognized expert on PHP security -

Re: [PHP] Security Question

2011-04-08 Thread Adam Richardson
On Fri, Apr 8, 2011 at 3:24 PM, nighthawk1256 er...@ns.sympatico.ca wrote: hey guys/girls, whats the best way to learn about security in php? Here are some relevant topics to consider: - Validate input (only accept what you're expecting, via GET, POST, and COOKIE, and don't try to fix

Re: [PHP] Newbi Question with calculate

2011-04-06 Thread Me
I will give you a mysql example. Apply the logic to the table during the query so you can just loop over the results like such. $ABEI=12; $query = ' select last * '.$ABEI.' AS resulta From table'; Sent via DROID on Verizon Wireless -Original message- From: Silvio Siefke

Re: [PHP] Newbi Question with calculate

2011-04-06 Thread Silvio Siefke
Hello, sorry i has not correct write. The example when is finish can see at http://silviosiefke.de/finance/stock/stock.php For this i not use a mysql Database, its normal not so much at data. I have write the source as Text Files: http://silviosiefke.de/finance/finished/txt/index.txt - That

Re: [PHP] Path question

2011-03-31 Thread tedd
At 9:18 PM -0400 3/28/11, Jack wrote: Hello All, Is there a smarter way to do includes by setting up a path or something where I don't have to include /home/domain.com/includes/include_file.php Apparently my path is as shown above, but I would prefer to just put in

Re: [PHP] Path question

2011-03-30 Thread Richard Quadling
On 29 March 2011 19:41, D. Dante Lorenso da...@lorenso.com wrote: On 3/28/11 8:18 PM, Jack wrote: Hello All, Is there a smarter way to do includes by setting up a path or something where I don't have to include /home/domain.com/includes/include_file.php Apparently my path is as shown above,  

Re: [PHP] Path question

2011-03-29 Thread D. Dante Lorenso
On 3/28/11 8:18 PM, Jack wrote: Hello All, Is there a smarter way to do includes by setting up a path or something where I don't have to include /home/domain.com/includes/include_file.php Apparently my path is as shown above, but I would prefer to just put in /includes/include_file.php I

Re: [PHP] Path question

2011-03-28 Thread Paul M Foster
On Mon, Mar 28, 2011 at 09:18:39PM -0400, Jack wrote: Hello All, Is there a smarter way to do includes by setting up a path or something where I don't have to include /home/domain.com/includes/include_file.php Apparently my path is as shown above, but I would prefer to just put in

Re: [PHP] Design question

2011-02-05 Thread Ashley Sheridan
On Sat, 2011-02-05 at 11:11 -0500, li...@pruimphotography.com wrote: Morning everyone! I have a design question... No it's not about the interior of my house... although I could use some help with that as well... I am working on a framework for my own use (And maybe one day will beat

Re: [PHP] Design question

2011-02-05 Thread Paul M Foster
On Sat, Feb 05, 2011 at 11:11:57AM -0500, li...@pruimphotography.com wrote: Morning everyone! I have a design question... No it's not about the interior of my house... although I could use some help with that as well... I am working on a framework for my own use (And maybe one day will

Re: [PHP] Design question

2011-02-05 Thread Jason Pruim
On Feb 5, 2011, at 11:19 AM, Ashley Sheridan wrote: On Sat, 2011-02-05 at 11:11 -0500, li...@pruimphotography.com wrote: Morning everyone! I have a design question... No it's not about the interior of my house... although I could use some help with that as well... I am working on a

Re: [PHP] Design question

2011-02-05 Thread Jason Pruim
On Feb 5, 2011, at 6:46 PM, Paul M Foster wrote: On Sat, Feb 05, 2011 at 11:11:57AM -0500, li...@pruimphotography.com wrote: Morning everyone! I have a design question... No it's not about the interior of my house... although I could use some help with that as well... I am working on a

Re: [PHP] preg_replace question

2011-01-25 Thread Merlin Morgenstern
Am 24.01.2011 18:08, schrieb Alex Nikitin: If you declare your arrays, and set k to 0 first, put quotes around array values and use the correct limit (you can default to -1), you will get results, here is code and example (hopefully this helps you) ?php function internal_links($str,

Re: [PHP] preg_replace question

2011-01-25 Thread Merlin Morgenstern
Am 25.01.2011 12:31, schrieb Merlin Morgenstern: Am 24.01.2011 18:08, schrieb Alex Nikitin: If you declare your arrays, and set k to 0 first, put quotes around array values and use the correct limit (you can default to -1), you will get results, here is code and example (hopefully this helps

Re: [PHP] preg_replace question

2011-01-25 Thread Richard Quadling
On 25 January 2011 12:04, Merlin Morgenstern merli...@fastmail.fm wrote: Am 25.01.2011 12:31, schrieb Merlin Morgenstern: Am 24.01.2011 18:08, schrieb Alex Nikitin: If you declare your arrays, and set k to 0 first, put quotes around array values and use the correct limit (you can default to

Re: [PHP] preg_replace question

2011-01-25 Thread Alex Nikitin
$internal_links=array(); I prefer to init arrays, it also avoids unnecessary notices, and sometimes weird results, but either one of those while loops should make the desired array while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { array_push($internal_links, array('phrase'=$row['phrase'],

Re: [PHP] preg_replace question

2011-01-24 Thread David Harkness
Without seeing the code that creates the arrays, it's tough to see the problem. It looks like the first replacement is catching Beagle Welpen entirely since the closing /a tag gets placed after Welpen. Then the second replacement does just Welpen. Also, you should have quotes around link when

Re: [PHP] preg_replace question

2011-01-24 Thread Alex Nikitin
If you declare your arrays, and set k to 0 first, put quotes around array values and use the correct limit (you can default to -1), you will get results, here is code and example (hopefully this helps you) ?php function internal_links($str, $links, $limit=-1) {

Re: [PHP] preg_replace question

2011-01-24 Thread Jim Lucas
On 1/24/2011 8:00 AM, Merlin Morgenstern wrote: Hi there, I am trying to replace certain words inside a text with php. Unfortunatelly my function is creating invalid html as output. For example the words beagle and welpen have to be replaced inside this text: süße knuffige Beagle Welpen

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-21 Thread Richard Quadling
On 20 January 2011 19:20, Dotan Cohen dotanco...@gmail.com wrote: On Thu, Jan 20, 2011 at 19:21, Richard Quadling rquadl...@gmail.com wrote: That is terrific, at least the first half. The second half, with the Venn diagrams, is awkward! When you get heavily nested data, the adjacent list

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-21 Thread Richard Quadling
On 21 January 2011 05:34, Paul M Foster pa...@quillandmouse.com wrote: On Thu, Jan 20, 2011 at 12:05:53PM -0800, David Harkness wrote: On Thu, Jan 20, 2011 at 7:00 AM, Richard Quadling rquadl...@gmail.comwrote: I'd recommend using a nested set approach for the tags

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-21 Thread Dotan Cohen
Actually, I'm the customer! But assuming that a customer exists, that implies compensation, and therefore fair bait. Then that's different altogether. you get to decide what information is displayed, and what information is 'sensed', and on what platform. Yes, but before I get to that stage

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-21 Thread Dotan Cohen
If you are doing this often, you could leave spaces in the left and right values so that you could minimize the number of rows that need to be updated. The article makes every leaf use x and x+1 for left and right which forces another update to add a child. If instead you used x and x+20 you'd

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-21 Thread Dotan Cohen
On Fri, Jan 21, 2011 at 12:29, Richard Quadling rquadl...@gmail.com wrote: Changing data in a database is the role of the database engine. It is much more efficient to have the cost on the insert than it is on the select. Agreed. On insert I could even delegate the operation to another thread

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-21 Thread David Harkness
On Fri, Jan 21, 2011 at 4:44 AM, Dotan Cohen dotanco...@gmail.com wrote: Then I would have to check what values are available when inserting, and possibly normalise every so often. I'll think about that, and when I have enough data in the database I'll set up a test system to play with the

Re: [PHP] Parse question

2011-01-21 Thread Joshua Kehn
On Jan 21, 2011, at 7:52 PM, Ron Piggott wrote: Would someone write me a syntax so all the web site addresses in $data turn into links $data = “Visit our web site http://www.site.com, http://www.secondsite.org and http://www.thirdsite.info.”; My desired results for what I am asking

Re: [PHP] Parse question

2011-01-21 Thread Nicholas Kell
On Jan 21, 2011, at 6:52 PM, Ron Piggott wrote: Would someone write me a syntax so all the web site addresses in $data turn into links $data = “Visit our web site http://www.site.com, http://www.secondsite.org and http://www.thirdsite.info.”; My desired results for what I am asking

Re: [PHP] Parse question

2011-01-21 Thread Ron Piggott
On Jan 21, 2011, at 6:52 PM, Ron Piggott wrote: Would someone write me a syntax so all the web site addresses in $data turn into links $data = “Visit our web site http://www.site.com, http://www.secondsite.org and http://www.thirdsite.info.”; My desired results for what I am asking

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread Richard Quadling
On 20 January 2011 14:32, Dotan Cohen dotanco...@gmail.com wrote: I am designing an application that make heavy usage of one-to-many tags for items. That is, each item can have multiple tags, and there are tens of tags (likely to grow to hundreds). Most operation on the database are expected

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread Dotan Cohen
On Thu, Jan 20, 2011 at 18:20, Dotan Cohen dotanco...@gmail.com wrote: On Thu, Jan 20, 2011 at 17:00, Richard Quadling rquadl...@gmail.com wrote: I'd have my items table, my tags table and a join table for the two. My join table is really simple. UniqueID, ItemID, TagID. Yes, that is the

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread Richard Quadling
On 20 January 2011 16:20, Dotan Cohen dotanco...@gmail.com wrote: On Thu, Jan 20, 2011 at 17:00, Richard Quadling rquadl...@gmail.com wrote: I'd have my items table, my tags table and a join table for the two. My join table is really simple. UniqueID, ItemID, TagID. Yes, that is the first

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread David Harkness
I cannot agree more with the others about using a join table. While it's tempting to go with your first solution due to fear of performance issues, you can usually address performance issues with a technical solution. Addressing problems that arise from a constraining design choice is much more

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread David Hutto
Pseudo = Design Algorithm Design Algorithm = Actual Code Actual Code = Alterable db tables Alterable db tables = manipulated data through the app interface with data -- The lawyer in me says argue...even if you're wrong. The scientist in me... says shut up, listen, and then argue. But the lawyer

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread Dotan Cohen
On Thu, Jan 20, 2011 at 19:21, Richard Quadling rquadl...@gmail.com wrote: That is terrific, at least the first half. The second half, with the Venn diagrams, is awkward! When you get heavily nested data, the adjacent set model (where you have a parentid for every uniqueid), you very quickly

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread Dotan Cohen
On Thu, Jan 20, 2011 at 20:50, David Hutto smokefl...@gmail.com wrote: Pseudo = Design Algorithm Design Algorithm = Actual Code Actual Code = Alterable db tables Alterable db tables = manipulated data through the app interface with data -- The lawyer in me says argue...even if you're wrong.

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread David Hutto
Is this a troll? Am I about to be baited? Baited to deploy what is designed to the consumer's specification? Surely. From what is wanted to what is needed. Troll on that. -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- The lawyer in me says argue...even if you're

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread Dotan Cohen
On Thu, Jan 20, 2011 at 21:24, David Hutto smokefl...@gmail.com wrote: Is this a troll? Am I about to be baited? Baited to deploy what is designed to the consumer's specification? Surely. From what is wanted to what is needed. Troll on that. Actually, I'm the customer! But assuming that a

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread David Hutto
On Thu, Jan 20, 2011 at 2:26 PM, Dotan Cohen dotanco...@gmail.com wrote: On Thu, Jan 20, 2011 at 21:24, David Hutto smokefl...@gmail.com wrote: Is this a troll? Am I about to be baited? Baited to deploy what is designed to the consumer's specification? Surely. From what is wanted to what is

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread David Harkness
On Thu, Jan 20, 2011 at 7:00 AM, Richard Quadling rquadl...@gmail.comwrote: I'd recommend using a nested set approach for the tags (http://dev.mysql.com/tech-resources/articles/hierarchical-data.html gives a good explanation on the issues and methodology of nested sets). Thanks for the

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread Dotan Cohen
On Thu, Jan 20, 2011 at 22:05, David Harkness davi...@highgearmedia.com wrote: Thanks for the link. That article proposes an interesting way to organize the categories. Have you implemented this in the wild? Clearly the design would work as it's pretty simple, and I like that it removes the

Re: [PHP] Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist

2011-01-20 Thread David Harkness
On Thu, Jan 20, 2011 at 12:21 PM, Dotan Cohen dotanco...@gmail.com wrote: I understood that. My concern is exactly with adding new nodes. There is no incrementor (++i) in SQL, so knowingly coding a solution that will require incrementing two fields in half the database rows seems

<    1   2   3   4   5   6   7   8   9   10   >