Re: [PHP] Microsoft access + php

2003-03-18 Thread fLIPIS
I've written a tutorial on my site about this subject. You can find it here:

http://www.flipis.net/tutoriales/php_myaccess.php

It's in spanish, though



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



[PHP] Re: SQL DISTINCT with MYSQL

2003-03-17 Thread fLIPIS

"Vernon" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> I'm setting up a user online system using MySQL where I have 4 fields, all
> of which is working fine.
>
> I need the information from all the fields but want only distinct values
> based on the uname column. If I use the:
>
> SELECT DISTINCT uname
> FROM useronline
>
> of course I come back with the values I desire, but only the user names.
>
> As I am also tracking the page they are on I need other columns in the
table
> as well. So the question is, using an SQL statement, how do I return only
> distinct useronline.uname values from the database as well as the
> useronline.file column?
>
> Thanks


You can try using an INNER JOIN syntax. Like this:

SELECT DISTINCT(useronline.uname) FROM useronline INNER JOIN file ON
file.useronline = useronline.name WHERE useronline.uname LIKE'
%your_Criteria_1%' AND file.useronline LIKE '%you_criteria_2%'

I dunno if this is what you're looking for.

Hope it helps
fLIPIS



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



[PHP] Re: Help with preg_replace() , PLEASE

2003-03-13 Thread fLIPIS
Got the solution (i wonder why i always get into the list, post the question
and end up with the answer 15 minutes later. I'm obviously too nervous and
rush for help :-) )

The correct code is the following:



And that's all, folks!!!
EOT;

$text =
preg_replace("/(.*)(<\?.*?\?>)(.*)/imse","'\\1'.highlight_string('\\2',
TRUE).'\\3'",$text);
echo $text;

?>

The error was the TRUE parameter to highlight_string(). The RegExp was
allright.
Note that if you use "" in the PHP code you want to color, you'll receive an
error. My solution for that:

$text = str_replace("\"","'",$text);

As the ' is also colored using highlight_string()

So, here it is the solution. Now, i'm running onto making my PHP forum !!!
Cya all!!



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



[PHP] Help with preg_replace() , PLEASE

2003-03-13 Thread fLIPIS
I'm going mad about this. Now, i've got the following text:

- BEGIN TEXT --

Let's see a very simple class sample



And this was the sample

-- END TEXT ---


I'm using preg_replace() to replace the PHP code qith the result of doing a
highlight_string() to it. So i use this code:

preg_replace("/(.*)(<\?.*?\?>)(.*)/imse","'\\1'.highlight_string('\\2').'\\3
'",$text);

It ouputs this:



In colored code, as you might see.

and the weirdest of all: when i use this code:

preg_replace("/(.*)(<\?.*?\?>)(.*)/imse","''.highlight_string('\\1').''.high
light_string('\\2').''.highlight_string('\\3').''",$text);

It recognizes the \\1 and \\3 strings



Why can't i use then

preg_replace("/(.*)(<\?.*?\?>)(.*)/imse","''.strtolower('\\1').''.highlight_
string('\\2').''.strtolower('\\3').''",$text]);

or even a simpler

preg_replace("/(.*)(<\?.*?\?>)(.*)/imse","'\\1'.highlight_string('\\2').'\\3
'",$text);




I'm trying to separate the code from the rest of strings, as you might see.
Can anyone help me? I got this far, and i feel it's a very silly thing, but
i can't seem to be able to get it.

Any ideas?



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



Re: [PHP] Help with ereg()

2003-03-12 Thread fLIPIS
No, actually i was wrong about this subject. The correct Regular Expression
for this is the following:

preg_match_all("/(<\?.*?\?>)/ims",$text,$source_code);

The anterior was greedy, and so it matched the following:



And now it only takes the text between , even multilined code.



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



[PHP] Re: tricky exec problem

2003-03-11 Thread fLIPIS

"Daniel" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> hi guys i am having a problem getting certain command line output bak to
php
> i am using the time binary to show the ammount of time it takes for the
php
> script to be compiled using the command line php although i am not getting
any
> output
>
> exec("/usr/bin/time php -q /www/sbsmain/worldarts/index.php3 > /dev/null
> 2>&1",$results,$err);
>
> i have tried this but it wont work , any ideas ?


Why not try passthru() ?



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



Re: [PHP] Help with ereg()

2003-03-11 Thread fLIPIS
¡¡¡ Got it !!
It even matches the linebreaks, so it can color multi-line code. Look at
this sample:

- TEXT TO USE FOR SEARCHING
PATTERNS --





-- END
TEXT ---

Script used to get all of the matches:

preg_match_all("/(<\?.*\?>)/ims",$HebraPadre["texto"],$codigo_fuente_padre);

echo "";
echo highlight_string($codigo_fuente_padre[1][0], TRUE);
echo highlight_string($codigo_fuente_padre[1][1], TRUE);
echo highlight_string($codigo_fuente_padre[1][2], TRUE);
echo "";

And it works quite OK
I removed the (\ at the beginning, and added the "s" to the end.

Thanks, without your tip I was real lost. It was while reading this

http://php.benscom.com/manual/es/pcre.pattern.syntax.php

that i realized how to do it.

Thanks very much

fLIPIS



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