php-general Digest 12 Jan 2002 18:34:40 -0000 Issue 1107

Topics (messages 80266 through 80299):

two mysql issues :)
        80266 by: Mehmet Kamil ERISEN

Re: preg_replace help
        80267 by: Jimmy

Re: Newbie looking for mentor
        80268 by: P. Westover

Re: PHP question regarding Cold Fusion
        80269 by: Philip Olson
        80289 by: Wandrer
        80290 by: bvr.xs4all.nl

name and value tags in a form
        80270 by: Kunal Jhunjhunwala
        80274 by: Nick Wilson
        80275 by: Kunal Jhunjhunwala
        80276 by: Nick Wilson
        80279 by: Kunal Jhunjhunwala

HTTP Server vars
        80271 by: Gerard Samuel

OT kind of..
        80272 by: Richard Baskett
        80273 by: Rasmus Lerdorf

Fatal error: Cannot instantiate non-existent class
        80277 by: millw0rm
        80280 by: Nick Wilson

Fatal Error
        80278 by: millw0rm

multiple replaces...
        80281 by: Lauri Vain
        80282 by: Nick Wilson
        80283 by: Lauri Vain
        80285 by: Nick Wilson
        80286 by: DL Neil
        80287 by: bvr.xs4all.nl
        80291 by: Victor Boivie

Whoops (was:RE: [PHP] multiple replaces...)
        80284 by: Lauri Vain

Re: multiple replaces... (2)
        80288 by: bvr.xs4all.nl

Development environment
        80292 by: Morten Nielsen
        80293 by: Nick Wilson

Mysql('mydb", "SHOW TABLES FROM mydbname") ???
        80294 by: Chris
        80296 by: Miles Thompson

beginer
        80295 by: Vania Lavielle Castro
        80297 by: Vania Lavielle Castro
        80299 by: Deron

DUH!!!! Why didn't I see that?
        80298 by: Chris

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:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---

Hi All,

I am in sql mode today. Two issues that bother me:

1- I had a script"

select user_id, username from users having user_id = max(user_id)

my max user_id = 150 or something, but script kept bringing 122 

I fixed the issue by using a select max(user_id) and select username from users where 
user_id = $v_user_id

 

2- select max(commission) where territory=1 and salesperson=2232;

this query should return 0 zero b/c it's a sum..... but it returns null.  

any comments how I can work around this!!! 

thanks.


Mehmet Erisen
http://www.erisen.com


---------------------------------
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail.
--- End Message ---
--- Begin Message ---
Hi Gaylen,

> Please visit my web site at <a
> href=http://www.mysite.com>www.mysite.com</a>. You will be glad you did!

assumming all link start with www and all word which start
with www must be a link:

$repLink = preg_replace("/ (www[^ ]*) /i",
                        "<a href='http://\\1'>\\1</a>",
                        $myLink);

--
Jimmy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
People are like clouds, all unique.


--- End Message ---
--- Begin Message ---
Hi All,

Thank you very much for all the responses to my SOS.  Yoda has made contact.

P. Westover





"P. Westover" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> It all started when I wanted to create a photography competition and forum
> on my web site.  I searched and searched for a program (script) on the web
> that would help me.
>
> I found one and paid $125.00 for it, but I am very unhappy with the way it
> works.  It is not very user friendly and I'm loosing potential members
> because of it.  I have asked the programmer to assist me in creating it
the
> way I want it, he said he would,
> I have yet to see the updates I requested.  So I've taken it upon myself
to
> create a script tailored to my needs.
>
> I have written HTML, some JavaScript, and very little CGI.  I thought I
> could handle creating this script.  I went to my nearest Barnes and Noble
> and bought 5 books on PHP and MySQL.  I have been reading them for 2 weeks
> and doing the lessons in one of the books until I'm bleary eyed.  I have a
> basic understanding, but I don't know where to begin.
>
> I'm looking for someone with a little patience, who can get me on the
right
> path and guide me through.  I don't know what I can give you in
return...we
> can talk about it if you're interested.
>
> P. Westover
>
>


--- End Message ---
--- Begin Message ---
On Fri, 11 Jan 2002, Rasmus Lerdorf wrote:
> Google for something called PostToHost I wrote ages ago.  Lots of
> variations of that around.  Basically you just fsockopen() to the site in
> question and fputs() your request and POST data and then fgets() the
> result.

With one variation being sendtohost()

  http://dodds.net/~cardinal/sendtohost.txt

regards,
Philip Olson

--- End Message ---
--- Begin Message ---
At 09:43 PM 1/11/02 -0500, you wrote:
>The tag I am talking about is <CFHTTP>.  This tag allows you to emulate the
>posting of a form, but also allows you to capture the results of the post.
>There are a couple of forms written in CF that connect to the merchant
>account, check a credit card, for example, and then wait for the
>approval/denial response.
>Is there anything in PHP that can do this same kind of thing?  Any help
>would be appreciated.

Check out Snoopy - http://snoopy.sourceforge.net/


--- End Message ---
--- Begin Message ---

I believe another option is the CURL library module for PHP.

see manual:

XII. CURL, Client URL Library Functions

bvr.

On Sat, 12 Jan 2002 09:01:39 -0500, Wandrer wrote:

>At 09:43 PM 1/11/02 -0500, you wrote:
>>The tag I am talking about is <CFHTTP>.  This tag allows you to emulate the
>>posting of a form, but also allows you to capture the results of the post.
>>There are a couple of forms written in CF that connect to the merchant
>>account, check a credit card, for example, and then wait for the
>>approval/denial response.
>>Is there anything in PHP that can do this same kind of thing?  Any help
>>would be appreciated.
>
>Check out Snoopy - http://snoopy.sourceforge.net/
>
>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>



--- End Message ---
--- Begin Message ---
Hey,
Is there any way one can get the name tags for a form?? other then
explicitly defining the tags in an array or any such thing. I just want to
be able to get the name tags and there values dynamically...
Regards,
Kunal Jhunjhunwala

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


* On 12-01-02 at 10:18 
* Kunal Jhunjhunwala said....

> Hey,
> Is there any way one can get the name tags for a form?? other then
> explicitly defining the tags in an array or any such thing. I just want to
> be able to get the name tags and there values dynamically...
> Regards,
> Kunal Jhunjhunwala
- -- 

Can you give an example of what you want, your message is a little hard
to visualize :)


Nick Wilson

Tel:    +45 3325 0688
Fax:    +45 3325 0677
Web:    www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8QAW1HpvrrTa6L5oRAiNnAJoCE97Luc/3gLREt+cSVge7SDRdOQCfU8bS
3QZ+uPRtiTp1ZPRwj2ovnrA=
=3PVM
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Hi,
Here is an example form field:

Forgot Password Subject: <INPUT TYPE="TEXT" NAME="fname" SIZE="10"
VALUE="kunal">

Now, I want my php script or get the field name, that is fname, and whatever
the user entered, in this case kunal. I can easiuly get kunal by echoing
$fname. But, how do i get what $fname is called :) I dunno how to explain. I
want the field to get the field name automatically.

Regards,
Kunal Jhunjhunwala
----- Original Message -----
From: "Nick Wilson" <[EMAIL PROTECTED]>
To: "php-list" <[EMAIL PROTECTED]>
Sent: Saturday, January 12, 2002 3:15 PM
Subject: Re: [PHP] name and value tags in a form


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> * On 12-01-02 at 10:18
> * Kunal Jhunjhunwala said....
>
> > Hey,
> > Is there any way one can get the name tags for a form?? other then
> > explicitly defining the tags in an array or any such thing. I just want
to
> > be able to get the name tags and there values dynamically...
> > Regards,
> > Kunal Jhunjhunwala
> - --
>
> Can you give an example of what you want, your message is a little hard
> to visualize :)
>
>
> Nick Wilson
>
> Tel: +45 3325 0688
> Fax: +45 3325 0677
> Web: www.explodingnet.com
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
>
> iD8DBQE8QAW1HpvrrTa6L5oRAiNnAJoCE97Luc/3gLREt+cSVge7SDRdOQCfU8bS
> 3QZ+uPRtiTp1ZPRwj2ovnrA=
> =3PVM
> -----END PGP SIGNATURE-----
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


* On 12-01-02 at 10:54 
* Kunal Jhunjhunwala said....

> Hi,
> Here is an example form field:
> 
> Forgot Password Subject: <INPUT TYPE="TEXT" NAME="fname" SIZE="10"
> VALUE="kunal">
> 
> Now, I want my php script or get the field name, that is fname, and whatever
> the user entered, in this case kunal. I can easiuly get kunal by echoing
> $fname. But, how do i get what $fname is called :) I dunno how to explain. I
> want the field to get the field name automatically.

You probably want to have a look at the $HTTP_POST_VARS (I think that's
it) array. See the manual under variables.

HTH
- -- 

Nick Wilson

Tel:    +45 3325 0688
Fax:    +45 3325 0677
Web:    www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8QAk1HpvrrTa6L5oRAqfdAJ95ZALl/nmXRfNMo+pJxEsfElTPZACfSCa6
1j+W0FkdxLMYpwdeCGKkH0w=
=CXzK
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Hey,
Did the trick. Thanks!
Regards,
Kunal Jhunjhunwala
----- Original Message -----
From: "Nick Wilson" <[EMAIL PROTECTED]>
To: "php-list" <[EMAIL PROTECTED]>
Sent: Saturday, January 12, 2002 3:30 PM
Subject: Re: [PHP] name and value tags in a form


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> * On 12-01-02 at 10:54
> * Kunal Jhunjhunwala said....
>
> > Hi,
> > Here is an example form field:
> >
> > Forgot Password Subject: <INPUT TYPE="TEXT" NAME="fname" SIZE="10"
> > VALUE="kunal">
> >
> > Now, I want my php script or get the field name, that is fname, and
whatever
> > the user entered, in this case kunal. I can easiuly get kunal by echoing
> > $fname. But, how do i get what $fname is called :) I dunno how to
explain. I
> > want the field to get the field name automatically.
>
> You probably want to have a look at the $HTTP_POST_VARS (I think that's
> it) array. See the manual under variables.
>
> HTH
> - --
>
> Nick Wilson
>
> Tel: +45 3325 0688
> Fax: +45 3325 0677
> Web: www.explodingnet.com
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
>
> iD8DBQE8QAk1HpvrrTa6L5oRAqfdAJ95ZALl/nmXRfNMo+pJxEsfElTPZACfSCa6
> 1j+W0FkdxLMYpwdeCGKkH0w=
> =CXzK
> -----END PGP SIGNATURE-----
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>

--- End Message ---
--- Begin Message ---
Hey all.  I was wondering.  Is it safe to use HTTP global variables ie 
$HTTP_POST_VARS etc in my scripts?
Thought I read somewhere that they weren't safe.
Got a lot of forms to work with, it sure would make life easier...

--- End Message ---
--- Begin Message ---
Ok I have looked everywhere to try to figure out why I get the stupid
warning:

Warning: Failed opening '/phpinc/query.inc' for inclusion
(include_path='.:/usr/local/lib/php') in /Users/murlyn/Sites/bakos/
index.htm on line 2

Ok I know that it's because it can't find the script, but my problem lies in
the Apache httpd.conf file.  I put in a ScriptAlias, I put in an Alias in
this fashion:

Alias /phpinc "/Users/murlyn/Sites/bakos/phpinc"

And same with ScriptAlias, neither of them works!

Any help would be appreciated! Thanks! :)  And again sorry for it being off
topic.. sort of.. I have searched for the last two days on why this wouldnt
work and I've tried everything I could think of.. so I am going to you guys
and gals since you are all a bunch of geniuses anyways :)

Rick

--- End Message ---
--- Begin Message ---
Includes are not relative to your DocumentRoot.  They are system paths.  A
ScriptAlias would have absolutely no effect.

-Rasmus

On Sat, 12 Jan 2002, Richard Baskett wrote:

> Ok I have looked everywhere to try to figure out why I get the stupid
> warning:
>
> Warning: Failed opening '/phpinc/query.inc' for inclusion
> (include_path='.:/usr/local/lib/php') in /Users/murlyn/Sites/bakos/
> index.htm on line 2
>
> Ok I know that it's because it can't find the script, but my problem lies in
> the Apache httpd.conf file.  I put in a ScriptAlias, I put in an Alias in
> this fashion:
>
> Alias /phpinc "/Users/murlyn/Sites/bakos/phpinc"
>
> And same with ScriptAlias, neither of them works!
>
> Any help would be appreciated! Thanks! :)  And again sorry for it being off
> topic.. sort of.. I have searched for the last two days on why this wouldnt
> work and I've tried everything I could think of.. so I am going to you guys
> and gals since you are all a bunch of geniuses anyways :)
>
> Rick
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>

--- End Message ---
--- Begin Message ---
i hav just upgraded from php3 to php4

i m getting this error through out my website what can be the problem... can
anyone help me out

Fatal error: Cannot instantiate non-existent class


--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


* On 12-01-02 at 11:10 
* millw0rm said....

> i hav just upgraded from php3 to php4
> 
> i m getting this error through out my website what can be the problem... can
> anyone help me out
> 
> Fatal error: Cannot instantiate non-existent class

Let's see the line in question?
- -- 

Nick Wilson

Tel:    +45 3325 0688
Fax:    +45 3325 0677
Web:    www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8QBKrHpvrrTa6L5oRAtd2AJ9y4GurINpqh6HLT6wj7rcACGxthgCaAnxw
rI2cVPX/pFJUmaviMzaZft4=
=TG8d
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
i hav just upgraded from php3 to php4

i m getting this error through out my website what can be the problem... can
anyone help me out

Fatal error: Cannot instantiate non-existent class




--- End Message ---
--- Begin Message ---
Hello there, 

I have about 30 markers in the text which need to be replaced with the value of a 
variable or an array. 

Common sense comes up with 
eregi_replace("!one!","blah",eregi_replace("!heh!",'foobar',eregi_replace("blah","ho-ho-ho",text)));
 

The list above could go on and on... I'm sure there are better ways to replace many 
markers or spans of text with something else. A loop? Something even more easier and 
better? 

Thanks,
Lauri
--
Tharapita Creations
[dynamic web applications]
[EMAIL PROTECTED]
Mobile: +372 53 410 610 


--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


* On 12-01-02 at 12:49 
* Lauri Vain said....

> Hello there, 
> 
> I have about 30 markers in the text which need to be replaced with the value of a 
>variable or an array. 
> 
> Common sense comes up with 
>eregi_replace("!one!","blah",eregi_replace("!heh!",'foobar',eregi_replace("blah","ho-ho-ho",text)));
> 
> 
> The list above could go on and on... I'm sure there are better ways to replace many 
>markers or spans of text with something else. A loop? Something even more easier and 
>better? 
> 
> Thanks,
> Lauri

If the 'markers' are in some kind of sequence (like marker1, marker2
etc) you could use a loop.
- -- 

Nick Wilson

Tel:    +45 3325 0688
Fax:    +45 3325 0677
Web:    www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8QCOJHpvrrTa6L5oRAu8zAJ0ae4AFomhUhUaK8MneNdm/BtnTNACfXhGh
9FydYCt1iS/rmBh83LyBWHs=
=CQIT
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Hi Nick, 

Yes, I thought about that. But, what should I do when the markers are absolutely NOT 
in any sequence. 

I also thought about something like
        $replace[1][1] = "!one!";       //marker
        $replace[1][2] = "hehee";       //replace with
        $replace[1][1] = "test";        //marker
        $replace[1][2] = "foobar";      //replace with
        $replace[1][1] = "repl";        //marker
        $replace[1][2] = "humpty-dumpty";       //replace with
        $replace[1][1] = "blah";        //marker
        $replace[1][2] = "boo";         //replace with

Now, when I would do a loop thingie that goes through all those, then it would be a 
pretty nice and compact solution... 

What about speed issues regarding this solution? 

Yours,
Lauri
--
Tharapita Creations
[dynamic web applications]
[EMAIL PROTECTED]
Mobile: +372 53 410 610 

-----Original Message-----
From: Nick Wilson [mailto:[EMAIL PROTECTED]] 
Sent: 12. jaanuar 2002. a. 13:53
To: [EMAIL PROTECTED]
Subject: Re: [PHP] multiple replaces...

If the 'markers' are in some kind of sequence (like marker1, marker2
etc) you could use a loop.


--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


* On 12-01-02 at 13:02 
* Lauri Vain said....

> Hi Nick, 
> 
> Yes, I thought about that. But, what should I do when the markers are absolutely NOT 
>in any sequence. 
> 
> I also thought about something like
>       $replace[1][1] = "!one!";       //marker
>       $replace[1][2] = "hehee";       //replace with
>       $replace[1][1] = "test";        //marker
>       $replace[1][2] = "foobar";      //replace with
>       $replace[1][1] = "repl";        //marker
>       $replace[1][2] = "humpty-dumpty";       //replace with
>       $replace[1][1] = "blah";        //marker
>       $replace[1][2] = "boo";         //replace with
> 
> Now, when I would do a loop thingie that goes through all those, then it would be a 
>pretty nice and compact solution... 
> 
> What about speed issues regarding this solution? 

I don't think speed will be an issue unless you have thousands of
markers, in which case you'll need to re-think the whole thing.

Can you not put all of your markers in an array like 

$markers=array("m1", "m2", "m_whatever");

and all your replacements likewise

$replace=array("r1", "r2", "r_whatever");

and then loop through like that?

If not, explain a little more about the context of the problem and let's
see if we can come up with an alternative.
- -- 

Nick Wilson

Tel:    +45 3325 0688
Fax:    +45 3325 0677
Web:    www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8QCk+HpvrrTa6L5oRAozIAJ4opVPFNwawBmQNIAHLZN/gdCt+lgCeLgmC
5hurUMezrXCg3cVtYgieGGE=
=xRPE
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Yes, I thought about that. But, what should I do when the markers are absolutely NOT 
in any sequence.

=sequence would matter if it was possible that one of the markers could replace some 
text and that replacement
subsequently became the marker for a further replacement ... nightmare=recursion!

I also thought about something like
$replace[1][1] = "!one!"; //marker
$replace[1][2] = "hehee"; //replace with
$replace[1][1] = "test"; //marker
$replace[1][2] = "foobar"; //replace with
$replace[1][1] = "repl"; //marker
$replace[1][2] = "humpty-dumpty"; //replace with
$replace[1][1] = "blah"; //marker
$replace[1][2] = "boo"; //replace with

Now, when I would do a loop thingie that goes through all those, then it would be a 
pretty nice and compact
solution...

What about speed issues regarding this solution?

=check out string functions. On simple stuff they will beat RegEx for speed hands down 
- but watch out if
case-sensitivity is relevant.

=dn


--- End Message ---
--- Begin Message ---

No need to loop. str_replace() already supports arrays!

check the manual.

bvr.


On Sat, 12 Jan 2002 12:57:10 -0000, DL Neil wrote:

>Yes, I thought about that. But, what should I do when the markers are absolutely NOT 
>in any sequence.
>
>=sequence would matter if it was possible that one of the markers could replace some 
>text and that replacement
>subsequently became the marker for a further replacement ... nightmare=recursion!
>
>I also thought about something like
>$replace[1][1] = "!one!"; //marker
>$replace[1][2] = "hehee"; //replace with
>$replace[1][1] = "test"; //marker
>$replace[1][2] = "foobar"; //replace with
>$replace[1][1] = "repl"; //marker
>$replace[1][2] = "humpty-dumpty"; //replace with
>$replace[1][1] = "blah"; //marker
>$replace[1][2] = "boo"; //replace with
>
>Now, when I would do a loop thingie that goes through all those, then it would be a 
>pretty nice and compact
>solution...
>
>What about speed issues regarding this solution?
>
>=check out string functions. On simple stuff they will beat RegEx for speed hands 
>down - but watch out if
>case-sensitivity is relevant.
>
>=dn
>
>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>



--- End Message ---
--- Begin Message ---
If you only want to replace strings, then drop the regular expression functions! (a 
common mistake)

Use for example str_replace, or in this case, strtr which is better because it accepts 
an array as replacement pattern.

For example: 
  $foo = array("foo" => "apple", "bar" => "banana");
  $string = "I like foos and bars";
  $string = strtr($string, $foo);
  echo $string;

output:
  I like apples and bananas

// Victor

----- Original Message ----- 
From: "'Nick Wilson'" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, January 12, 2002 1:17 PM
Subject: Re: [PHP] multiple replaces...


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> * On 12-01-02 at 13:02
> * Lauri Vain said....
> 
> > Hi Nick,
> >
> > Yes, I thought about that. But, what should I do when the markers are absolutely 
>NOT in any sequence.
> >
> > I also thought about something like
> > $replace[1][1] = "!one!"; //marker
> > $replace[1][2] = "hehee"; //replace with
> > $replace[1][1] = "test"; //marker
> > $replace[1][2] = "foobar"; //replace with
> > $replace[1][1] = "repl"; //marker
> > $replace[1][2] = "humpty-dumpty"; //replace with
> > $replace[1][1] = "blah"; //marker
> > $replace[1][2] = "boo"; //replace with
> >
> > Now, when I would do a loop thingie that goes through all those, then it would be 
>a pretty nice and compact solution...
> >
> > What about speed issues regarding this solution?
> 
> I don't think speed will be an issue unless you have thousands of
> markers, in which case you'll need to re-think the whole thing.
> 
> Can you not put all of your markers in an array like
> 
> $markers=array("m1", "m2", "m_whatever");
> 
> and all your replacements likewise
> 
> $replace=array("r1", "r2", "r_whatever");
> 
> and then loop through like that?
> 
> If not, explain a little more about the context of the problem and let's
> see if we can come up with an alternative.
> - --
> 
> Nick Wilson
> 
> Tel: +45 3325 0688
> Fax: +45 3325 0677
> Web: www.explodingnet.com
> 
> 
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
> 
> iD8DBQE8QCk+HpvrrTa6L5oRAozIAJ4opVPFNwawBmQNIAHLZN/gdCt+lgCeLgmC
> 5hurUMezrXCg3cVtYgieGGE=
> =xRPE
> -----END PGP SIGNATURE-----
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
--- End Message ---
--- Begin Message ---
Whoops, forgot to change the first number in every one of those. The first numbers in 
the brackets should increase after every two lines... 

The correct one: 
        $replace[1][1] = "!one!";       //marker
        $replace[1][2] = "hehee";       //replace with
        $replace[2][1] = "test";        //marker
        $replace[2][2] = "foobar";      //replace with
        $replace[3][1] = "repl";        //marker
        $replace[3][2] = "humpty-dumpty";       //replace with
        $replace[4][1] = "blah";        //marker
        $replace[4][2] = "boo";         //replace with

Now, when I would do a loop thingie that goes through all those, then it would be a 
pretty nice and compact solution... 

What about speed issues regarding this solution? 

Yours,
Lauri
--
Tharapita Creations
[dynamic web applications]
[EMAIL PROTECTED]
Mobile: +372 53 410 610

--- End Message ---
--- Begin Message ---

And so does preg_replace() if you need any regular expressions.

Though str_replace() is probably faster when this is not the case.

http://www.php.net/manual/en/function.str-replace.php
http://www.php.net/manual/en/function.preg-replace.php

bvr.





--- End Message ---
--- Begin Message ---
Hi,

Can anybody recommend a good development environment? It should support PHP,
HTML and JavaScripts.
Another question...Is it normal procedure to mix the above 3 languages on a
single page or is it possible to only use 1...i.e PHP?

Regards,
Morten


--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


* On 12-01-02 at 17:00 
* Morten Nielsen said....

> Hi,
> 
> Can anybody recommend a good development environment? It should support PHP,
> HTML and JavaScripts.

What do you mean by 'development enviornment'?

> Another question...Is it normal procedure to mix the above 3 languages on a
> single page or is it possible to only use 1...i.e PHP?

Well, how would you propose you displayed your pages without HTML/XHTML?
It is normal, but not advisable to mix the three. You might enjoy this
page http://www.explodingnet.com/articles/latest/7/ 

HTH

Nick Wilson

Tel:    +45 3325 0688
Fax:    +45 3325 0677
Web:    www.explodingnet.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8QF74HpvrrTa6L5oRAo7AAJ4wMMUiPYN5tt8fY1BCecIHP2b9bwCgsqWY
BTWVYMl4hvdtYugHZoaCjjQ=
=SW2m
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
I’m trying to display the tables in my database using $tables =
mysql(‘mydb”, “SHOW TABLES FROM mydbname”) but this statement doesn’t
seem to behave like selecting records from a table. Does this query
return an array of table names? If I use something like  $records =
mysql(‘mydb”, “SELECT * FROM sometable) everything works fine. There
must be something I’m missing about the SHOW query.

Thanks
Chris Williams

--- End Message ---
--- Begin Message ---
Well, did you try looping  though tables with mysql_fetch_array($tables)?

But, how 'bout mysql_list_tables()?

Cheers - Miles Thompson

PS There's a bunch of other interesting stuff relating to database 
manipulation there too. /mt

At 11:48 AM 1/12/2002 -0800, Chris wrote:
>I'm trying to display the tables in my database using $tables =
>mysql('mydb", "SHOW TABLES FROM mydbname") but this statement doesn't
>seem to behave like selecting records from a table. Does this query
>return an array of table names? If I use something like  $records =
>mysql('mydb", "SELECT * FROM sometable) everything works fine. There
>must be something I'm missing about the SHOW query.
>
>Thanks
>Chris Williams
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
i have a sql server and i connected with my database but the query no
execute on server.
my code is it

$conexion = @mssql_connect("servername","username","userpass"); // this work

 if($conexion){
   $db = mssql_select_db("Estudiante",$conexion);
   $qr = mssql_query("select * from tasignatura",$conexion); // this not
work the query no execute on the server

//  here i wanna print the first field of the rows result of the query
   while($fila = mssql_fetch_row($qr)){
      echo $fila[0]
   }


--- End Message ---
--- Begin Message ---
I need a file php.ini and some advices about configuration of a web server
as internet information server to use php. Also i need to know how use the
sqlserver 2000 on my php's pages.
i use Dreamweaver UltraDev 4 too and i think that i must configurate it.

thanks vania.


--- End Message ---
--- Begin Message ---
Go to http://www.interakt.ro/products/PHAkt/index.php for a kick butt PHP
development platform extension for DW Ulreadev!

Deron
Creation Nation


"Vania Lavielle Castro" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I need a file php.ini and some advices about configuration of a web server
> as internet information server to use php. Also i need to know how use the
> sqlserver 2000 on my php's pages.
> i use Dreamweaver UltraDev 4 too and i think that i must configurate it.
>
> thanks vania.
>
>


--- End Message ---
--- Begin Message ---
DUH!!!! Why didn't I see that..
Thanks..
Chris

Miles Thompson wrote:

> Well, did you try looping  though tables with mysql_fetch_array($tables)?
>
> But, how 'bout mysql_list_tables()?
>
> Cheers - Miles Thompson
>
> PS There's a bunch of other interesting stuff relating to database
> manipulation there too. /mt
>
> At 11:48 AM 1/12/2002 -0800, Chris wrote:
> >I'm trying to display the tables in my database using $tables =
> >mysql('mydb", "SHOW TABLES FROM mydbname") but this statement doesn't
> >seem to behave like selecting records from a table. Does this query
> >return an array of table names? If I use something like  $records =
> >mysql('mydb", "SELECT * FROM sometable) everything works fine. There
> >must be something I'm missing about the SHOW query.
> >
> >Thanks
> >Chris Williams
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]

--- End Message ---

Reply via email to