php-general Digest 11 Nov 2001 09:44:26 -0000 Issue 988

Topics (messages 74125 through 74160):

Re: global variable for all scripts
        74125 by: Kurt Lieber

mail() attach jpeg
        74126 by: jtjohnston

Date help (no not that kind)
        74127 by: sundogcurt

gdImageGif compile errors with 4.0.6
        74128 by: Forrest Aldrich

Re: rules for headers?
        74129 by: Chris Hobbs

Re: Apache User Groups?
        74130 by: Chris Hobbs

Form Name Attribute Help!
        74131 by: Kal Amry
        74132 by: jimw.apache.org
        74133 by: Chris Hobbs
        74136 by: Kal Amry

Re: mail() attach png
        74134 by: jtjohnston

Session probs with SSI
        74135 by: Christian Dechery

Class for database-access doesn't work
        74137 by: Alexander Czernay

gdImageGif errors
        74138 by: Forrest Aldrich

Where can I find a routine ......
        74139 by: Roy W

Drawing line onto an image
        74140 by: Torkil Johnsen
        74143 by: Rasmus Lerdorf

SetCookie return
        74141 by: Christian Dechery
        74142 by: Rasmus Lerdorf

converting string to double
        74144 by: Kal Amry
        74145 by: CC Zona
        74146 by: Christian Dechery

Re: HTTP_POST_VARS: Data there, but can't get to it
        74147 by: Christopher William Wesley
        74149 by: Tom Rogers

Help with array in class needed
        74148 by: Alexander Czernay

Problems with the fopen() function
        74150 by: Tim Harvey
        74151 by: Matt Friedman
        74156 by: Tim Harvey - 5 Star Hosting

Recompiling under new kernel
        74152 by: Gaylen Fraley

Random Row From Database
        74153 by: HEW Staff
        74157 by: Christian Reiniger

e modifier
        74154 by: Brian Clark
        74155 by: Kal Amry

| delimiter can not be found with strpos nor with explode
        74158 by: Kal Amry
        74160 by: Kal Amry

warning eror
        74159 by: brett

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]


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


On Saturday 10 November 2001 01:29 pm, you wrote:
> if i like to move my scripts to /www/my_newdir i habe to change the
> include() function in every script

A few options:

1.  Don't use absolute paths -- use relative paths.  Then you don't have to 
worry about it as long as the overall structure of your site stays the same.

2.  set a variable or named constant to the value of your path and then use 
that throughout your site.  For example:

DEFINE("MY_PATH","/www/my_newdir");

include(MY_PATH);

This works well when you have one file that contains all your named constants 
and other stuff that needs to be accessible on a global basis.  You then 
include that one file (using relative paths) at the top of every php page.  
If you need to change a value, you change it once in your global file and be 
done with it.

3.  It's fairly trivial to do an automated search and replace across multiple 
files.  Just do this and let the computer replace all occurances of 
include("/www/my_olddir") to include("/www/my_newdir")

hth

--kurt




Anyone have an example of mail() attaching a png or jpeg?

I'm doing this:

...
ImagePNG($image);
imagedestroy($image);





I am trying to determine if todays date ($today) is within a week 
($startcheck) of a given date ($dob). This is what I have so far.

$todaydate = (date("Y-d-m"));
$today = strtotime($todaydate);
// $today prior to strtotime = 2001-10-11
$startcheck = strtotime(2001-08-11);
$dob = strtotime(2001-15-11);

//$today is CLEARLY between the two dates I'm testing with but "no" is 
always returned.

if($today <= $dob && $startcheck <= $today) {
    print "yes";
}
else {
    print "no";
}

Here are the values assigned to the vars, why is $today so much smaller 
than $startcheck and $dob?

1002783600 = today
1005452940 = startcheck
1005451980 = dob

win32 php4

Thanks in advance







I'm trying to compile php-4.0.6 on FreeBSD-4.4-STABLE for Apache, and I've 
tried using both version 1 and 2 of the gd library; however, the compile 
continues to crash with undefined calls to gdImageGif.

I can see that in the code there are mentions of a drop-in replacement 
gd_png for this call -- however, I'm not a programmer and couldn't really 
figure it out.

Is this a known problem?  If so, is there a work around? 





Just for kicks, try this instead:

if (!isset($newimage))
{...

jtjohnston wrote:


> However it crashes if $newimage=1
> My image doesn't display.


> <?php
> 
> if(!$newimage)
> {
> header("Content-type: text/html");
> echo "hi<br>";
> echo "rendu: $rendu<br>";
> }else{
> 
> header("Content-type: image/png");
> $image = imagecreate(500, 350);
> //etc...
> }
> ?>
> 
> 


-- 
                _______      ___    _  ____  _____
Chris Hobbs   / ____\ \    / / |  | |/ ___\|  __ \
Head Geek    | (___  \ \  / /| |  | | (___ | |  | |
WebMaster     \___ \  \ \/ / | |  | |\___ \| |  | |
PostMaster    ____) |  \  /  | |__| |____) | |__| |
               \____/    \/    \____/ \____/|_____/
                   http://www.silvervalley.k12.ca.us
                       [EMAIL PROTECTED]





http://www.apache.org/foundation/mailinglists.html

Eric wrote:

> Does anyone know of a usergroup for Apache? I am having difficulties
> finding one and am having some troubles with Apache.
> 
> 
> Thanks
> Eric
> 
> 


-- 
                _______      ___    _  ____  _____
Chris Hobbs   / ____\ \    / / |  | |/ ___\|  __ \
Head Geek    | (___  \ \  / /| |  | | (___ | |  | |
WebMaster     \___ \  \ \/ / | |  | |\___ \| |  | |
PostMaster    ____) |  \  /  | |__| |____) | |__| |
               \____/    \/    \____/ \____/|_____/
                   http://www.silvervalley.k12.ca.us
                       [EMAIL PROTECTED]





I have posted this question before so I'm giving another try in case new
people are looking at the news list!!

If I have a form in  named formName1 such as:

<form name="formName1" action="file.php" method="post">

How can I get the name "formName1" from within file.php

My original question was:

Hi guys, If I have a code in file1.php such as:

<form name=formName1 action=file2.php method=post>
code..........
code..........
</form>

And

<form name=formName2 action=file2.php method=post>
code..........
code..........
</form>

Now in file2.php, I need to check which form I am receiving!! How do I
check!!

In other words, let's assume we only have the form names "formName1" and
"formName1" - What code I can use in file2.php to get the name of the
calling form. I just want to know how can I get the name of the form (in the
above case, formName1 or formName2)

Thanx






Kal Amry <[EMAIL PROTECTED]> wrote:
> If I have a form in  named formName1 such as:
> 
> <form name="formName1" action="file.php" method="post">
> 
> How can I get the name "formName1" from within file.php

you can't. but you can add a hidden form field to each form to pass
along a value. for example:

<form name="formName1" action="file.php" method="post">
<input type="hidden" name="form" value="1" />
...
</form>

(then you can just access $form in file.php to figure out which form was
submitted.)

jim




It doesn't appear that the name attribute is passed (ref: 
http://www.blooberry.com/indexdot/html/tagpages/f/form.htm). Instead, 
try including the following in each of your forms:

<input type='hidden' name='formname' value='formName1'>

Then you can check $formname in file.php for the value.

Hope this helps!

Kal Amry wrote:

> I have posted this question before so I'm giving another try in case new
> people are looking at the news list!!
> 
> If I have a form in  named formName1 such as:
> 
> <form name="formName1" action="file.php" method="post">
> 
> How can I get the name "formName1" from within file.php
> 
> My original question was:
> 
> Hi guys, If I have a code in file1.php such as:
> 
> <form name=formName1 action=file2.php method=post>
> code..........
> code..........
> </form>
> 
> And
> 
> <form name=formName2 action=file2.php method=post>
> code..........
> code..........
> </form>
> 
> Now in file2.php, I need to check which form I am receiving!! How do I
> check!!
> 
> In other words, let's assume we only have the form names "formName1" and
> "formName1" - What code I can use in file2.php to get the name of the
> calling form. I just want to know how can I get the name of the form (in the
> above case, formName1 or formName2)
> 
> Thanx
> 
> 
> 
> 


-- 
                _______      ___    _  ____  _____
Chris Hobbs   / ____\ \    / / |  | |/ ___\|  __ \
Head Geek    | (___  \ \  / /| |  | | (___ | |  | |
WebMaster     \___ \  \ \/ / | |  | |\___ \| |  | |
PostMaster    ____) |  \  /  | |__| |____) | |__| |
               \____/    \/    \____/ \____/|_____/
                   http://www.silvervalley.k12.ca.us
                       [EMAIL PROTECTED]





Thanks guy, well I have to edit a lot of forms then :)

"Chris Hobbs" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> It doesn't appear that the name attribute is passed (ref:
> http://www.blooberry.com/indexdot/html/tagpages/f/form.htm). Instead,
> try including the following in each of your forms:
>
> <input type='hidden' name='formname' value='formName1'>
>
> Then you can check $formname in file.php for the value.
>
> Hope this helps!
>
> Kal Amry wrote:
>
> > I have posted this question before so I'm giving another try in case new
> > people are looking at the news list!!
> >
> > If I have a form in  named formName1 such as:
> >
> > <form name="formName1" action="file.php" method="post">
> >
> > How can I get the name "formName1" from within file.php
> >
> > My original question was:
> >
> > Hi guys, If I have a code in file1.php such as:
> >
> > <form name=formName1 action=file2.php method=post>
> > code..........
> > code..........
> > </form>
> >
> > And
> >
> > <form name=formName2 action=file2.php method=post>
> > code..........
> > code..........
> > </form>
> >
> > Now in file2.php, I need to check which form I am receiving!! How do I
> > check!!
> >
> > In other words, let's assume we only have the form names "formName1" and
> > "formName1" - What code I can use in file2.php to get the name of the
> > calling form. I just want to know how can I get the name of the form (in
the
> > above case, formName1 or formName2)
> >
> > Thanx
> >
> >
> >
> >
>
>
> --
>                 _______      ___    _  ____  _____
> Chris Hobbs   / ____\ \    / / |  | |/ ___\|  __ \
> Head Geek    | (___  \ \  / /| |  | | (___ | |  | |
> WebMaster     \___ \  \ \/ / | |  | |\___ \| |  | |
> PostMaster    ____) |  \  /  | |__| |____) | |__| |
>                \____/    \/    \____/ \____/|_____/
>                    http://www.silvervalley.k12.ca.us
>                        [EMAIL PROTECTED]
>






> ImagePNG($image);
> imagedestroy($image);

I tried adding headers, but am missing something. Can anyone help?

<?php

mail("[EMAIL PROTECTED]", "Test Image", "Test
message","Content-Type: multipart/mixed;
 boundary=\"------------15E3B1D587950C2CAADCBF93\"

This is a multi-part message in MIME format.
--------------15E3B1D587950C2CAADCBF93
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit



--------------15E3B1D587950C2CAADCBF93
Content-Type: image/png;
 name=\"postcard10.png\"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 filename=\"postcard10.png\"

$image

--------------15E3B1D587950C2CAADCBF93--

");

echo "mail sent";
?>





At 12:03 10/11/01 -0800, Rasmus Lerdorf wrote:
>Perhaps because you keep asking non-PHP related questions on the PHP
>lists.  I see a bunch of questions about Apache and .htaccess from you
>which you yourself admitted has nothing to do with PHP.  So, yes, your
>history of lame questions work against you.

ok... sorry about that... I'm desperate...


>But to answer your question, it is very likely your session id will get
>lost through an SSI include virtual.  Probably no way to fix that
>depending on how you are doing things.  Generally using SSI at all is a
>bad idea.  SSI will have to be turned on and that is just as much a hassle
>as turning on PHP these days.

I guess I explained very well my case...

I need to know exactly... sorry if I'm being to annoying, but I got to have 
a precise information... does sessions work with SSI or not? And I need to 
know why... I don't understand the process of an SSI... does the included 
file gets processed after or before the parent? It has its own header or 
its the same as the parents'? I checked with headers_sent() and it seems 
that the included file has its own header, or it wouldn't even register the 
session variables... meaning it could as well work the session...

And the weirdest thing is that, as I explained in my mails, if the session 
gets started elsewhere, then it works beatifully even with SSI... that's 
why I think this is not an expected behaviour...

_____________________________
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br





Hi,

I just tried to write a simple class for opening a MySQL-database with PHP.
The database get's opened, but the handle isn't transfered back. I can then
use the database, but only if I don't specify the handle in mysql_query.

Any ideas?

Code:
db.php:
<?
class Database {
 var $connect;
 var $database;

 function Database($host="local") {
  switch ($host) {
   case "local" :
    $this->$connect = mySQL_connect("host","user","pass");
    $this->$database = mysql_select_db("db", $this->$connect);
    break;
  }
 }

 function getConnect() {
  return $this->$connect;
 }

 function getDatabase() {
  return $this->$database;
 }
}
?>

test.php:
<html>
<head>
</head>

<body>

<?
include("lib/db.php");

$db = new Database();
$connect = $db->$getConnect;

$result = mysql_query("select * from data");
while ($data = mysql_fetch_array($result)) {
 extract($data);
 echo "-".$id."-<br>";
}


?>

</body>
</html>







In follow-up to my bug report, here is the compiler output:

>gmake[3]: Entering directory `/usr/local/src/php-4.0.6/ext/gd'
>/bin/sh /usr/local/src/php-4.0.6/libtool --silent --mode=compile gcc  -I. 
>-I/usr/local/src/php-4.0.6/ext/gd -I/usr/local/src/php-4.0.6/main 
>-I/usr/local/src/php-4.0.6 -I/usr/apache/include/apache 
>-I/usr/local/src/php-4.0.6/Zend -I/usr/local/include/freetype 
>-I/usr/local/include/gd -I/usr/local/include -I/usr/local/include/c-client 
>-I/usr/local/include/mysql -I/usr/local/src/php-4.0.6/ext/xml/expat/xmltok 
>-I/usr/local/src/php-4.0.6/ext/xml/expat/xmlparse 
>-I/usr/local/src/php-4.0.6/TSRM  -DMOD_SSL=208104 -DEAPI -DUSE_EXPAT 
>-DSUPPORT_UTF8 -DXML_BYTE_ORDER=12 -g -O2  -c gd.c
>gd.c: In function `php_if_imagegif':
>gd.c:1404: `gdImageGif' undeclared (first use in this function)
>gd.c:1404: (Each undeclared identifier is reported only once
>gd.c:1404: for each function it appears in.)
>gmake[3]: *** [gd.lo] Error 1
>gmake[3]: Leaving directory `/usr/local/src/php-4.0.6/ext/gd'
>gmake[2]: *** [all-recursive] Error 1
>gmake[2]: Leaving directory `/usr/local/src/php-4.0.6/ext/gd'
>gmake[1]: *** [all-recursive] Error 1
>gmake[1]: Leaving directory `/usr/local/src/php-4.0.6/ext'
>gmake: *** [all-recursive] Error 1

I tried tweaking some other options (omitting), but it remains 
unaffected.  I'm puzzled, because it seems to have compiled okay a while 
ago.   Perhaps there were changes in the GD code that resulted in this bug.


Thanks,

Forrest
(please CC me responses)





Where can I find a routine or PHP prog that will evaluate the distances
between zip codes or "find within X miles of a zip code"

Any ideas?








Hello.

I'm looking for sample code on how I can solve this problem:

 - I have a webpage.
 - On the webpage I have a map. (gif image)
 - I have two points on the map: a and b, with coordinates ax,ay and bx,by
 - Now... I want to create a straight line that is drawn from a to b, and I
want this line to be displayed on top of the map.

So I want to make a php-generated line that is drawn upon a gif.
Maybe it is possible to draw this line inside a layer that is placed upon
the webpage with a higher z-index that that of the map gif?

... any clever minds out there?

Thanks in advance,
Torkil Johnsen






Grab an old version of GD (one with GIF support), and simply use 
ImageCreateFromGif() followed by ImageLine() and ImageGif() and you are 
done.

-Rasmus

On Sun, 11 Nov 2001, Torkil Johnsen wrote:

> Hello.
> 
> I'm looking for sample code on how I can solve this problem:
> 
>  - I have a webpage.
>  - On the webpage I have a map. (gif image)
>  - I have two points on the map: a and b, with coordinates ax,ay and bx,by
>  - Now... I want to create a straight line that is drawn from a to b, and I
> want this line to be displayed on top of the map.
> 
> So I want to make a php-generated line that is drawn upon a gif.
> Maybe it is possible to draw this line inside a layer that is placed upon
> the webpage with a higher z-index that that of the map gif?
> 
> ... any clever minds out there?
> 
> Thanks in advance,
> Torkil Johnsen
> 
> 
> 
> 





what does SetCookie() returns???

I did a var_dump() on it and it gave me 'bool(true)' when in fact the 
cookie was not set...

_____________________________
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br





SetCookie() cannot know whether the client accepts the cookie or not.  It 
can only send it.  You will need to check in a subsequent request if the 
client decided to accept it or not.

-Rasmus

On Sat, 10 Nov 2001, Christian Dechery wrote:

> what does SetCookie() returns???
> 
> I did a var_dump() on it and it gave me 'bool(true)' when in fact the 
> cookie was not set...
> 
> _____________________________
> . Christian Dechery
> . . Gaita-L Owner / Web Developer
> . . http://www.webstyle.com.br
> . . http://www.tanamesa.com.br
> 
> 
> 






Any handy function to convert a string such as

$string1 = '55.32'

To A Number such as

55.32






In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Kal Amry) wrote:

> Any handy function to convert a string such as
> 
> $string1 = '55.32'
> 
> To A Number such as
> 
> 55.32

http://www.php.net/manual/en/language.types.type-juggling.php

-- 
CC




try floatval()

At 21:13 10/11/01 -0500, Kal Amry wrote:

>Any handy function to convert a string such as
>
>$string1 = '55.32'
>
>To A Number such as
>
>55.32
>
>
>
>--
>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]


_____________________________
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br





Name the form element without the brackets ... just "whatdo" instead of
"whatdo[]".  When $whatdo[] makes it to your formhandler, it's an array.
(You _could_ access $whatdo[0] ... but that may or may not be more
confusing.)

        ~Chris                           /"\
                                         \ /     September 11, 2001
                                          X      We Are All New Yorkers
                                         / \     rm -rf /bin/laden

On Sat, 10 Nov 2001, Lara J. Fabans wrote:

> Just an addendum, I changed it from radio buttons to a pop up menu
>
>          <p>
>            <select name="whatdo[]" id="whatdo">
>              <option value="load" selected>Load</option>
>              <option value="delete">Delete</option>
>              <option value="change">Change Category</option>
>            </select>
>          </p>
>
>
> Again, if I print_r (HTTP_POST_VARS), I can see the Array ( [whatdo] =>
> Array ( [0] => load [1] => delete), [other
> stuff]....)
> but I cannot access it.  I'm doing the same exact syntax for the image
> name="image[]" which works perfectly.
>
> I can find nothing on this in the documentation or any of the other
> wonderful books & websites out there.
> Please, what am I doing wrong in trying to access the HTTP_POST_VARS?
>
> Thanks,
> Lara
>
>
> At 08:36 AM 11/10/2001 -0800, Lara J. Fabans wrote:
> >My bad for typing it in from memory. I'd retyped it in a few times, so I
> >thought i had it perfect.  Here's the exact code:
> >
> >print_r ($HTTP_POSTVARS); // yeilds the array that I pasted down below
> >if ($flag=="process")
> >{
> >$whatdo = $HTTP_POSTVARS['whatdo'];
> >print_r($what_do);   // blank
> >.
> >.
> >.
> >
> >  for ($x=0;$x<=$row;$x++)
> >  {
> >
> >  $whatdox = $whatdo[$x];
> >print $whatdox;  // blank
> >.
> >.
> >.
> >//loop start
> >   <tr>
> >     <td nowrap>
> >       <p>
> >         <input type="radio" name="whatdo[<?php print $row?>]" value="load"
> >checked>
> >         Load<br>
> >         <input type="radio" name="whatdo[<?php print $row?>]"
> >value="delete">
> >         Delete<br>
> >         <input type="radio" name="whatdo[<?php print $row?>]"
> >value="change">
> >         Change Category</p>
> >     </td>
> >.
> >.
> >.
> >
> >---------------------
> >Lara J. Fabans
> >Lodestone Software, Inc
> >[EMAIL PROTECTED]
> >
> >
> > > At 09:41 AM 10/11/01, Lara J. Fabans wrote:
> > > >Hi,
> > > >
> > > >I'm having some difficulties accessing HTTP_POST_VARS
> > > >
> > > >The original form has a table where each row has a set of 3 radio
> > > >buttons  name="whatdo<?php print $x?>[]"   where $x is the row counter.
> > > >(I'm using PHP to pull info into a table, then the user manipulates
> > > >the info, and it places the info into 2 other tables depending upon what
> > > >the choice is for the 3 radio buttons).
> > > >
> > > >So, on submit, it reloads the page, and I pull in all of the areas.  All
> > > >work except the radio buttons.
> > > >
> > > >I've tried:
> > > >$submitted_vars = $HTTP_POST_VARS;
> > > >$whatdo = $submitted_vars[whatdo];
> > > >---
> > > >and
> > > >$whatdo = $HTTP_POST_VARS["whatdo"];
> > > >--
> > > >
> > > >but when I do a print_r($whatdo)
> > > >it's blank
> > > >
> > > >When I do a
> > > >print_r($HTTP_POST_VARS)
> > > >I get
> > > >Array ( [whatdo] => Array ( [0] => load [1] => delete), [other
> >stuff]....)
> > > >
> > > >
> > > >What am I doing wrong :-)  How do I access this data?  It's so
> >frustrating
> > > >since all the rest of the postvars are working, and I can see that the
> > > >data's there in the HTTP_POST_VARS....I just can't get to it. (pun not
> > > >intended)
>
> ---------------------
> Lara J. Fabans
> Lodestone Software, Inc
> [EMAIL PROTECTED]
>
>
> --
> 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]
>
>





Hi
This works (save as whatdo.php)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head><title>Whatdo</title></head>
<body>
<?php
$rowcount = 2;
$row = 0;
//check for submit button pressed
if($submit == "Submit"):
         while($row < $rowcount):
                 $postvar = "whatdo-".$row;
                 echo "Row ".$row." is ".$HTTP_POST_VARS["$postvar"]."<br>";
                 $row++;
         endwhile;
else:
?>
<table border="1" cellspacing="0" cellpadding="4">
<form action="whatdo.php" method="post">
<?php
         while($row < $rowcount):
?>
         <tr>
                 <td>Row <?php echo $row?> Options</td>
                 <td nowrap>
                 <input type="radio" name="whatdo-<?php echo $row?>" 
value="load"checked>Load<br>
                 <input type="radio" name="whatdo-<?php echo $row?>" 
value="delete">Delete<br>
                 <input type="radio" name="whatdo-<?php echo $row?>" 
value="change">Change Category
                 </td>
         </tr>
<?php
                 $row ++;
         endwhile;
?>
         <tr>
                 <td colspan="2" align="center"><input type="submit" 
name="submit" value="Submit"></td>
         </tr>
</form>
</table>
<?php
endif;
?>
</body>
</html>





I've written a class that reads a database into an array. This works fine,
but when I try to copy the array outside the class using a function that
only does a return $this->$data, I only get one sub-array of the whole one.

Any ideas?

Thanks

Alexander

Code:

class Adressen {
 var $connect; // database-handle
 var $daten = array(); // array for data

 // Constructor
 function Adressen($datenbank) {
  $this->$connect = $datenbank->getConnect();
 }

 // read data from database
 function readData() {
  $this->$daten = array();
  $result = mysql_query("select * from adressen");
  while($data = mysql_fetch_array($result)) {
   extract($data);
   $this->$daten[$AdressenID] = array("strasse" => $Strasse, "plz" => $PLZ,
"ort" => $Ort, "land" => $Land, "telefon" => $Telefon, "telefax" =>
$Telefax, "email" => $Email);
  }
 }

 function getData() {
  return $this->$daten;
 }
}






Can somebody PLEASE help me with this problem I'm having.

This is a script to search the web. It sends the parematers "q,c & i" to the
"SeacrhHippo" server using the fopen function. When the script executes the
following error messages are displayed:

Warning: php_hostconnect: connect failed in /usr/home/public_html/test.php
on line 118
Warning: fopen("http://www.searchhippo.com/qxml?q=test&c=&i=","r";) - Bad
file descriptor in /usr/home/public_html/test.php on line 118






I would try urlencoding the query-string in that url. Or put the url in
single quotes instead.

Just shots in the dark, but try it out.

M.


----- Original Message -----
From: "Tim Harvey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, November 10, 2001 9:44 PM
Subject: [PHP] Problems with the fopen() function


> Can somebody PLEASE help me with this problem I'm having.
>
> This is a script to search the web. It sends the parematers "q,c & i" to
the
> "SeacrhHippo" server using the fopen function. When the script executes
the
> following error messages are displayed:
>
> Warning: php_hostconnect: connect failed in /usr/home/public_html/test.php
> on line 118
> Warning: fopen("http://www.searchhippo.com/qxml?q=test&c=&i=","r";) - Bad
> file descriptor in /usr/home/public_html/test.php on line 118
>
>
>
> --
> 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]
>
>
>





I tried what Matt suggested but it doesn't work. Anybody else got any
suggestions?

----- Original Message -----
From: "Tim Harvey" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 11, 2001 3:44 AM
Subject: Problems with the fopen() function


> Can somebody PLEASE help me with this problem I'm having.
>
> This is a script to search the web. It sends the parematers "q,c & i" to
the
> "SeacrhHippo" server using the fopen function. When the script executes
the
> following error messages are displayed:
>
> Warning: php_hostconnect: connect failed in /usr/home/public_html/test.php
> on line 118
> Warning: fopen("http://www.searchhippo.com/qxml?q=test&c=&i=","r";) - Bad
> file descriptor in /usr/home/public_html/test.php on line 118
>
>





I've updated the linux kernel and just noticed that phpinfo (obviously)
still only knows about the system info under the previous kernel.  In order
to bring the information up to date, do I have to recompile from scratch, or
is there an easier way?  I seem to remember reading that if I don't want to
change any configuration options that I can short step the ./configure
command.  Can anyone shed some light on this?

--
Gaylen
[EMAIL PROTECTED]
Home http://www.gaylenandmargie.com
PHP KISGB v2.22 Guestbook http://www.gaylenandmargie.com/phpwebsite







Hi,

I'm trying to pull a random row from my database and display the contents.

I know that the code:
SELECT * FROM TABLENAME WHERE RAND() LIMIT 1
should work.

However, there are 19 rows in the database and only the first row ever shows
up.

Is there a way to do this to ensure uniqueness?

The code I am using at the moment also filters so that rows are pulled from
the database given certain other criteria such as:

SELECT * FROM TABLENAME WHERE PayerID=$id AND RAND() LIMIT 1

All of the rows in the database contain the same PayerID and this column is
not the Primary Key.

Any help much appreciated.
Jonathan S Hardiman
President/CEO
Hardiman Enterprises Worldwide






On Sunday 11 November 2001 05:18, HEW Staff wrote:
> Hi,
>
> I'm trying to pull a random row from my database and display the
> contents.
>
> I know that the code:
> SELECT * FROM TABLENAME WHERE RAND() LIMIT 1
> should work.

(1) [EMAIL PROTECTED] has nothing to do with this. So don't crosspost to 
there.

(2) No, it shouldn't work
"WHERE RAND ()" means "where some random number evaluates to true (i.e. 
is nonzero)"
you want "ORDER BY RAND () LIMIT 1"

-- 
Christian Reiniger
LGDC Webmaster (http://lgdc.sunsite.dk/)

...10001000110101011010101101011110111010113...????




Does anyone know when the PCRE modifier 'e' was added into PHP? Is it
version dependant, or has it been there since 3.0?

In 3.0.18 with `PCRE library version: 2.05 21-Apr-1999' I get:

  Warning:  Unknown option 'e' in [...]

But in 4.2.0-dev it is, of course, fine.

-Brian






I just came across this so check it - It might help:

http://www.php.net/manual/en/pcre.pattern.syntax.php#regexp.reference.backsl
ash

Kal

"Brian Clark" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Does anyone know when the PCRE modifier 'e' was added into PHP? Is it
> version dependant, or has it been there since 3.0?
>
> In 3.0.18 with `PCRE library version: 2.05 21-Apr-1999' I get:
>
>   Warning:  Unknown option 'e' in [...]
>
> But in 4.2.0-dev it is, of course, fine.
>
> -Brian
>






If I have the string like this "str1 | str2"

Then "|" is found

However, if I do the above as "str1|str2" without spaces

Then "|" can not be found

I appreciate any hints on a work around.







It works now!! It was some problems with DreamWaver ..

"Kal Amry" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> If I have the string like this "str1 | str2"
>
> Then "|" is found
>
> However, if I do the above as "str1|str2" without spaces
>
> Then "|" can not be found
>
> I appreciate any hints on a work around.
>
>






Can someone please tell me what to look for when this error appears:
Warning: Cannot use a scalar value as an array in 
/home/sites/site7/web/admin/repeat.php on line 141

It just came about in a page that has worked fine until now.  But that is how problems 
usually arrive, I think it is fine and leave it alone and all hell breaks loose.  If 
anyone has any input I would appreciate it.

Brett


Reply via email to