php-general Digest 20 May 2002 03:20:44 -0000 Issue 1355

Topics (messages 98364 through 98410):

Re: Non cachable php for use as an <img src>
        98364 by: Hugh Bothwell

regex: string begins with NEITER http NOR cid NOR mailto
        98365 by: kras
        98366 by: Ray Hunter
        98367 by: kras

copy after upload pblm (?path?)
        98368 by: arnaud gonzales
        98370 by: Miguel Cruz

Re: Trouble with recocnizing jpeg files. Some work, some do not
        98369 by: Miguel Cruz
        98378 by: andy

ob_gzhandler encoding ???
        98371 by: Jason Caldwell
        98372 by: Miguel Cruz
        98381 by: Jason Caldwell

finding postion of any chat occur first
        98373 by: Prachait Saxena
        98408 by: Hugh Bothwell

finding postion of any one char occur first
        98374 by: Prachait Saxena

PHP parsing XML from Shoutcast
        98375 by: Johan Ekström

I feel so stupid asking this question....LOL
        98376 by: vins
        98379 by: Richard Baskett
        98380 by: Jason Wong

Shoutcast
        98377 by: Johan Ekström
        98406 by: Hugh Bothwell

Sessions and Arrays
        98382 by: Navid Y.
        98385 by: Jason Wong
        98387 by: Navid Y.

job payment.
        98383 by: Jule
        98403 by: Hugh Bothwell
        98409 by: Jule

Can someone check this mysql code
        98384 by: PhilipNZ Staff
        98386 by: Kevin Waterson

Why would this command just Die!
        98388 by: PhilipNZ Staff
        98390 by: Julie Meloni
        98391 by: Jason Morehouse
        98394 by: David Freeman

MSIE & GZIP problem?
        98389 by: Jason Caldwell

Arrays and Forms
        98392 by: Navid Y.
        98397 by: Jason Morehouse

PHP Skinning Problem
        98393 by: Darren Edwards
        98399 by: Justin French

while loop question - problem (new set of eyes needed)
        98395 by: Lee P Reilly
        98396 by: Lee P Reilly
        98398 by: Julie Meloni
        98400 by: Martin Towell
        98401 by: David Freeman

fopen thru proxy problem
        98402 by: Peter

Why not working
        98404 by: dean
        98410 by: David Robley

mysql_fetch_array  errors
        98405 by: Justin Latham
        98407 by: Richard Archer

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 ---

"Henry" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello All,
>
> I want to return a gif from a php script. I want it to not be cachable
> "anywhere" not browsers, proxys etc. Actualy what I want to do is pass an
> existing .gif file as the output and do some database manipulation whilst
I
> do so.

Add a randomized cache-killer parameter, ie

<img src='counter.php?site=1&k={insert random number here}' />

Your script can ignore it, but the cache is
unable to guarantee it doesn't mean something
important, so it will force a reload.


--- End Message ---
--- Begin Message ---
Hello!

I have got a big problem:

I have html content in $html variable, which contains href, src and
background tags. Those tags may contain relative adressess and absolute
addressess which begin with http(s): or cid: (mail inline attachements) and
mailto:

I have also variable $basewwwservername, which contains servername of
current server. I have to insert this $basewwwservername into all href,src
and background tags which are relative and NOT into absolute.
In other words I must preg_replace with some pattern that match for example
(src)=(\"|)..and not following WORDS: http|cid|mailto and correct rest of
string.

Does anybody relief my pain?;-)
I've lost at least 3 days (almost 3x24hrs;-)

Regards
Konrad

------
e-mail: [EMAIL PROTECTED]



--- End Message ---
--- Begin Message ---
Show some code...

Thanks,

Ray "BigDog" Hunter



-----Original Message-----
From: kras [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, May 19, 2002 9:53 AM
To: [EMAIL PROTECTED]
Subject: [PHP] regex: string begins with NEITER http NOR cid NOR mailto


Hello!

I have got a big problem:

I have html content in $html variable, which contains href, src and
background tags. Those tags may contain relative adressess and absolute
addressess which begin with http(s): or cid: (mail inline attachements)
and
mailto:

I have also variable $basewwwservername, which contains servername of
current server. I have to insert this $basewwwservername into all
href,src and background tags which are relative and NOT into absolute.
In other words I must preg_replace with some pattern that match for
example (src)=(\"|)..and not following WORDS: http|cid|mailto and
correct rest of string.

Does anybody relief my pain?;-)
I've lost at least 3 days (almost 3x24hrs;-)

Regards
Konrad

------
e-mail: [EMAIL PROTECTED]




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

--- End Message ---
--- Begin Message ---
There you are
      $html = preg_replace ("'href=(\"|)(?<!mailto)([.]*?[^\"]*?)(\"|
>)'si", "href=\"".$bejsnejm."\\2\"", $html);
      $html = preg_replace
("'(src|background|href)=(\"|)(?!http)([.]*?[^\"]*?)(\"| >)'si",
"\\1=\"".$bejsnejm."/\\3\"", $html);

of course it fails.

kras

> Show some code...
>
> Thanks,
>
> Ray "BigDog" Hunter
>
>
>
> -----Original Message-----
> From: kras [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, May 19, 2002 9:53 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] regex: string begins with NEITER http NOR cid NOR mailto
>
>
> Hello!
>
> I have got a big problem:
>
> I have html content in $html variable, which contains href, src and
> background tags. Those tags may contain relative adressess and absolute
> addressess which begin with http(s): or cid: (mail inline attachements)
> and
> mailto:
>
> I have also variable $basewwwservername, which contains servername of
> current server. I have to insert this $basewwwservername into all
> href,src and background tags which are relative and NOT into absolute.
> In other words I must preg_replace with some pattern that match for
> example (src)=(\"|)..and not following WORDS: http|cid|mailto and
> correct rest of string.
>
> Does anybody relief my pain?;-)
> I've lost at least 3 days (almost 3x24hrs;-)
>
> Regards
> Konrad
>
> ------
> e-mail: [EMAIL PROTECTED]
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Hi all,
I' m trying to copy an uploaded file:

        if(!empty($fichier)) {
                $nom = $HTTP_POST_FILES["fichier"]["name"];
                $type = $HTTP_POST_FILES["fichier"]["type"];
                $taille = $HTTP_POST_FILES["fichier"]["size"];
                $nom_tmp = $HTTP_POST_FILES["fichier"]["tmp_name"];
                echo "nom : $nom <br> type : $type <br> taille : $taille <p> nom
temporaire : $nom_tmp</p>;
                if(!strpos($nom, .gif") === FALSE || !(strpos($nom, ".jpg") === 
FALSE)){
--->            $res = copy($fichier,$nom);
                        if ($res != 0) {
                        $msg = "<p> File save </p>";
                        }else{
                $msg = "<p> saving Error </p>";
                        }
                }else{
      $msg = "<p> wrong type </p>";
    }
?>

and i get the error "Warning: open_basedir restriction in effect. File is in
wrong directory in d:\tsunami\zeg\9\exo4upload.php on line 5"
so is there any wrong path for  $res = copy($fichier,$nom);
should i use an absolute path?

TIA

--- End Message ---
--- Begin Message ---
1) You probably need to move the file from the temporary directory to 
somewhere in your own personal directory hierarchy.

2) http://php.net/move_uploaded_file

miguel

On Sun, 19 May 2002, arnaud gonzales wrote:
> Hi all,
> I' m trying to copy an uploaded file:
> 
>       if(!empty($fichier)) {
>               $nom = $HTTP_POST_FILES["fichier"]["name"];
>               $type = $HTTP_POST_FILES["fichier"]["type"];
>               $taille = $HTTP_POST_FILES["fichier"]["size"];
>               $nom_tmp = $HTTP_POST_FILES["fichier"]["tmp_name"];
>               echo "nom : $nom <br> type : $type <br> taille : $taille <p> nom
> temporaire : $nom_tmp</p>;
>               if(!strpos($nom, .gif") === FALSE || !(strpos($nom, ".jpg") === 
>FALSE)){
> --->          $res = copy($fichier,$nom);
>                       if ($res != 0) {
>                       $msg = "<p> File save </p>";
>                       }else{
>               $msg = "<p> saving Error </p>";
>                       }
>               }else{
>       $msg = "<p> wrong type </p>";
>     }
> ?>
> 
> and i get the error "Warning: open_basedir restriction in effect. File is in
> wrong directory in d:\tsunami\zeg\9\exo4upload.php on line 5"
> so is there any wrong path for  $res = copy($fichier,$nom);
> should i use an absolute path?
> 
> TIA
> 
> 
> 

--- End Message ---
--- Begin Message ---
On Sun, 19 May 2002, andy wrote:
> I do have trouble with finding out if a file is a jpeg or not.  This is the
> command I am using:
> 
>  $_FILES[picture_location][type]
> 
> works fine exept in one case: With Photoshop 6.0 I do open the jpeg (which
> workes fine) an save as jpeg as another file name. Then upload the new file.
> This returns a type called:
> 
> application/octet-stream
> 
> So what is this type anyway. I do know jpeg and jpg and pjpeg but
> octed-stream?!

application/octet-stream just means a generic binary file.

I don't think that $_FILES[]['type'] is really all that useful for getting
reliable information about a file, since it just trusts the browser/user,
which could be uninformed, misinformed, or deliberately dishonest. Either
pass the temp file to the unix 'file' command or peek inside it on your
own (check the 'magic' file that comes with the unix 'file' command for
details on what to look for).

miguel

--- End Message ---
--- Begin Message ---
I thought this is a secure way to find out if the file is a jpeg or not. So
you are suggesting to passit to the unix command file? How does that work.
Maybe you can make a small example or give a small hint on what to look for
on google. Sound interesting!

I tryed to to perform a createfromjpeg command to that file and it did not
work. So the magic is to save it in photoshop for web and then as jpeg and
not with save as (jpeg). But this gives me a headache, because how do user
know the difference? The file extension is jpeg and all programms can
display it. Maybe there is a way in php as well to do a kind of
createfromjpeg commmand?!

Thanx, Andy

"Miguel Cruz" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Sun, 19 May 2002, andy wrote:
> > I do have trouble with finding out if a file is a jpeg or not.  This is
the
> > command I am using:
> >
> >  $_FILES[picture_location][type]
> >
> > works fine exept in one case: With Photoshop 6.0 I do open the jpeg
(which
> > workes fine) an save as jpeg as another file name. Then upload the new
file.
> > This returns a type called:
> >
> > application/octet-stream
> >
> > So what is this type anyway. I do know jpeg and jpg and pjpeg but
> > octed-stream?!
>
> application/octet-stream just means a generic binary file.
>
> I don't think that $_FILES[]['type'] is really all that useful for getting
> reliable information about a file, since it just trusts the browser/user,
> which could be uninformed, misinformed, or deliberately dishonest. Either
> pass the temp file to the unix 'file' command or peek inside it on your
> own (check the 'magic' file that comes with the unix 'file' command for
> details on what to look for).
>
> miguel
>


--- End Message ---
--- Begin Message ---
Does anyone know how I can test (and see) if my ob_gzhandler() is working?

I've written the following script, and run it from the command line to "see"
the output -- hoping it's encoded -- it isn't -- so I want to make sure I'm
doing it right.

<?
    header("Accept-Encoding: gzip, deflate");
    ob_start("ob_gzhandler");
?>

some HTML code ....

<?
    ob_end_flush();
    ob_end_clean();
?>


I save then run the file:

C:>php test.php

Thanks


--- End Message ---
--- Begin Message ---
I doubt that'll work, as I don't think the gzhandler code will send
gzipped data without a successful negotiation with the client (which can't
happen at the command line). As others have suggested, the easiest way is
probably to use lynx's --mime_header option.

miguel

On Sun, 19 May 2002, Jason Caldwell wrote:
> Does anyone know how I can test (and see) if my ob_gzhandler() is working?
> 
> I've written the following script, and run it from the command line to "see"
> the output -- hoping it's encoded -- it isn't -- so I want to make sure I'm
> doing it right.
> 
> <?
>     header("Accept-Encoding: gzip, deflate");
>     ob_start("ob_gzhandler");
> ?>
> 
> some HTML code ....
> 
> <?
>     ob_end_flush();
>     ob_end_clean();
> ?>
> 
> 
> I save then run the file:
> 
> C:>php test.php
> 
> Thanks
> 
> 
> 
> 

--- End Message ---
--- Begin Message ---
Will browsers that receive gzip encoded pages, transmit gzip encoded POST or
GET data back?

Jason


"Jason Caldwell" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Does anyone know how I can test (and see) if my ob_gzhandler() is working?
>
> I've written the following script, and run it from the command line to
"see"
> the output -- hoping it's encoded -- it isn't -- so I want to make sure
I'm
> doing it right.
>
> <?
>     header("Accept-Encoding: gzip, deflate");
>     ob_start("ob_gzhandler");
> ?>
>
> some HTML code ....
>
> <?
>     ob_end_flush();
>     ob_end_clean();
> ?>
>
>
> I save then run the file:
>
> C:>php test.php
>
> Thanks
>
>


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

I have a string like $str="Hello World > <<";
and i want to find the first occurance of any one of the char in " " or "<"

$sp=strpos($str,">")
Did not work, beacuse in this I can give only one char....

Can i give filter in this as "[ >]"
If yes then how?

Or any other idea to get this ...
--
Bye, and  Have a nice day.

Prachait Saxena

If you do for other's !
Other's will do for you !!

Visit me at http://www.sitesontesting.com/prachait






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

"Prachait Saxena" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a string like $str="Hello World > <<";
> and i want to find the first occurance of any one of the char in " " or
"<"
>
> $sp=strpos($str,">")
> Did not work, beacuse in this I can give only one char....


function strpos_multi($str, $chars) {
    $firstpos = $badvalue = $strlen($str);

    $numchars = strlen($chars);
    for ($i = 0; $i < $numchars; $i++) {
        $ch = substr($chars, $i, 1);
        $pos = strpos($str, $ch);

        if ($pos !== false)      // NOTE: op is bang-equals-equals
            $firstpos = min($pos, $firstpos);
    }

    if ($firstpos == $badvalue)
        return -1;
    else
        return $firstpos;
}


$charpos = strpos_multi($str, " <");


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

I have a string like $str="Hello World > <<";
and i want to find the first occurance of any one of the char in " " or "<"

$sp=strpos($str,">")
Did not work, beacuse in this I can give only one char....

Can i give filter in this as "[ >]"
If yes then how?

Or any other idea to get this ...
--
Bye, and  Have a nice day.

Prachait Saxena

If you do for other's !
Other's will do for you !!

Visit me at http://www.sitesontesting.com/prachait








--- End Message ---
--- Begin Message ---
Anyone that has knowledge about this program, regarding it's XML output and
php fetching that info and placing it on a php-page for user's to view?




--- End Message ---
--- Begin Message ---
How do i alternate the row color again.
You get so used to dreamweaver doing everything for you and now when
dreamweaver doesn't want to work back to notepage.
But to remember how to alternate row colors.......

I'm lost.

PLZ PLZ PLZ PLZ

LOL
:)


--- End Message ---
--- Begin Message ---
Well within a loop you can do something like this:

<tr bgcolor="<?=($i%2 == 0) ? '#FFFFC0' : '#FFF00O';?>">

Just make sure that $i is being incremented each time through the loop and
there you go! :)

Rick

Be kind. Everyone you meet is fighting a hard battle - John Watson

> From: "vins" <[EMAIL PROTECTED]>
> Organization: Personal
> Reply-To: "vins" <[EMAIL PROTECTED]>
> Date: Sun, 19 May 2002 21:08:28 +0200
> To: [EMAIL PROTECTED]
> Subject: [PHP] I feel so stupid asking this question....LOL
> 
> How do i alternate the row color again.
> You get so used to dreamweaver doing everything for you and now when
> dreamweaver doesn't want to work back to notepage.
> But to remember how to alternate row colors.......
> 
> I'm lost.
> 
> PLZ PLZ PLZ PLZ
> 
> LOL
> :)
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
On Monday 20 May 2002 03:08, vins wrote:
> How do i alternate the row color again.
> You get so used to dreamweaver doing everything for you and now when
> dreamweaver doesn't want to work back to notepage.
> But to remember how to alternate row colors.......

Search the archives, this was discussed *extensively* during the past week or 
two.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
I have a theory that it's impossible to prove anything, but I can't prove it.
*/

--- End Message ---
--- Begin Message ---
Anyone that has knowledge about this program, regarding it's XML output and
php fetching that info and placing it on a php-page for user's to view?


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

"Johan EkströM" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Anyone that has knowledge about this program, regarding it's XML output
and
> php fetching that info and placing it on a php-page for user's to view?

Take a look at some of the scripts from
http://www.casterclub.com/downloads.php

you should be able to figure out what you need.


--- End Message ---
--- Begin Message ---
Hello Everyone,

How do I send a single array, with many values, through sessions?
For example, I might have the following:

<?php
session_start();
session_register("product");

$product['category'] = "appetizer";
$product['name'] = "Miso Soup";
$product['desc'] = "Some Description";
$product['price'] = "4.95";
?>

By registering just the "product" array, will I have all of the values
of that array available to me throughout the entire session? Or will I
have to register each array variable-value pair separately, like so:

session_register("product['category']", "product['name']",
"product['description']", "product['price']", );

Any help and suggestions on sending arrays through sessions will be
greatful, thanks!  :)

--- End Message ---
--- Begin Message ---
On Monday 20 May 2002 04:31, Navid Y. wrote:
> Hello Everyone,
>
> How do I send a single array, with many values, through sessions?
> For example, I might have the following:

[snip]

Why? don't you just try it? Surely it's quicker to write some simple test code 
than to ask on the list?

> By registering just the "product" array, will I have all of the values
> of that array available to me throughout the entire session?

Yes

> Or will I
> have to register each array variable-value pair separately, like so:

No

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
"Maybe we can get together and show off to each other sometimes."
*/

--- End Message ---
--- Begin Message ---
Jason,

I did try it before asking, else I wouldn't have any reason to ask. It
didn't work for me, but I thought that maybe I was missing something. So
your answer is yes, it is possible? I guess I'll have to keep testing my
application. Thanks for your time, I really appreciate it.

Navid

-----Original Message-----
From: Jason Wong [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, May 19, 2002 4:17 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Sessions and Arrays


On Monday 20 May 2002 04:31, Navid Y. wrote:
> Hello Everyone,
>
> How do I send a single array, with many values, through sessions? For 
> example, I might have the following:

[snip]

Why? don't you just try it? Surely it's quicker to write some simple
test code 
than to ask on the list?

> By registering just the "product" array, will I have all of the values

> of that array available to me throughout the entire session?

Yes

> Or will I
> have to register each array variable-value pair separately, like so:

No

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
"Maybe we can get together and show off to each other sometimes." */


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

--- End Message ---
--- Begin Message ---
Hey guys,
I got an offer to do some php/mysql design for a local company,
basically what it's going to be is to take the current Access DB and make it
acessible through a webpage (that's the basic info they gave me).
How much should i except to get paid for this, and what is an acceptable
amount, for the completion of this project, or per hour?

Jule
--

|\/\__________________________/\/|
|   Jule Slootbeek               |
|   [EMAIL PROTECTED]        |
|   http://blindtheory.cjb.net   |
|   __________________________   |
|/\/                          \/\|

-------------------------------------------------------

-- 
|\/\__________________________/\/|
|   Jule Slootbeek               |
|   [EMAIL PROTECTED]        |
|   http://blindtheory.cjb.net   |
|   __________________________   |
|/\/                          \/\|
--- End Message ---
--- Begin Message ---

"Jule" <[EMAIL PROTECTED]> wrote in message
02051916383210.28871@localhost">news:02051916383210.28871@localhost...
> I got an offer to do some php/mysql design
> for a local company, basically what it's going
> to be is to take the current Access DB and
> make it acessible through a webpage (that's
> the basic info they gave me).
> How much should i except to get paid for this,
> and what is an acceptable amount, for the
> completion of this project, or per hour?

Depends drastically on how complex the
database is, and on what their idea of
making it 'accessible' is.

Are you porting the database to mySQL, or
mirroring it?  How many tables/records/pages?
How much 'design' do you do, and how much
is just fill-in-the-blanks?  Is this 'view-edit-
delete record' accessibility, or 'view-edit-
authorize-track changes-sign off on a form
filled from a six-table-join query', or what?
Is it in-house only, or for authorized clients
too, or for the public?


--- End Message ---
--- Begin Message ---
Hey everybody,

thanks a lot for all the info i got, i know it's kindof a stragne question, 
but i really had no idea to expect what to earn or to be offered in a 
situation like the one i'm in now.
Now i know what to compare with and how to deal with everything and i think 
i'm set on job-instructions for the rest of my life.

thanks a lot
i really appreciate it.

Jule

On Sunday 19 May 2002 20:46, Doug Riddle wrote:
> --- Jule <[EMAIL PROTECTED]> wrote:
> > Hey guys,
> > I got an offer to do some php/mysql design for a local company,
> > basically what it's going to be is to take the current Access DB and make
> > it acessible through a webpage (that's the basic info they gave me). How
> > much should i except to get paid for this, and what is an acceptable
> > amount, for the completion of this project, or per hour?
> >
> > Jule
> > --
>
> Jule:
>
>      I cannot guess what the going rate in New England is for DB
> programming. A few years ago I was getting $20.00 US for work like it.  I
> have made a lot more too, it sort of depends on what the market will bear. 
> I suspect they are not sure themselves.  I can offer a few things to think
> about...
>
> Things to consider:
> 1) Task Creep/Function creep/add-in bloat/design creep/ etc.
>      Get it clear up front what it is they expect and what constitutes a
> completed project.  If there is not a clear design and task list, then even
> they are not sure what they want.  They want someone to figure that out for
> them, and are probably not fully aware of the effort involved, or the cost.
>  In that case I would ask for hourly wages.  That way, changes to the
> project in mid-stream do not require negotiations about cost and pay.
>
> 2) Deliverables.  Make sure you get a schedule of when they want what.  You
> will need time to figure out the DB, and work with them on the front-end
> the client will see, not to mention the nuts and bolts of the job.  Break
> the project into bite-sized pieces and get their buy-in on each stage.  Get
> the guidlines in writing and a firm definition of what they consider a
> completed project in the contract.
>
> 3) Coordination.  If at all possible, get one, or at the most two, people
> to act as coordinators.  These should be people able to approve designs,
> make decisions and preferably write checks.  Avoid designing by committee
> wherever possible.
>
> 4) Contract.  Get it in writing.  Unless they are offering you a position
> with their company, they will expect a contract.  It doesn't have to be a
> complicated  formal affair.  Just discuss the job, write down their
> expectations and convert that into a "for the completion of this project as
> outlined herein, the company of I've-got-your-wallet agrees to pay my
> company, and-all-your-money, X dollars per hour for the building of this
> web site.  The company agrees to provide ample opportunity to discuss the
> deliverables as outlined and tender approval in a timely basis, etc." 
> That's it, save your receipts and keep good notes.  That will allow you to
> be sure you own any code you write, not them.  They are buying the use of
> the code, not the code.  Make sure you work that in somewhere.
>
> After that, just enjoy yourself.
>
> =====
> Warmest Regards,
> Doug Riddle
> http://www.dougriddle.com
>
> ## If they do discover life on other planets, who will get to them first,
> The Democrats, the Republicans, Avon, or the Latter Day Saints?  ##
>
>
> __________________________________________________
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com

-- 
|\/\__________________________/\/|
|   Jule Slootbeek               |
|   [EMAIL PROTECTED]        |
|   http://blindtheory.cjb.net   |
|   __________________________   |
|/\/                          \/\|
--- End Message ---
--- Begin Message ---
My code below don't want to insert the code into the database what am I doing wrong?

<?php

 $answers="$band, $middlename, $pot";
 $date=date ("l dS of F Y h:i:s A");
 
 $sql = "INSERT INTO `prizeline` (`id`, `email`, `name`, `address`, `answers`, `date`) 
VALUES ('', 'email', 'name', 'address', 'answers', 'date');";
    
$result = mysql_query($sql);

?>
--- End Message ---
--- Begin Message ---
On Mon, 20 May 2002 08:57:16 +1200
"PhilipNZ Staff" <[EMAIL PROTECTED]> wrote:

> My code below don't want to insert the code into the database what am I doing wrong?
> 
> <?php
> 
>  $answers="$band, $middlename, $pot";
>  $date=date ("l dS of F Y h:i:s A");
>  
>  $sql = "INSERT INTO `prizeline` (`id`, `email`, `name`, `address`, `answers`, 
>`date`) VALUES ('', 'email', 'name', 'address', 'answers', 'date');";
>     
> $result = mysql_query($sql);
> 
> ?>
> 
 $sql = "INSERT INTO prizeline (id, email, name, address, answers, date) VALUES ('', 
'$email', '$name', '$address', '$answers', '$date')";

echo $sql;

$result=mysql_query($sql) or die (mysql_error());

Kevin
--- End Message ---
--- Begin Message ---
This command just dies!

I have checked sql connection  ... ok
the insert into line ... ok

Pfft it just don't wanna work


<?php  

 $answers="$band, $middlename, $pot";
 $date=date ("l dS of F Y h:i:s A");
 
  $sql = "INSERT INTO prizeline (id, email, name, address, answers, date) VALUES ('', 
'$email', '$name', '$address', '$answers', '$date')";

  echo $sql;

  mysql_query($sql) or die ("There has been an error");


?>


## Out put on page ##

INSERT INTO prizeline (id, email, name, address, answers, date) VALUES ('', 
'[EMAIL PROTECTED]', 'newman', '12 Newman ave Auckland', 'In Season, James, 
John', 'Monday 20th of May 2002 10:22:05 AM')There has been an error
--- End Message ---
--- Begin Message ---
PD> <?php
PD>  $answers="$band, $middlename, $pot";
PD>  $date=date ("l dS of F Y h:i:s A");
PD>   $sql = "INSERT INTO prizeline (id, email, name, address, answers, date) VALUES 
('', '$email', '$name', '$address', '$answers', '$date')";
PD>   echo $sql;
PD>   mysql_query($sql) or die ("There has been an error");
PD> ?>

If this is all of your script, then you are missing those pesky
"connect to server" and "select database" functions.

If you replace your die message with die(mysql_error()) you will
probably see a very helpful error message such as "no database
selected" or "hey buddy, not connected".


- Julie

--> Julie Meloni
--> [EMAIL PROTECTED]
--> www.thickbook.com

Find "Sams Teach Yourself MySQL in 24 Hours" at
http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20

--- End Message ---
--- Begin Message ---
To see the actual error try: "or die (mysql_error())".


On Mon, 20 May 2002 10:27:20 +1200, Php Developers wrote:

> This command just dies!
> 
> I have checked sql connection  ... ok the insert into line ... ok
> 
> Pfft it just don't wanna work
> 
> 
> <?php
> 
>  $answers="$band, $middlename, $pot";
>  $date=date ("l dS of F Y h:i:s A");
>  
>   $sql = "INSERT INTO prizeline (id, email, name, address, answers,
>   date) VALUES ('', '$email', '$name', '$address', '$answers',
>   '$date')";
> 
>   echo $sql;
> 
>   mysql_query($sql) or die ("There has been an error");
> 
> 
> ?>
> 
> 
> ## Out put on page ##
> 
> INSERT INTO prizeline (id, email, name, address, answers, date) VALUES
> ('', '[EMAIL PROTECTED]', 'newman', '12 Newman ave Auckland',
> 'In Season, James, John', 'Monday 20th of May 2002 10:22:05 AM')There
> has been an error
 

-- 
 Jason Morehouse ([EMAIL PROTECTED])
 Netconcepts LTD - Auckland, New Zealand
 Linux: because rebooting is for adding hardware
--- End Message ---
--- Begin Message ---


 > INSERT INTO prizeline (id, email, name, address, answers, 
 > date) VALUES ('', '[EMAIL PROTECTED]', 'newman', 
 > '12 Newman ave Auckland', 'In Season, James, John', 'Monday 
 > 20th of May 2002 10:22:05 AM')There has been an error

If you want 'id' to be assigned by the database (I'm assuming you have
an auto_increment on that field) then don't put it in your insert at
all.  The database will figure it out.  As it is you're trying to assing
the id to '' (or nothing) which may well be why you're getting the
error.

(and this relates to php in what way?  Perhaps an sql mailing list would
have been a more appropriate place...)

CYA, Dave


--- End Message ---
--- Begin Message ---
I have several browsers installed; NS4.x, NS6.02, Opera 6.x, and MSIE 6.0 --
I'm using gzip compression on my site through the ob_gzhandler.  My pages
seem to load fine, however, ONLY in MSIE when I REFRESH (i.e.. with the
Refresh Button) the page seems to lose it's table or table format, and
everything looks all jacked up. This ONLY happens on a page reload.  The
other browsers don't seem to have this problem --

I went to MS's Windows Update, and installed several updates, mostly
Security updates -- there were no updates that spoke of a gzip / reload
problem -- nonetheless, I applied all I could.  After rebooting (again) -- I
went back to my site with MSIE 6 -- hit reload and now the problem has gone
away.

Has anyone heard of the problem with MSIE 6?  If this is a known problem;
I'll have to perform some browser check to make sure I can gzip to that MSIE
version 6 build (whatever) -- kind of a hassle.

I just did a search on Technet, and could find no mention of it.

Thanks.
Jason



--- End Message ---
--- Begin Message ---
Hello Everyone,

I'm having trouble sending array values through forms.
Will the following syntax create a variable called $product['desc'] on
the next page?
If not, what am I doing wrong here?

Note: I tried this but it didn't work! When I tried doing it without
using an array, but rather with a regular variable, it sent through just
fine and created a variable of the name attribute in the input tag.


menu_add.php
-------------
<form method="post" action="menu_list.php">
<input type="text" name="product[desc]">
</form>


menu_list.php
-------------
echo $product['desc'];


Result output
-------------
no output

--- End Message ---
--- Begin Message ---
Try:

<input type="text" name="product[]">

<?
foreach ($product as $p) {
        print $p;
}
?>

On Mon, 20 May 2002 11:05:07 +1200, Navid Y. wrote:

> Hello Everyone,
> 
> I'm having trouble sending array values through forms. Will the
> following syntax create a variable called $product['desc'] on the next
> page?
> If not, what am I doing wrong here?
> 
> Note: I tried this but it didn't work! When I tried doing it without
> using an array, but rather with a regular variable, it sent through just
> fine and created a variable of the name attribute in the input tag.
> 
> 
> menu_add.php
> -------------
> <form method="post" action="menu_list.php"> <input type="text"
> name="product[desc]"> </form>
> 
> 
> menu_list.php
> -------------
> echo $product['desc'];
> 
> 
> Result output
> -------------
> no output
 

-- 
 Jason Morehouse ([EMAIL PROTECTED])
 Netconcepts LTD - Auckland, New Zealand
 Linux: because rebooting is for adding hardware
--- End Message ---
--- Begin Message ---
Can some one please tell me why this PHP command brings back an Undefined
variable: QUERY_STRING on line 1.  The script is below, by the way it is PHP
on windows not unix.

<?php SetCookie("skin", "$QUERY_STRING", time()+3600); ?>


Also can some one please tell me why this is bringing back a problem on a
windows server.

<?php
if($skin=="black") { $skin="#000000"; $text="#FFFFFF"; };
if($skin=="white") { $skin="#FFFFFF"; $text="#000000"; };
?>



--- End Message ---
--- Begin Message ---
Not sure about the query string thing... what version are you running?

If you have register_globals Off in your php.ini (as discussed MANY times on
this list), $skin won't be set... it'll be $_SESSION['skin'].

Simple changes:

<?php

// use session var, or if not found, use defauly
if(isset($_SESSION['skin']))
    { $skin = $_SESSION['skin']; }
else
    { $skin = "black"; }

// set colours
if($skin=="black")
    { $skin="#000000"; $text="#FFFFFF"; };
elseif($skin=="white")
    { $skin="#FFFFFF"; $text="#000000"; };

?>


Justin French
Indent.com.au



on 20/05/02 9:08 AM, Darren Edwards ([EMAIL PROTECTED]) wrote:

> Can some one please tell me why this PHP command brings back an Undefined
> variable: QUERY_STRING on line 1.  The script is below, by the way it is PHP
> on windows not unix.
> 
> <?php SetCookie("skin", "$QUERY_STRING", time()+3600); ?>
> 
> 
> Also can some one please tell me why this is bringing back a problem on a
> windows server.
> 
> <?php
> if($skin=="black") { $skin="#000000"; $text="#FFFFFF"; };
> if($skin=="white") { $skin="#FFFFFF"; $text="#000000"; };
> ?>
> 
> 
> 

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

I wonder if someone could have a quick look at this for me? It's a
simple while loop, but it's not acting the way (I think) it should. If I
break down the while loop, it reads:

--------------------------------------------
  // $result contains 3 rows
  while($row = mysql_fetch_array($result))
  {
    echo " xxx ";
  }
--------------------------------------------
     => xxx xxx xxx is displayed (as expected)

If I add the following code to the loop, it only seems to iterate
through it *once*:

--------------------------------------------
  while($row = mysql_fetch_array($result))
  {
    $pri = $row['pri'];
    $fg = $row['fg'];
    $molw = $row['molw'];
    $density = $row['density'];
    $denstype = $row['denstype'];
    $pctd = $row['pctd'];
    $maxpctd = $row['maxpctd'];
    $compid = $row['compid'];

    $sql = "select * from compounds where compid = \"$compid\"";
    $result = mysql_query($sql,$conn);
    $row = mysql_fetch_array($result);

    $compname = $row['compname'];
    $concentration = $row['concentration'];
    $concunit = $row['concunit'];
    $type = $row['type'];
    $composition = $row['composition'];

    if ($fg=="Y")
       $html .= "<b>$concentration $concunit $compname</b><br>";
    else if ($pri=="Y")
       $html .= "<font color=\"#000066\"> $concentration $concunit
$compname</font><br>";
    else
       $html .= " $concentration $concunit $compname<br>";
  }
--------------------------------------------

Expected results:
--------------------------------------------
   Actin #2543: Description here.

   1 mol AEBSF
   1.3 mol Calcium Chloride
   1.4 mol Potassium Chloride
--------------------------------------------

Actual results:
--------------------------------------------
   Actin #2543: Description here.

   1 mol AEBSF
--------------------------------------------
   i.e the last two compounds are not displayed.

I can't for the life of me see the problem. A new set of eyes looking at
this would be GREATLY appreciated. Thanks very much in advance.

- Best regards,

  Lee

--- End Message ---
--- Begin Message ---
I see the problem. No reply neccessary.

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

LPR> --------------------------------------------
LPR>   while($row = mysql_fetch_array($result))
LPR>   {
LPR>     $pri = $row['pri'];
LPR>     $fg = $row['fg'];
LPR>     $molw = $row['molw'];
LPR>     $density = $row['density'];
LPR>     $denstype = $row['denstype'];
LPR>     $pctd = $row['pctd'];
LPR>     $maxpctd = $row['maxpctd'];
LPR>     $compid = $row['compid'];

LPR>     $sql = "select * from compounds where compid = \"$compid\"";
LPR>     $result = mysql_query($sql,$conn);
LPR>     $row = mysql_fetch_array($result);

LPR>     $compname = $row['compname'];
LPR>     $concentration = $row['concentration'];
LPR>     $concunit = $row['concunit'];
LPR>     $type = $row['type'];
LPR>     $composition = $row['composition'];

LPR>     if ($fg=="Y")
LPR>        $html .= "<b>$concentration $concunit $compname</b><br>";
LPR>     else if ($pri=="Y")
LPR>        $html .= "<font color=\"#000066\"> $concentration $concunit
LPR> $compname</font><br>";
LPR>     else
LPR>        $html .= " $concentration $concunit $compname<br>";
LPR>   }
LPR> --------------------------------------------


You are re-assigning the value of $row within the while construct.
When you get to your query within the while chunk, use different
variable names than the "master".


- Julie

--> Julie Meloni
--> [EMAIL PROTECTED]
--> www.thickbook.com

Find "Sams Teach Yourself MySQL in 24 Hours" at
http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20

--- End Message ---
--- Begin Message ---
Line 13 is re-assigning $result, the save variable you're using in line 1!

 1  while($row = mysql_fetch_array($result))
 2  {
 3    $pri = $row['pri'];
 4    $fg = $row['fg'];
 5    $molw = $row['molw'];
 6    $density = $row['density'];
 7    $denstype = $row['denstype'];
 8    $pctd = $row['pctd'];
 9    $maxpctd = $row['maxpctd'];
10    $compid = $row['compid'];
11
12    $sql = "select * from compounds where compid = \"$compid\"";
13    $result = mysql_query($sql,$conn);
14    $row = mysql_fetch_array($result);
15
16    $compname = $row['compname'];
17    $concentration = $row['concentration'];
18    $concunit = $row['concunit'];
19    $type = $row['type'];
20    $composition = $row['composition'];
21
22    if ($fg=="Y")
23       $html .= "<b>$concentration $concunit $compname</b><br>";
24    else if ($pri=="Y")
25       $html .= "<font color=\"#000066\"> $concentration $concunit
$compname</font><br>";
26    else
27       $html .= " $concentration $concunit $compname<br>";
28  }

-----Original Message-----
From: Lee P Reilly [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 20, 2002 9:24 AM
To: PHP List
Subject: [PHP] while loop question - problem (new set of eyes needed)


Hi,

I wonder if someone could have a quick look at this for me? It's a
simple while loop, but it's not acting the way (I think) it should. If I
break down the while loop, it reads:

--------------------------------------------
  // $result contains 3 rows
  while($row = mysql_fetch_array($result))
  {
    echo " xxx ";
  }
--------------------------------------------
     => xxx xxx xxx is displayed (as expected)

If I add the following code to the loop, it only seems to iterate
through it *once*:

--------------------------------------------
  while($row = mysql_fetch_array($result))
  {
    $pri = $row['pri'];
    $fg = $row['fg'];
    $molw = $row['molw'];
    $density = $row['density'];
    $denstype = $row['denstype'];
    $pctd = $row['pctd'];
    $maxpctd = $row['maxpctd'];
    $compid = $row['compid'];

    $sql = "select * from compounds where compid = \"$compid\"";
    $result = mysql_query($sql,$conn);
    $row = mysql_fetch_array($result);

    $compname = $row['compname'];
    $concentration = $row['concentration'];
    $concunit = $row['concunit'];
    $type = $row['type'];
    $composition = $row['composition'];

    if ($fg=="Y")
       $html .= "<b>$concentration $concunit $compname</b><br>";
    else if ($pri=="Y")
       $html .= "<font color=\"#000066\"> $concentration $concunit
$compname</font><br>";
    else
       $html .= " $concentration $concunit $compname<br>";
  }
--------------------------------------------

Expected results:
--------------------------------------------
   Actin #2543: Description here.

   1 mol AEBSF
   1.3 mol Calcium Chloride
   1.4 mol Potassium Chloride
--------------------------------------------

Actual results:
--------------------------------------------
   Actin #2543: Description here.

   1 mol AEBSF
--------------------------------------------
   i.e the last two compounds are not displayed.

I can't for the life of me see the problem. A new set of eyes looking at
this would be GREATLY appreciated. Thanks very much in advance.

- Best regards,

  Lee


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

 >   while($row = mysql_fetch_array($result))
 >   {

So, your while loop is based on values of $row.

 >     $row = mysql_fetch_array($result);

Now within your while loop you've altered the value of $row - poor thing
is probably a tad confused.

CYA, Dave


--- End Message ---
--- Begin Message ---
howdy,

using the script below can see why I am getting the following error?

Warning: fopen("Resource id #1",
"http://www.phpbuilder.com/rss_feed.php?type=general&limit=10";) - No error
in c:\phpdev\www\test.php on line 46
file could not be opened


print( "<H1>HTTP</H1>\n");
$prox = "proxy_number"

$datei = fsockopen("$prox", 3128, &$errno,
&$errstr);
if (!($myFile = fopen($datei,
"http://www.phpbuilder.com/rss_feed.php?type=general&limit=10";, "r")))
{
  print ("file could not be opened");
  exit;
}
while (!feof($myFile))
{
  //read a line from file
  $myLine = fgetss($myFile);
  print ("$myLine <BR>\n");
}

//close the file
fclose($myFile);




any help is apreciated

Cheers

Peter
"the only dumb question is the one that wasn't asked"


--- End Message ---
--- Begin Message ---
This should send me an e-mail with the form info then send a thank you
letter to the subscriber.
It does the first, but not second,  any ideas?
 
 
<?
$MailToAddress = "[EMAIL PROTECTED]";
$MailSubject = "Joine-mail list";
    if (!$MailFromAddress) {
    $MailFromAddress = "$email";
    }
$Header = "";
$Footer = "";
?>
                    <?
    if (!is_array($HTTP_POST_VARS))
    return;
reset($HTTP_POST_VARS);
    while(list($key, $val) = each($HTTP_POST_VARS)) {
    $GLOBALS[$key] = $val;
    $val=stripslashes($val);
   
    $Message .= "$key = $val\n";
    }
 
    if ($Header) {
    $Message = $Header."\n\n".$Message;
    }
 
    if ($Footer) {
    $Message .= "\n\n".$Footer;
    }
 
mail( "$MailToAddress", "$MailSubject", "$Message", "From:
$MailFromAddress");
?>    
 
 
 
                <?php
if(isset($Submit)) {
        $subject = "Thank You";
 $MailFromAddress = "[EMAIL PROTECTED]";
 
    while(list($key, $value) = each($HTTP_POST_VARS)) {
        $$key = $value;
        $msg .= "$key = $value\n";
    }
 
 
 
    $comment = "The thank you letter goes here";
 
// Send reply to them
   
mail( "$email", "$subject", "$comment", "From: $MailFromAddress");
    
}
?>
--- End Message ---
--- Begin Message ---
In article <001c01c1ff9a$0e4369b0$b700a8c0@yoda>, [EMAIL PROTECTED] says...
> This should send me an e-mail with the form info then send a thank you
> letter to the subscriber.
> It does the first, but not second,  any ideas?
>  
>  
> <?
> $MailToAddress = "[EMAIL PROTECTED]";
> $MailSubject = "Joine-mail list";
>     if (!$MailFromAddress) {
>     $MailFromAddress = "$email";
>     }
> $Header = "";
> $Footer = "";
> ?>
>                     <?
>     if (!is_array($HTTP_POST_VARS))
>     return;
> reset($HTTP_POST_VARS);
>     while(list($key, $val) = each($HTTP_POST_VARS)) {
>     $GLOBALS[$key] = $val;
>     $val=stripslashes($val);
>    
>     $Message .= "$key = $val\n";
>     }
>  
>     if ($Header) {
>     $Message = $Header."\n\n".$Message;
>     }
>  
>     if ($Footer) {
>     $Message .= "\n\n".$Footer;
>     }
>  
> mail( "$MailToAddress", "$MailSubject", "$Message", "From:
> $MailFromAddress");
> ?>    
>  
>  
>  
>                 <?php
> if(isset($Submit)) {
>         $subject = "Thank You";
>  $MailFromAddress = "[EMAIL PROTECTED]";
>  
>     while(list($key, $value) = each($HTTP_POST_VARS)) {
>         $$key = $value;
>         $msg .= "$key = $value\n";
>     }

Probably the first thing you could check is whether $Submit is set; there 
seems to be nothing there that would do so.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam
--- End Message ---
--- Begin Message ---
I am trying to clone my webserver because I am switching ISPs.  So I copied
the MySQL database, and then I copied the php pages.  But my new server
insists that any query I do is not a valid result resource when I try to use
it in a mysql_fetch_array command.  I know that both php and the database
are functional (to an extent) because all other commands work.
I'm using PHP 4.something over MySQL 3.2.3 running RedHat 7.0.
Thanks

Justin


--- End Message ---
--- Begin Message ---
At 9:38 PM -0400 19/5/02, Justin Latham wrote:

>insists that any query I do is not a valid result resource when I try to use
>it in a mysql_fetch_array command.  I know that both php and the database

So what errors are being returned by all the mysql_* calls?

Error messages are their to help the programmer find problems...
not as an annoyance to be turned off and/or ignored.

 ...R.
--- End Message ---

Reply via email to