php-general Digest 23 Mar 2004 13:33:36 -0000 Issue 2663

Topics (messages 181215 through 181251):

Re: Passing by conditional IF statement...why?
        181215 by: Ligaya Turmelle
        181217 by: Daniel Guerrier
        181219 by: Ryan A
        181221 by: John W. Holmes
        181224 by: Ryan A

Re: Any Ideas?
        181216 by: John W. Holmes

PHP5 Release
        181218 by: daniel.electroteque.org
        181227 by: Yann Larrivee

Re: PHP installation problem in FreeBSD OS.
        181220 by: Filip de Waard

Image Storage
        181222 by: Matt Palermo
        181223 by: Michal Migurski
        181237 by: James Coder

Re: SQL Injection check (mysql)
        181225 by: trlists.clayst.com

Re: RE:[PHP] sessions...how to use not clear?
        181226 by: trlists.clayst.com

an if statement
        181228 by: Andy B
        181229 by: John W. Holmes
        181232 by: Andy B
        181234 by: Evgeny Pedya

Unable connect to ORACLE
        181230 by: Timotius

Ticketing system
        181231 by: daniel.electroteque.org
        181242 by: Henry Grech-Cini

mysql_connect error
        181233 by: T UmaShankari
        181235 by: php-general.lists.php.net

Constants
        181236 by: Jakes
        181250 by: Jay Blanchard

$x <> base64_decode(base64_encode($x)) for imagecreatefromstring
        181238 by: James Coder

php and email
        181239 by: Steven Mac Intye
        181240 by: Jakes

Re: [GLUG-chat] Re: email form
        181241 by: Steven Mac Intye

syntax for printing multi-dimensional arrays
        181243 by: Bob Pillford
        181244 by: Bob Pillford
        181245 by: Tom Rogers

Java script prompt - help
        181246 by: Brent Clark

PHPSESSID in passthru
        181247 by: Guillouet Nicolas

string to float
        181248 by: Diana Castillo
        181251 by: Jay Blanchard

Re: receiving ndr for each email sent to list
        181249 by: Jay Blanchard

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 ---
I think it is because the query ran successfully and returns an empty set.
So the pointer is still good.

Respectfully,
Ligaya Turmelle


"Ryan A" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
> I have this simple code in my php script:
>
> * * * * *
> $res = mysql_query("SELECT product_id, now()-1 FROM ".$tc."_prods where
> cno=$cno AND product_id='$product_id' LIMIT 1");
>
> if($res)
>  {
>  $r = mysql_fetch_row($res);
>  $product_id2   = $r[0];
>  $th_pres= $r[1];
> echo "debug echo";
>  }else {echo "No results, sorry";}
> * * * * *
>
> its working great when the data actually exists but when there are no
> matches it still executes the "if($res)" part instead of
> displaying "No results, sorry".
> Why is that? or am I using the syntax wrong?
>
> Thanks,
> -Ryan

--- End Message ---
--- Begin Message ---
if(mysql_num_rows($res))

returns count of rows returned.
if it 0 is false so it shouldn't execute the
conditional code
--- Ligaya Turmelle <[EMAIL PROTECTED]> wrote:
> I think it is because the query ran successfully and
> returns an empty set.
> So the pointer is still good.
> 
> Respectfully,
> Ligaya Turmelle
> 
> 
> "Ryan A" <[EMAIL PROTECTED]> wrote in message
>
news:[EMAIL PROTECTED]
> > Hi,
> > I have this simple code in my php script:
> >
> > * * * * *
> > $res = mysql_query("SELECT product_id, now()-1
> FROM ".$tc."_prods where
> > cno=$cno AND product_id='$product_id' LIMIT 1");
> >
> > if($res)
> >  {
> >  $r = mysql_fetch_row($res);
> >  $product_id2   = $r[0];
> >  $th_pres= $r[1];
> > echo "debug echo";
> >  }else {echo "No results, sorry";}
> > * * * * *
> >
> > its working great when the data actually exists
> but when there are no
> > matches it still executes the "if($res)" part
> instead of
> > displaying "No results, sorry".
> > Why is that? or am I using the syntax wrong?
> >
> > Thanks,
> > -Ryan
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

--- End Message ---
--- Begin Message ---
> "Ryan A" <[EMAIL PROTECTED]> wrote in message
>
news:[EMAIL PROTECTED]
> > Hi,
> > I have this simple code in my php script:
> >
> > * * * * *
> > $res = mysql_query("SELECT product_id, now()-1
> FROM ".$tc."_prods where
> > cno=$cno AND product_id='$product_id' LIMIT 1");
> >
> > if($res)
> >  {
> >  $r = mysql_fetch_row($res);
> >  $product_id2   = $r[0];
> >  $th_pres= $r[1];
> > echo "debug echo";
> >  }else {echo "No results, sorry";}
> > * * * * *
> >
> > its working great when the data actually exists
> but when there are no
> > matches it still executes the "if($res)" part
> instead of
> > displaying "No results, sorry".
> > Why is that? or am I using the syntax wrong?
> >
> > Thanks,
> > -Ryan

Thanks guys,
I'm now using:

if(($r = mysql_fetch_row($res)) >=1)

and its working fine, if the above approach has some problems, feel free to
write and tell me.

Cheers,
-Ryan

--- End Message ---
--- Begin Message --- Ryan A wrote:

if(($r = mysql_fetch_row($res)) >=1)

if($r = mysql_fetch_row($res))


will work fine if you only have one row being returned. If you have more than one that you need to loop through, then:

if($r = mysql_fetch_row($res))
{
  do
  {

  }while($r = mysql_fetch_row($res));
}

Now you have the added efficiency of not having to call mysql_num_rows() (if you don't need that value).

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Hey John,
Yep, this is just for one row as I need to know which file before I force a
download.
This is for people selling ebooks, MP3s etc

I usually use a while loop if I need multiple rows returned.

Cheers,
-Ryan

On 3/23/2004 3:07:14 AM, [EMAIL PROTECTED] wrote:
> Ryan A wrote:
>
> > if(($r = mysql_fetch_row($res)) >=1)
>
> if($r = mysql_fetch_row($res))
>
> will work fine if you only have one row being returned. If you have more
> than one that you need to loop through, then:
>
> if($r = mysql_fetch_row($res))
> {
> do
> {
>
> }while($r = mysql_fetch_row($res));
> }
>
> Now you have the added efficiency of not having to call mysql_num_rows()
> (if you don't need that value).
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals - www.phparch.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message --- Matthew Oatham wrote:

Bit rough at the moment but I have come up with the following - it doesn't
rename the file using the new ID yet but I am more concerned about my method
for creating the new ID - can anyone see any potential problems such as
database problems, i.e duplicate keys, bad coding practices etc... cheers
matt

if(!empty($_FILES["cr"])) {
    $uploaddir = "cr/"; // set this to wherever
    //copy the file to some permanent location
    if (move_uploaded_file($_FILES["cr"]["tmp_name"], $uploaddir .
$_FILES["cr"]["name"])) {
        echo("file uploaded\n");
        echo(generateCrId(insertChangeRequest()));
    } else {
        echo ("error!");
    }
}

function insertChangeRequest() {

    $sql = mysql_query("INSERT INTO dis_status(status, description)
        VALUES('status1', 'status1 description')") or die (mysql_error());

    return mysql_insert_id();
}

function generateCrId($key) {

$crId = sprintf("CR-%03d", $key);

    return $crId;
}

Looks fine. Just realize that you don't have to insert $crId into the database as you can just "recreate" it when you need to know the file name. You just retrieve the "id" and add the "CR-" to it.


--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Hi there i noticed RC1 is released, it states not for critical use, does
that mean for development purposes still ?

--- End Message ---
--- Begin Message ---
RC's should never be used in production area, you can use them to teste
the new feautres and your software.


Yann

On Mon, 2004-03-22 at 20:45, [EMAIL PROTECTED] wrote:
> Hi there i noticed RC1 is released, it states not for critical use, does
> that mean for development purposes still ?

--- End Message ---
--- Begin Message ---
On Mar 22, 2004, at 7:59 PM, Naveen Glore wrote:


Hello All,
I am not sure if this is the right place to post this problem. I tried with FreeBSD mailing list but could not get much help.

No, it isn't. There is a specific installation list ([EMAIL PROTECTED]).

I am having hard time in installing php4 using portupgrade in FreeBSD.

Try installing from source. There are dozens of tutorials on the net which will help you.


Regards,

Filip de Waar
--- End Message ---
--- Begin Message ---
I am creating a system to allow users to upload images to the site.  Would
it be better to store the images in a MySQL table, or having it save the
images to a directory on the server?  Anyone have any suggestions on this?
Pros? Cons?

Thanks,

Matt
http://sweetphp.com/

--- End Message ---
--- Begin Message ---
>I am creating a system to allow users to upload images to the site.
>Would it be better to store the images in a MySQL table, or having it
>save the images to a directory on the server?  Anyone have any
>suggestions on this? Pros? Cons?

Depends on the details of your situation - I've generally preferred to
store image in the filesystem. A few hosts I've used have administrative
limits on the size of a BLOB field, so storing images in the filesystem
was mandatory.

If those images are stored within the docroot, you can also just refer to
them by URI and let Apache handle all the appropriate headers and such, or
if you're strapped for CPU you can even use a completely different
webserver (thttpd, apache without PHP, etc.) to serve them.

If they're stored in the database or outside the docroot, you can control
access to them more easily. Keeping them in the database also means that
you don't have to worry about various filesystem considerations, like
keeping a world-writeable directory or potential undesired access from
others users in a shared hosting environment.

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca            http://mike.teczno.com/contact.html

--- End Message ---
--- Begin Message --- Michal Migurski wrote:
I am creating a system to allow users to upload images to the site.
Would it be better to store the images in a MySQL table, or having it
save the images to a directory on the server?  Anyone have any
suggestions on this? Pros? Cons?


MySQL themselves advise you use the filesystem for images - faster.

--- End Message ---
--- Begin Message ---
On 23 Mar 2004 Michael Rasmussen wrote:

> The idea is exactly not to do any queries dynamically generated based on
> user input! In the rare cases where this is needed you should not
> allow any unparsed input. 

There are some applications for which queries based on typed user input 
are rare.  But there are others for which those queries are the basis 
of the whole application!  Almost any kind of site where users are 
creating accounts and other data records (or their equivalents) will be 
like this, and that's a very common kind of web application.

I agree that in these cases the input should be validated, I think that 
was the original topic of the thread.  But I don't think you can call 
this "rare" as a general rule.

--
Tom

--- End Message ---
--- Begin Message ---
On 22 Mar 2004 Andy B wrote:

> so the theory is: if i require that the session be named after the persons
> login name there is probably 1 out of 2 million chances that it will mess up
> the names and get confused (specially if there are only a few users
> allowed)...

If the login name is unique and you don't allow multiple simultaneous 
logins then the chanve of a mixup is exactly zero.

If you are talking about session IDs, I believe they are 128 bits which 
translates to a chance of duplication of 1 in 
340,282,366,920,938,463,463,374,607,431,768,211,456 [the result from 
bcpow(2, 128, 0)].  Should be good enough :-).

--
Tom

--- End Message ---
--- Begin Message ---
was just wondering if the statement:
if(!$name || !$comments){
/*whatever here*/ }

would be interpreted as : if either $name or $comments doesn't exist then....

or how would the if statement be?? i need to check if the $name and $comments are 
empty/null because both $name and $comments are required to continue in the site (to 
make a post)..


--- End Message ---
--- Begin Message --- Andy B wrote:
was just wondering if the statement:
if(!$name || !$comments){
/*whatever here*/ }

would be interpreted as : if either $name or $comments doesn't exist then....

or how would the if statement be?? i need to check if the $name and $comments are empty/null because both $name and $comments are required to continue in the site (to make a post)..



although that'll generally "work", why not use


if(empty($name) || empty($comments))
{ dosomething(); }

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
> although that'll generally "work", why not use
>
> if(empty($name) || empty($comments))
> { dosomething(); }
>
> -- 
> ---John Holmes...


because for some odd reason on any of the versions of php i am writing for
(4.0.6-4.1.3) it always fails

--- End Message ---
--- Begin Message ---
Hello, Andy!
You wrote  on Mon, 22 Mar 2004 22:59:02 -0500:

 AB> was just wondering if the statement:
 AB> if(!$name || !$comments){
 AB> /*whatever here*/ }

 AB> would be interpreted as : if either $name or $comments doesn't exist
 AB> then....

 AB> or how would the if statement be?? i need to check if the $name and
 AB> $comments are empty/null because both $name and $comments are
 AB> required to continue in the site (to make a post)..
Maybe?..

if (!isset($name) || !isset($comments))
{
     /*whatever here*/
}

--- End Message ---
--- Begin Message ---
Hi all, I'm newbie in PHP.


I found message when I connect to ORACLE. Here you are :

Warning: odbc_connect(): SQL error: [Oracle][ODBC][Ora]ORA-12154: TNS:could not resolve service name , SQL state 08004 in SQLConnect in c:\program files\apache group\apache\htdocs\connectdb.php on line 2

and here is my PHP script:

<?
$connect = odbc_connect("trial", "TRY", "mine");

$query = "SELECT cust_vendor_id, cv_name FROM dbsoe.cust_vendor where
cv_name like 'ANU%'";


?>

But when I connect using another Database Explorer through the same ODBC, it works. user id and password are correct. I've checked it. Can you tell me why ?

thanks a million. Timotius
===========================================================================================
Netkuis Instan untuk Divre 3 - SD,SMP,SMA berhadiah asuransi pendidikan puluhan juta rupiah... periode I dimulai 1 April 2004
===========================================================================================

--- End Message ---
--- Begin Message ---
Hi there, ok i am asking now, but be assured that I have googled already. I
am looking for a good customisable ticketing system in PHP, i had a look at
request tracker, but it doesnt look customisable and its in Perl.

I am trying to find if there are solutions to what we want before i go and
build it from scratch, let me know thanks.

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

I am using deskpro. see http://www.deskpro.com

It's written in PHP, but it is not cheap. From my brief experience I would
have to say however that it certainly seems to be worth it.

Such a sophisticated ticketing system would take a very significant amount
of time to build from scratch.

HTH


<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi there, ok i am asking now, but be assured that I have googled already.
I
> am looking for a good customisable ticketing system in PHP, i had a look
at
> request tracker, but it doesnt look customisable and its in Perl.
>
> I am trying to find if there are solutions to what we want before i go and
> build it from scratch, let me know thanks.

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

 Here i am facing one problem. i have installed the following in my pc in 
linux platform. i am getting this error when try to execute file. Can any 
one tell me why this error due to ?


Version :
mysql-3.32.41-1
php-4.2.2-17
apache httpd-2.0.40-21

Error :
Call to undefined function mysql_connect() on line no 6.

Regards,
Uma

--- End Message ---
--- Begin Message ---
T,

You also need to load the php_mysql rpm (Assuming you loaded via rpm)

Till We Meet Again...

Clifford W. Hansen
Operations Support Developer
Aspivia (Pty) Ltd.

+27 (0) 11 259-1150 (Switchboard)
+27 (0) 11 259-1019 (Fax)
+27 (0) 83 761-0240 (Mobile)
[EMAIL PROTECTED] (EMail)
http://chansen.aspivia.com (Web)

Registered Linux user number 343424 on http://counter.li.org/

"We have seen strange things today!" Luke 5:26

This message contains information intended for the perusal, and/or use (if
so stated), of the stated addressee(s) only. The information is confidential
and privileged. If you are not an intended recipient, do not peruse, use,
disseminate, distribute, copy or in any manner rely upon the information
contained in this message (directly or indirectly). The sender and/or the
entity represented by the sender shall not be held accountable in the event
that this prohibition is disregarded.

If you receive this message in error, notify the sender immediately by
e-mail, fax or telephone and return and/or destroy the original message.

The views or representations contained in this message, whether express or
implied, are those of the sender only, unless that sender expressly states
them to be the views or representations of an entity or person, who shall be
named by the sender and who the sender shall state to represent. No
liability shall otherwise attach to any other entity or person.

--- End Message ---
--- Begin Message ---
The bug server looks like its down, so I will just post the bug here, and
hopefully someone
will spot it

PHP version: 5RC1

<?php
   interface Foo {
      const MY_FOO = "hello world";
 }
class Bar implements Foo  {
    public function displayFoo(){
       print MY_FOO;
    }
}
$obj = new Bar;
  $obj->displayFoo();
?>

The results should display "hello world", but it prints out MY_FOO.

Thanks

Jakes

--- End Message ---
--- Begin Message ---
[snip]
<?php
   interface Foo {
      const MY_FOO = "hello world";
 }
class Bar implements Foo  {
    public function displayFoo(){
       print MY_FOO;
    }
}
$obj = new Bar;
  $obj->displayFoo();
?>

The results should display "hello world", but it prints out MY_FOO.
[/snip]


This is not a bug, but a misunderstanding of constants. You have not
defined the constant....

define("MY_FOO", "hello world.");

http://us4.php.net/constants

--- End Message ---
--- Begin Message --- I'm writing a script that does image manipulation, and trying to take some of the images I use in an imagecopy() out of the filesystem as images, and put them directly in the php file as strings assigned to variables. Of course, they're binary so they garbledygook everything if they're not converted, so I want to convert them with base64_encode. To test this I have a test script that makes me think that this may be impossible, and that there may be a weird bug somewhere in this php version. Weird thing is, the string works ok if it's read with fread or imagecreatefrompng, and then directly output with imagepng. However, if this data is encoded with base64_encode as $x1, and $x1 is then decoded as $x2 with base64_decode, imagecreatefrompng($x2) hangs (php produces no output it seems, none either from code prior to imagecreatefrompng() ), even if the script determines that all these values are identical (with the === operator and strcmp() ) on scriptruns when the critical line imagecreatefrompng($whatever) is commented out.

Sample: (run on 4.3.4)

 if (is_file($filename)) {
  $fd = @fopen($filename,"r");
  $image_string = fread($fd,filesize($filename));
  $image2 = base64_encode($image_string);
  $image3 = base64_decode($image2);
//  echo strcmp($image_string, $image3);             commented line 0
  if($image_string <> $image3) die('not equal');
//  if($image_string === $image3) die('same type');  commented line 1
  if(!$image3) die('none');
//  echo 'got here';                                  2
  $im = imagecreatefromstring($image3);
//$im = imagecreatefromstring($image_string);         3
//  echo 'and here';                                  4
  imagePNG($im, 'thisimage.png');
//  echo 'and here';                                  5
  header('Content-type: image/png');
  imagePNG($im);
  imagedestroy($im);
  fclose($fd);
}

when commented line 0 is uncommented, the script outputs 0, output for strcmp in cases of equality. and 1 makes the script die('same type'). When commented line 3 is uncommented and the line before it commented out, the script works fine. When the commented echo lines are uncommented (when the script uses imagecreatefromstring($image3)), php seems to produce no output.

I'd greatly appreciate any advise on getting the image source into the php file itself, and on why this is behaving so oddly. Also: is this likely to be more load-intensive than just reading in the image files with imagecreatefrompng or fopen?

Thanks,
James Coder

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

Im wondering if anyone can help me with this "problem"

I have a form with the following line of code;

$message .= "<a href=\"http://127.0.0.1/devsite/activate.php?member=$realname&hash=$initPass\";>Click here to activate</a>\n";

What I actually get is the following output;

<a href=ttp://127.0.0.1/devsite/activate.php?member=Steven Mac Intyre&hash95aea7a8aee0fdcc90d7e9893c75bb3">Click here to activate</a>

You will see it is missing the "h" out of http and the "=" out of hash= ... also the first charactor of the hash variable is missing.

Has anyone else seen this ? Know how to fix it ?

PLEASE HELP

Steven
--- End Message ---
--- Begin Message ---
Make sure that your header function as it set to send html mail

"Steven Mac Intye" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all,
>
> Im wondering if anyone can help me with this "problem"
>
> I have a form with the following line of code;
>
> $message .= "<a
>
href=\"http://127.0.0.1/devsite/activate.php?member=$realname&hash=$initPass
\">Click
> here to activate</a>\n";
>
> What I actually get is the following output;
>
> <a href=ttp://127.0.0.1/devsite/activate.php?member=Steven Mac
> Intyre&hash95aea7a8aee0fdcc90d7e9893c75bb3">Click here to activate</a>
>
> You will see it is missing the "h" out of http and the "=" out of hash=
> ... also the first charactor of the hash variable is missing.
>
> Has anyone else seen this ? Know how to fix it ?
>
> PLEASE HELP
>
> Steven

--- End Message ---
--- Begin Message --- hehe,

Thanks ... I got it

I replaced my content type with the following:

Content-Type: text/html; charset=iso-8859-15

Now it works perfectly :))

Thanks all


Steven Mac Intye wrote:


Hi Ray,

Nope... this is what it outputs now.

activate.php?member=Steven+Mac+Intyre&hash95aea7a8aee0fdcc90d7e9893c75bb3

It simply adds "+" to the name ...


Ray Leach wrote:


On Tue, 2004-03-23 at 11:12, Steven Mac Intye wrote:

erm ... it is also removing the first charactor of the hash.

The correct hash is: 395aea7a8aee0fdcc90d7e9893c75bb3

PLEASE HELP

Steven Mac Intye wrote:


Hi all,

Please help me.

I have the following line in my code;

$message .= "<a href=\"http://127.0.0.1/devsite/activate.php?member=$realname&hash=$initPass\";>Click here to activate</a>\n";


Try using urlencode to encode the values for member and hash.


But if I recieve the email, i get the following output;

<a href=ttp://127.0.0.1/devsite/activate.php?member=Steven Mac Intyre&hash95aea7a8aee0fdcc90d7e9893c75bb3">Click here to activate</a>

You will see that it is missing the "h" on http and the = just after hash ...

Any idea's ?


--- To unsubscribe: send the line "unsubscribe glug-chat" in the subject of a mail to "[EMAIL PROTECTED]". Problems? Email "[EMAIL PROTECTED]". Archives are at http://www.linux.org.za/Lists-Archives/




--- To unsubscribe: send the line "unsubscribe glug-chat" in the subject of a mail to "[EMAIL PROTECTED]". Problems? Email "[EMAIL PROTECTED]". Archives are at http://www.linux.org.za/Lists-Archives/

---
To unsubscribe: send the line "unsubscribe glug-chat" in the
subject of a mail to "[EMAIL PROTECTED]".
Problems? Email "[EMAIL PROTECTED]". Archives are at
http://www.linux.org.za/Lists-Archives/




--- End Message ---
--- Begin Message --- Hi all

I am having problems printing members of an array that has two dimensions and am wondering if someone can help me with the syntax required to do this.

If i have the follwing code:
<?php
$test=array('test1'=>'a','test2'=>'b');
print "$test[test1]";
?>

I get 'a' echoed to the screen as expected. But if i make the array 2 dimensional like this:

<?php
$test[0]=array('test1'=>'a','test2'=>'b');
print "$test[0][test1]";
?>

I would expect to get 'a' echoed to the screen again but instead i get this:
Array[test1].

Has anyone seen this before and can help or point me to some goods docs on it?

Thanks in advance for any help

Cheers

Bob
--- End Message ---
--- Begin Message --- Just found the answer so please disregard this.


Cheers


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

Tuesday, March 23, 2004, 8:03:05 PM, you wrote:
BP> Hi all

BP> I am having problems printing members of an array that has two 
BP> dimensions and am wondering if someone can help me with the syntax
BP> required to do this.

BP> If i have the follwing code:
BP> <?php
BP> $test=array('test1'=>'a','test2'=>'b');
BP> print "$test[test1]";
?>>

BP> I get 'a' echoed to the screen as expected. But if i make the array 2
BP> dimensional like this:

BP> <?php
BP> $test[0]=array('test1'=>'a','test2'=>'b');
BP> print "$test[0][test1]";
?>>

BP> I would expect to get 'a' echoed to the screen again but instead i get this:
BP> Array[test1].

BP> Has anyone seen this before and can help or point me to some goods docs
BP> on it?

BP> Thanks in advance for any help

BP> Cheers

BP> Bob


You don't need the outside quotes just

print $test[0]['test1']

( Note test1 needs the quotes )

If you need to output other stuff then use the . operator like

print 'Value = '.$test[0]['test1'].'<br>';

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
Hi all

I know this is not a Javascript mailling list, and I do apologies. 

I someone could please help me a url or an email, this would be most appreciated.

I would like to have a yes \ no prompt displayed and depending on which  button is 
pressed
take the right course of action.

Kind Regards and thank you

Brent Clark

--- End Message ---
--- Begin Message ---
Hi,
I discover a surprising thing with PHPSESSID, I try something like this
: 

$var="htmldoc -t html --quiet ''
'https://login:[EMAIL 
PROTECTED]/file.php?documentIdent=157&typeAffiche=3&PHPSESSID=068dd351a106bb6ead80e11a27f75100'";
echo 'var='.$var;
passthru($var);


passthru is waiting for and don't give the result.

In the other hand, if I use an other word than PHPSESSID it works. It
seems to be a security constraint, how can I do to forcing PHP to use it
?


Thanks Nicolas

--- End Message ---
--- Begin Message ---
How do I change a string to a float, when the string may be in this format :
4,999.90 , or this format: 4999,90 (european style)


--
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039 ext 214
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
      http://www.destinia.com

--- End Message ---
--- Begin Message ---
[snip]
How do I change a string to a float, when the string may be in this
format :
4,999.90 , or this format: 4999,90 (european style)
[/snip]

http://us4.php.net/settype

--- End Message ---
--- Begin Message ---
[snip]
(no theories please. unless it's correct. in which case it's ok. :)
[/snip]

ROFLMFAO! If it is correct then it is no longer theory! Sorry Chris,
maybe I should go lay down.

--- End Message ---

Reply via email to