php-general Digest 11 Dec 2004 22:49:42 -0000 Issue 3164

Topics (messages 204042 through 204073):

Re: Data Access Object (DAO) with PHP
        204042 by: Shen Kong
        204043 by: Shen Kong
        204047 by: Greg Beaver

Clickable image maps
        204044 by: Kurt Blom

Re: [Kill Thread] Question:maybe  urldecode
        204045 by: Stuart Felenstein

Question: Repopulating form parameters
        204046 by: Stuart Felenstein
        204048 by: Stuart Felenstein
        204051 by: Jason Wong

Re: allow_url_fopen ini directive not enough
        204049 by: KJ

Re: PHP vs JSP?
        204050 by: Raditha Dissanayake
        204056 by: Travis Conway
        204057 by: John Nichel
        204059 by: Raditha Dissanayake

Re: alternating table entry colors
        204052 by: Graham Cossey
        204055 by: Sebastian

Re: Spurious newlines when requesting empty php file
        204053 by: Carl Michael Skog
        204060 by: Michael Sims

Re: Friendly URL
        204054 by: Bruno B B Magalhães

I need to pass vars to external cgi script ?
        204058 by: Dave Carrera
        204061 by: John Holmes
        204062 by: Dave Carrera
        204067 by: M. Sokolewicz

assignment
        204063 by: Song Ken Vern
        204064 by: Sebastian
        204065 by: Jason Wong
        204066 by: Ryan King
        204069 by: Chris

Classes and Functions
        204068 by: R. Van Tassel
        204070 by: Robby Russell

MySQL Connection problem
        204071 by: Mike Francis

Sorry forgot to include the code for my last message - Mike Francis
        204072 by: Mike Francis

Joining same table twice
        204073 by: Sebastian

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, mybe you mean PDO:
http://pecl.php.net/package/PDO
http://www.zend.com/expert_qa/qas.php?id=93&single=1
http://www.zend.com/expert_qa/qas.php?id=98&single=1
Adwin Wijaya åé:
Shen Kong wrote:
 > Hi, do you mean ADODB? PEAR::DB? or DBX ?

--> more advance than that i think. It is a class that will be created to access database as object like the one in Java.




--
-- ShenKong (shenkong(at)php.net)
-- http://www.openphp.cn

--- End Message ---
--- Begin Message ---
Hi, mybe you mean PDO:
http://pecl.php.net/package/PDO
http://www.zend.com/expert_qa/qas.php?id=93&single=1
http://www.zend.com/expert_qa/qas.php?id=98&single=1
Adwin Wijaya åé:
Shen Kong wrote:
 > Hi, do you mean ADODB? PEAR::DB? or DBX ?

--> more advance than that i think. It is a class that will be created to access database as object like the one in Java.




--
-- ShenKong (shenkong(at)php.net)
-- http://www.openphp.cn

--- End Message ---
--- Begin Message --- Adwin Wijaya wrote:
Hi,

Is there any mature DAO class for PHP (free) ?

http://pear.php.net/DB_DataObject

Greg
--- End Message ---
--- Begin Message ---
Hi all,

Can PHP handle with CIM's (Clickable Image Maps) to get data from a html page (instead of using checkboxes...)?
I searched the online doc for it but no matches.


Thanks in advance!

Kurt.
--- End Message ---
--- Begin Message ---
--- Stuart Felenstein <[EMAIL PROTECTED]> wrote:

I am ending this thread. 

Stuart

--- End Message ---
--- Begin Message ---
I'm hoping that this question will be more succinct.
I am trying to repopulate a search form with a user's
chosen paramters.  I am running into a problem with
"multiple select lists"

First , this is the element when the form is first
presented to the user:

<select name="Ind[]" size="8" multiple="multiple"
id="Ind[]" >
<?php while($row = mysql_fetch_array($inds,
YSQL_BOTH)) { echo '<option
value="'.$row['CareerIDs'].'">'.$row['CareerCategories'].'</option>';
}
?>

So the element's option are taken from a table. 

Now I am grabbing the array and can print out the
chosen values correctly, either using an implode:

if (count($Ind) > 0 AND is_array($Ind)) {
    $Ind = "'".implode("','", $Ind)."'";
}

or a "for" loop:

if (isset($Ind)) {
$j = count($Ind);
for($i=0; $i<$j; $i++)
print_r($Ind[$i]);
}

What I can't do is getting the options that were
chosen to be highlighted in the select list.  
i.e if there are 5 options for user to choose from:
1-Banking 2-Arts 3-I.T. 4-Accounting 5-Retail

And user chooses 1-Banking and 5-Retail, when I
reapply the query string I want those 2 to be
highlighed in the options list.  
It is working fine for textfield.  

?Ind%5B%5D=1&Ind%5B%5D=2&JTitle=&City=Bronx&Days=&Recs=15&Submit=Submit

If I apply the above query string, Bronx will be
populated in the City<textfield>
Not so, with the Ind[] array.

Anyone know what I am talking about ?

Stuart

--- End Message ---
--- Begin Message ---
--- [EMAIL PROTECTED] wrote:

> you (just) need to mark the previously chosen items
> as "selected" in 
> the repopulated list. the "highlighting" part is a
> basic html/form 
> issue. i.e., if you have questions on this you
> should look at how, on 
> a simple (html-only) form, an item on a list is
> marked (highlighted) 
> as the default. obviously you have set up your code
> so that you know 
> what's been selected previously and then put out the
> necessary html 
> when you repopulate.
> 
This makes sense, however I'm still spacing out trying
to figure out then where I place the "option value
selected" in this html / php code:

<select name="Ind[]" size="8" multiple="multiple"
id="Ind[]" >
<?php while($row = mysql_fetch_array($inds,
MYSQL_BOTH)) { echo '<option
value="'.$row['CareerIDs'].'">'.$row['CareerCategories'].'</option>
'; ?>

I'm pretty sure I need to loop through the $_Get of
the array.   Not sure , and haven't found anything
that shows this.

Stuart

--- End Message ---
--- Begin Message ---
On Saturday 11 December 2004 20:46, Stuart Felenstein wrote:
> --- [EMAIL PROTECTED] wrote:
> > you (just) need to mark the previously chosen items
> > as "selected" in
> > the repopulated list. the "highlighting" part is a
> > basic html/form
> > issue. i.e., if you have questions on this you
> > should look at how, on
> > a simple (html-only) form, an item on a list is
> > marked (highlighted)
> > as the default. obviously you have set up your code
> > so that you know
> > what's been selected previously and then put out the
> > necessary html
> > when you repopulate.
>
> This makes sense, however I'm still spacing out trying
> to figure out then where I place the "option value
> selected" in this html / php code:

Inside the while loop.

Tip: (para-phrasing the above comments) in a WYSIWYG HTML editor create a form 
with a multiple select list box, make one or two of the items selected by 
default, examine the HTML source.

> <select name="Ind[]" size="8" multiple="multiple"
> id="Ind[]" >
> <?php while($row = mysql_fetch_array($inds,
> MYSQL_BOTH)) { echo '<option
> value="'.$row['CareerIDs'].'">'.$row['CareerCategories'].'</option>
> '; ?>
>
> I'm pretty sure I need to loop through the $_Get of
> the array.   Not sure , and haven't found anything
> that shows this.

Yes, you need to reference $_GET to see whether an option was selected and 
change the echo above accordingly.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
<rcw> those apparently-bacteria-like multicolor worms coming out of
      microsoft's backorifice
<rcw> that's the backoffice logo
*/

--- End Message ---
--- Begin Message --- Greg Donald wrote:
On Fri, 10 Dec 2004 22:00:43 +0000, KJ <[EMAIL PROTECTED]> wrote:



5. Joe Hacker has studied the script coz he's a tart that wants to piss
people off and he has found a vunerability.
6. Joe Hacker uses the vunerability to change your account passwd. He
then logs in as you and deletes all your files. He has access to your
mysql password which was in the congif file of phpMyFantasticGuestbook


Why would you allow your MySQL user to connect from anywhere besides
your web server?  Remote MySQL connections are a big no-no.

No remote connection, quote: "Joe Hacker uses the vunerability to change your account passwd. He then logs in as you and deletes all your files". He's logged onto your box, local connection.



and he deletes all your data, he then leaves a nice index.php in your
account to say that he's been by.


Sorry to hear that, I'd recommend you stop using
phpMyFantasticGuestbook immediately.  And anything else you don't feel
paranoid about to audit.

phpMyFantasticGuestbook doesn't actually exist, it was a scenario to try to explain the issue.



Thanks.

--- End Message ---
--- Begin Message ---
Peter Lauri wrote:

Best groupmember,

Why should I choose PHP instead of JSP/Servlets when it comes to develop a
high-traffic site. Assume that the infrastructure for both are set up. It
only comes to efficiency (both coding and running)? What are your
experience?


As a sun certified java programmer, let me assure you that PHP is easier to work with.

--
- Best Of Times
/Peter Lauri





--
Raditha Dissanayake.
------------------------------------------------------------------
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/ | Drag and Drop Upload

--- End Message ---
--- Begin Message ---
Did he really ask that question on a PHP board?

That is like walking into a Coke factory, going to the manager and asking "pepsi or coke?"

----- Original Message ----- From: "Raditha Dissanayake" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, December 11, 2004 7:11 AM
Subject: Re: [PHP] PHP vs JSP?



Peter Lauri wrote:

Best groupmember,

Why should I choose PHP instead of JSP/Servlets when it comes to develop a
high-traffic site. Assume that the infrastructure for both are set up. It
only comes to efficiency (both coding and running)? What are your
experience?

As a sun certified java programmer, let me assure you that PHP is easier to work with.

--
- Best Of Times
/Peter Lauri




--
Raditha Dissanayake.
------------------------------------------------------------------
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/ | Drag and Drop Upload
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message --- Travis Conway wrote:
Did he really ask that question on a PHP board?

That is like walking into a Coke factory, going to the manager and asking "pepsi or coke?"

Good a place as any to ask. Sure, the opinions one receives here may be a bit biased towards php, but most of the users on this list subscribe to the, "use what best suits your needs" philosophy. Not to mention that quite a few of us also have experience with JSP (as well as other technologies), so comparisons can be made.


--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com

--- End Message ---
--- Begin Message ---
Travis Conway wrote:

Did he really ask that question on a PHP board?

I have met factory managers (though not at the comanies you mention ) who have admitted that their competitors may have the edge :-)
But seriously whether PHP is better or JSP is better is a religious question. However on the point of ease of use PHP is a clear winner. There are other areas in which J2EE wins but let's not go into it here.



--
Raditha Dissanayake.
------------------------------------------------------------------
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/ | Drag and Drop Upload

--- End Message ---
--- Begin Message ---
On Fri, 10 Dec 2004 18:19:35 -0600, Brad Ciszewski <[EMAIL PROTECTED]> wrote:
> i need some assistance making my table (rows) change color for every other
> data. here is what i have so far, but i get a "unexpected T_STRING error".
> this error's line is: if($thisRow mode 2 == 0){
> 
> +=+=+  SCRIPT BELOW  +=+=+
> 
> $thisRow = 0;
> 
> $query = mysql_query("SELECT * FROM security_images ORDER BY ID DESC");
> while($gt=mysql_fetch_array($query)){
> if($thisRow mode 2 == 0){
> $backgroundColor = "#CCCCCC";
> }else{
> $backgroundColor = "#FFFFFF";
> }
> 
> extract($gt);
> echo ?>
>  <tr bgcolor="<?PHP echo($backgroundColor); ?>">
>    <td><?PHP echo($ID); ?></td>
>    <td><?PHP echo($ipAddr); ?></td>
>    <td><?PHP echo($area); ?></td>
>    <td><?PHP echo($insertdate); ?></td>
>    <td><?PHP echo($referenceid); ?></td>
>    <td><?PHP echo($hiddentext); ?></td>
>  </tr>
>  <?PHP
>  $thisRow++
>  } ?>
> 
> +=+=+  SCRIPT ABOVE  +=+=+
> 
> thanx in advance!
> 
 How about :

<?php
$rowNum = 0;
$bg = array("#CCCCCC", "#FFFFFF");
run query
while ( query_results)
{
?>
<tr bgcolor="<?=$bg[$rowNum]?>">
  <td>...
<?php
$rowNum = ($rowNum==0)?1:0;
}
?>

I normally use a CSS stylesheet with entries called tableRow0 and
tableRow1 and then have the <TR> as:

<TR CLASS="tableRow<?=$rowNum?>">

HTH

Graham

--- End Message ---
--- Begin Message ---
my simple way..

while(....)
{
   $i += 1;
   $alt = ($i % 2) ? 'alt1' : 'alt2';
}

then just use $alt in your <td> class..

----- Original Message ----- 
From: "Graham Cossey" <[EMAIL PROTECTED]>
To: "Brad Ciszewski" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, December 11, 2004 8:33 AM
Subject: Re: [PHP] alternating table entry colors


> On Fri, 10 Dec 2004 18:19:35 -0600, Brad Ciszewski <[EMAIL PROTECTED]>
wrote:
> > i need some assistance making my table (rows) change color for every
other
> > data. here is what i have so far, but i get a "unexpected T_STRING
error".
> > this error's line is: if($thisRow mode 2 == 0){
> >
> > +=+=+  SCRIPT BELOW  +=+=+
> >
> > $thisRow = 0;
> >
> > $query = mysql_query("SELECT * FROM security_images ORDER BY ID DESC");
> > while($gt=mysql_fetch_array($query)){
> > if($thisRow mode 2 == 0){
> > $backgroundColor = "#CCCCCC";
> > }else{
> > $backgroundColor = "#FFFFFF";
> > }
> >
> > extract($gt);
> > echo ?>
> >  <tr bgcolor="<?PHP echo($backgroundColor); ?>">
> >    <td><?PHP echo($ID); ?></td>
> >    <td><?PHP echo($ipAddr); ?></td>
> >    <td><?PHP echo($area); ?></td>
> >    <td><?PHP echo($insertdate); ?></td>
> >    <td><?PHP echo($referenceid); ?></td>
> >    <td><?PHP echo($hiddentext); ?></td>
> >  </tr>
> >  <?PHP
> >  $thisRow++
> >  } ?>
> >
> > +=+=+  SCRIPT ABOVE  +=+=+
> >
> > thanx in advance!
> >
>  How about :
>
> <?php
> $rowNum = 0;
> $bg = array("#CCCCCC", "#FFFFFF");
> run query
> while ( query_results)
> {
> ?>
> <tr bgcolor="<?=$bg[$rowNum]?>">
>   <td>...
> <?php
> $rowNum = ($rowNum==0)?1:0;
> }
> ?>
>
> I normally use a CSS stylesheet with entries called tableRow0 and
> tableRow1 and then have the <TR> as:
>
> <TR CLASS="tableRow<?=$rowNum?>">
>
> HTH
>
> Graham
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

--- End Message ---
--- Begin Message ---
Thanks for the answer !

The URL of the file is http://www.formatemp.com/catalog/paynova-reply.php
and the file is definitely empty.
It was created by the touch(UNIX command):
-rw-r--r--   42 foo   foo          0 Dec 10 18:49 paynova-reply.php

The server is configured as follows:
Apache/1.3.33 (Unix) mod_perl/1.29 mod_auth_passthrough/1.8
mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.9 mod_ssl/2.8.21 OpenSSL/0.9.6b
It is a server configured by my ISP, eXaion.com.

If I save the response of this command with lynx (lynx -dump
"http://www.formatemp.com/catalog/paynova-reply.php"; > somefile),
I will get three newlines.

If I request this file in a browser and scrutinize the response packet in a
packet analyser, I see something fishy.

After the usual header fields part are closed with the usual double "\r\n"
sequence, a "new" header is added, consisting of the character "0".
This is the then closed with the double "\r\n" sequence.
In other words, the extra hex characters 30, 0D, 0A, 0D, 0A are included in
the data part of the package.


Obviously, this is part of the data part of the package, and possibly
becomes the three newlines I am observing.

What does this "extra" header value come from ?


Regards,
Carl Michael Skog


-----Original Message-----
From: Richard Lynch ceo-at-l-i-e.com |PHP General user list|
[mailto:...] 
Sent: den 10 december 2004 22:40
To: .........................
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Spurious newlines when requesting empty php file

Carl Michael Skog wrote:
> Some strange results with spurious newlines inserted in the response 
> when requesting a php file has led me to investigating what happens 
> when a completely empty php-file is requested.
>
> I would have thought that the response from a empty php file would 
> also be empty, but, to my surprise, they consist of 3 newlines !!!
>
> The strange thing is that I observed this behaviour on two completely 
> unrelated servers.
>
> Is this what can be expected or is it a result of misconfiguration ?

I just tried this with an empty PHP file, and got exactly what I expected.

A valid response with no content at all.

Please specify your software versions, and provide URLs and, as silly as
this sounds, an "ls -als empty.php" so we can see your empty PHP file.

Also check php.ini for auto_prepend_file and auto_append_file settings,
which might be tacking on blanks.

And, if you are using this as an "empty" file:
--------------- not quite empty file ----------------- <?php ?>
------------------------------------------------------
then PHP is quite right to send out the newline at the end.


----------------- really empty file ----------------- <?php
?>-----------------------------------------------------

Note that some editors, under some configurations, will *ADD* a newline to a
file on the last line for historical reasons.

Re-configure your editor *now* if yours does that, our include files and
calls to http://php.net/header will drive you crazy, or you'll end up
mis-using output buffering to "solve" your non-problem.

--
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
Carl Michael Skog wrote:
> If I save the response of this command with lynx (lynx -dump
> "http://www.formatemp.com/catalog/paynova-reply.php"; > somefile),
> I will get three newlines.

Aha! I knew it. :)  See:

http://marc.theaimsgroup.com/?l=php-general&m=110272197009025&w=2

Lynx adds the newlines.  Better to use Links instead for this sort of thing.

> If I request this file in a browser and scrutinize the response
> packet in a packet analyser, I see something fishy.
>
> After the usual header fields part are closed with the usual double
> "\r\n" sequence, a "new" header is added, consisting of the character
> "0".
> This is the then closed with the double "\r\n" sequence.

Yes, I've noticed that too, using Ethereal to capture packets.  Try this
with a php file that produces output.  If you capture the packet you'll see
that the output is preceded by a hexidecimal number and followed by "0".
The first hex number is the number of characters in the output.  This does
not happen with plain HTML files, at least not on my test machine.

> Obviously, this is part of the data part of the package, and possibly
> becomes the three newlines I am observing.

No...that's Lynx's fault.

> What does this "extra" header value come from ?

Aha, just found it:

http://www.apps.ietf.org/rfc/rfc2616.html#sec-3.6.1

--- End Message ---
--- Begin Message ---
Richard,

well a much simpler solution than my old one:

$this->uri = explode('/',basename($_SERVER['SCRIPT_NAME']).$_SERVER['PATH_INFO']);

Many thanks for your help,
Bruno B B Magalhaes

On Dec 10, 2004, at 11:57 PM, Richard Lynch wrote:
$_SERVER['PHP_SELF'] or $_SERVER['SCRIPT_FILENAME'] or ...

It's all in there, though you might have to tear it apart a bit to get
exactly what you want.


Bruno B B Magalhães wrote:
Hi Richard,

well but I want also the file it self to be included in it...

Regards,
Bruno B B Magalhaes

But I need
On Dec 10, 2004, at 8:20 PM, Richard Lynch wrote:

Bruno B B Magalhães wrote:
Hi guys,

As part of my framework I have a URI decoder so it explode, remove
unnecessary data (as GET query) amd put it into an array...

Is there any better way of doing this (faster?), just wondering.

                if(isset($_SERVER['REQUEST_URI']) === true)
                {
                        $path = explode('/',$_SERVER['SCRIPT_NAME']);

                        $total_paths = count($path);

                        $path = 
stristr($_SERVER['REQUEST_URI'],$path[$total_paths-1]);

                        $path = explode('/',$path);

                        $total_paths = count($path);

                        $i = 0;

                        for($i=0;$i<$total_paths;$i++)
                        {
                                $get_string = false;

                                $get_string = stristr($path[$i],'?');

if($get_string)
{
$get_string = "\\".$get_string;
$this->uri[$i] >>
strtolower(addslashes(strip_tags(eregi_replace($get_string,'',$path[ $i
])
)));
}
else
{
$this->uri[$i] = strtolower(addslashes(strip_tags($path[$i])));
}
}
}

I could be wrong, but I think you've just re-written the code that is already in PHP to give you $_SERVER['PATH_INFO']

<?php echo $_SERVER['PATH_INFO']?>

--
Like Music?
http://l-i-e.com/artists.htm

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

I need to send some vars to a cgi script.

The script url is like this

http://www.example.com/cgi-bin/script.cgi?var1=my_first_php_var;var2=my_seco
nd_php_var and so on.

How do I send / call this script from inside my php script ?

Any help I appreciated

Thank you in advance

Dave C



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.809 / Virus Database: 551 - Release Date: 09/12/2004
 

--- End Message ---
--- Begin Message ---
> From: "Dave Carrera" <[EMAIL PROTECTED]>

> I need to send some vars to a cgi script.
> 
> The script url is like this
> 
> http://www.example.com/cgi-bin/script.cgi?var1=my_first_php_var;var2=my_seco
> nd_php_var and so on.
> 
> How do I send / call this script from inside my php script ?

$file = 
fopen('http://www.example.com/cgi-bin/script.cgi?var1=my_first_php_var&var2=my_second_php_var&var3=...');

or 

$file = fopen("http....script.cgi?var1=$phpvar1&var2=$phpvar2...");

although you'd want to urlencode() the PHP variables if you need something like 
the second method. 

---John Holmes...

UCCASS - PHP Survey System
http://www.bigredspark.com/survey.html

--- End Message ---
--- Begin Message ---
Thanks John,

I get "fopen expects second param" when I call it.

What would this be ? "r" "w" "x" or something else ?

Thanks for the help

Dave Carrera


-----Original Message-----
From: John Holmes [mailto:[EMAIL PROTECTED] 
Sent: 11 December 2004 15:26
To: Dave Carrera; [EMAIL PROTECTED]
Subject: Re: [PHP] I need to pass vars to external cgi script ?


> From: "Dave Carrera" <[EMAIL PROTECTED]>

> I need to send some vars to a cgi script.
> 
> The script url is like this
> 
> http://www.example.com/cgi-bin/script.cgi?var1=my_first_php_var;var2=m
> y_seco
> nd_php_var and so on.
> 
> How do I send / call this script from inside my php script ?

$file =
fopen('http://www.example.com/cgi-bin/script.cgi?var1=my_first_php_var&var2=
my_second_php_var&var3=...');

or 

$file = fopen("http....script.cgi?var1=$phpvar1&var2=$phpvar2...");

although you'd want to urlencode() the PHP variables if you need something
like the second method. 

---John Holmes...

UCCASS - PHP Survey System http://www.bigredspark.com/survey.html



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.809 / Virus Database: 551 - Release Date: 09/12/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.809 / Virus Database: 551 - Release Date: 09/12/2004
 

--- End Message ---
--- Begin Message ---
how about r? :) (or x)
Dave Carrera wrote:
Thanks John,

I get "fopen expects second param" when I call it.

What would this be ? "r" "w" "x" or something else ?

Thanks for the help

Dave Carrera


-----Original Message-----
From: John Holmes [mailto:[EMAIL PROTECTED] Sent: 11 December 2004 15:26
To: Dave Carrera; [EMAIL PROTECTED]
Subject: Re: [PHP] I need to pass vars to external cgi script ?




From: "Dave Carrera" <[EMAIL PROTECTED]>


I need to send some vars to a cgi script.

The script url is like this

http://www.example.com/cgi-bin/script.cgi?var1=my_first_php_var;var2=m
y_seco
nd_php_var and so on.

How do I send / call this script from inside my php script ?


$file =
fopen('http://www.example.com/cgi-bin/script.cgi?var1=my_first_php_var&var2=
my_second_php_var&var3=...');

or

$file = fopen("http....script.cgi?var1=$phpvar1&var2=$phpvar2...");

although you'd want to urlencode() the PHP variables if you need something
like the second method.


---John Holmes...

UCCASS - PHP Survey System http://www.bigredspark.com/survey.html



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.809 / Virus Database: 551 - Release Date: 09/12/2004


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.809 / Virus Database: 551 - Release Date: 09/12/2004

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

Tried searching for what this $$ operator means. 
But can't get the right results by using $$ as search string in php manual.

$temp = $$temp2; 

Is this an array assignment? 

Thanx. 
Ken

--- End Message ---
--- Begin Message ---
variables variable?
http://us2.php.net/manual/en/language.variables.variable.php

----- Original Message ----- 
From: "Song Ken Vern" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 09, 2004 11:02 PM
Subject: [PHP] assignment


> Hi,
>
> Tried searching for what this $$ operator means.
> But can't get the right results by using $$ as search string in php
manual.
>
> $temp = $$temp2;
>
> Is this an array assignment?
>
> Thanx.
> Ken
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

--- End Message ---
--- Begin Message ---
On Friday 10 December 2004 12:02, Song Ken Vern wrote:

> Tried searching for what this $$ operator means.
> But can't get the right results by using $$ as search string in php manual.
>
> $temp = $$temp2;

Search for "variable variables"

> Is this an array assignment?

No, but in most cases where you "think" you need variable variables using 
arrays instead would be a better choice.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Stay away from hurricanes for a while.
*/

--- End Message ---
--- Begin Message ---
On Dec 9, 2004, at 10:02 PM, Song Ken Vern wrote:

Hi,

Tried searching for what this $$ operator means.
But can't get the right results by using $$ as search string in php manual.


$temp = $$temp2;

Is this an array assignment?

No, its a variable varible:

http://us2.php.net/manual/en/language.variables.variable.php

-ryan
--
http://theryanking.com/blog

--- End Message ---
--- Begin Message ---
That's a variable variable name.

http://us2.php.net/manual/en/language.variables.variable.php

So

$temp3 = 'valueoftemp3';
$temp2 = 'temp3';
$temp = $$temp2;
$$temp2 === $temp3;


Song Ken Vern wrote:

Hi,

Tried searching for what this $$ operator means. But can't get the right results by using $$ as search string in php manual.

$temp = $$temp2;

Is this an array assignment?

Thanx. Ken




--- End Message ---
--- Begin Message ---
Can someone give me a distinction between the two and when to use / not use
them?

 

I want to thank everyone who replied about my"For" loop question. All the
answers were VERY helpful! Thanks very much.

 

~ R. Van Tassel


--- End Message ---
--- Begin Message ---
On Sat, 2004-12-11 at 13:03 -0500, R. Van Tassel wrote:
> Can someone give me a distinction between the two and when to use / not use
> them?
> 
>  
> 
> I want to thank everyone who replied about my"For" loop question. All the
> answers were VERY helpful! Thanks very much.

You might want to pick up a book on programming to read up on this. 

In a nutshell, a function should do something specific. It's good to use
functions when you do the same thing in different places in your code so
that you don't need to copy/paste your code over and over.

function foo()
{
    $x = 1;
    $y = 2;
    return $x + $y;
}

$bar = foo();

print $bar;
-----
OUTPUT:
3

A class/object is a collection of functions and variables that are
contained within their own scope. (vague description)

class foobar
{
  var $x = 10;

  var $y = NULL;

  function foobar($y)
  {
     $this->y = $y;
  }

  function add()
  {
    return $this->x + $this->y;
  }

  function subtract()
  {
    return $this->x - $this->y;
  }

}

$object =& new foobar(4);

print $object->add() . "\n";
print $object->subtract() . "\n";

# set y to a new number
$object->y = 2;

print $object->add() . "\n";
print $object->subtract() . "\n";

--------
OUTPUT:
> 14
> 6
> 12
> 8

As it sounds like you're still new to this, I would pick up a book or
read some material online that will better show you when to use either
and play around with them both. 

Have fun

-Robby

-- 
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
*    --- Now supporting PHP5 ---
****************************************/

--- End Message ---
--- Begin Message ---
Hi,
I have Apache 2, PHP 5 and MySQL 4.1 installed on an XP pro box.

I have created a new database 'ijdb' with a single table 'joke' and have 
entered data into two of the three fields in the table.

I can access the database / tables / data from a command prompt.

However, when I try to connect through WAMP I either receive a 'Unable to 
connect to the
database server at this time.' error message - which is my default error 
message, or, I receive a blank window in IE / Mozilla / Opera etc and no error 
messages.

I have tried removing the @ from the file and this has no effect - interesting?!
The error logs do not reveal anything that indicates a missing table / field.

I wonder if anyone has any ideas ?

Cheers,
Mike

--- End Message ---
--- Begin Message ---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title>Our List of Jokes</title>
<meta http-equiv="content-type"
content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
// Connect to the database server
$dbcnx = @mysql_connect('localhost', 'root', 'MyPassword');
if (!$dbcnx) {
echo '<p>Unable to connect to the ' .
'database server at this time.</p>' );
exit();
}
// Select the jokes database
if ([EMAIL PROTECTED]('ijdb')) {
exit('<p>Unable to locate the joke ' .
'database at this time.</p>');
}
?>
<p>Here are all the jokes in our database:</p>
<blockquote>
<?php
// Request the text of all the jokes
$result = @mysql_query('SELECT joketext FROM joke');
if (!$result) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
// Display the text of each joke in a paragraph
while ($row = mysql_fetch_array($result)) {
echo '<p>' . $row['joketext'] . '</p>';
}
?>
</blockquote>
</body>
</html>

--- End Message ---
--- Begin Message ---
i apologize if its against the rules to post mysql questions here, though im
using php to query the db
so...

i have a table with three integers.

[table post]
postuserid | replyuserid | parentid
----------------------------------

i do a left join on table user to get the username that postuserid belongs
to, but i also need to get the username on the same table 'user' of
replyuserid as well if parentid isn't null. can this be done with a single
query?

this is what i have:

mysql_query("
SELECT post.postuserid, post.replyuserid, post.parentid, user.username AS
uname FROM post
LEFT JOIN user ON(user.userid = post.postuserid) ORDER BY id");

that gets me the username of postuserid, but what about replyuserid, how i
get that username?

thanks for any help.

--- End Message ---

Reply via email to