php-general Digest 9 Feb 2003 15:07:01 -0000 Issue 1873

Topics (messages 134933 through 134947):

Class Interfaces
        134933 by: Laborda
        134940 by: Justin Garrett
        134947 by: rush

Re: How to uncompress PHP
        134934 by: David T-G

Data Structures
        134935 by: Laborda
        134938 by: Justin Garrett
        134946 by: Ernest E Vogelsinger

Re: Why does this happen?
        134936 by: Jason k Larson
        134945 by: Ernest E Vogelsinger

how to move database from one server to another
        134937 by: Sunfire
        134939 by: Kevin Waterson

incromenting $counter in a whloop
        134941 by: Sunfire
        134942 by: Jason Wong
        134943 by: John W. Holmes

multiple file upload, yet again
        134944 by: David T-G

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

I have a question.. Does PHP have support for Class Interfaces declaration?
What in Java would be:

public interface MyInterface {
    final String aString = "Str";
    final String oString = "String";
    void aFunction(String inter, double face);
}

? If not, how can I do this?.. Thanks a lot.

Laborda.-

--- End Message ---
--- Begin Message ---
Nope.  You're stuck with straight single inheritance for now.

Justin Garrett

"Laborda" <[EMAIL PROTECTED]> wrote in message
005201c2cfe9$47c704b0$ad629c40@galaxy">news:005201c2cfe9$47c704b0$ad629c40@galaxy...
>
> Hello,
>
> I have a question.. Does PHP have support for Class Interfaces
declaration?
> What in Java would be:
>
> public interface MyInterface {
>     final String aString = "Str";
>     final String oString = "String";
>     void aFunction(String inter, double face);
> }
>
> ? If not, how can I do this?.. Thanks a lot.
>
> Laborda.-
>


--- End Message ---
--- Begin Message ---
"Laborda" <[EMAIL PROTECTED]> wrote in message
005201c2cfe9$47c704b0$ad629c40@galaxy">news:005201c2cfe9$47c704b0$ad629c40@galaxy...
>
> Hello,
>
> I have a question.. Does PHP have support for Class Interfaces
declaration?
> What in Java would be:
>
> ? If not, how can I do this?.. Thanks a lot.

Well, interfaces are needed in Java since it is a statically typed language.
For dynamically typed language like php there is no need for it. If you
would like to do it just for the documentation sake, than write abstract
class like:

class pehro_interface {
function a1() {}
function a2() {}
function a3() {}
}


rush
--
http://www.templatetamer.com/



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

...and then ?$BNS?(B ?$B7C72?(B said...
% 
% Hi, I am Lin.

Hello!


% 
% When I execute a command
% 
% gzip -d php-4_3_0_tar.gz
% 
% on the linux. The system show the following error.
% 
% gzip: php-4_3_0_tar.gz: not in gzip format
% 
% How can I uncompress this file.

Sounds like it isn't compressed, no matter what the extension says.  What
does

  file php-4_3_0_tar.gz

tell you?  And what if you just run tar on it, without any z flag?


HTH & HAND

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: msg96295/pgp00000.pgp
Description: PGP signature

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

Does anyone know where can I find information about data structures
implemented in PHP. I need to find something about Linked Lists, implemented
in PHP.. If anyone has any info, I'd appreciate it. I've tried to google it
out but I can't find anything. Thanks.

Laborda.-

--- End Message ---
--- Begin Message ---
You'd create a linked list in PHP just like you would in most languages,
however IMHO it's best just to stick with PHP arrays.  They grow dynamically
and are so easy to work with.

There is an ADT extension scheduled for PHP5
http://www.php.net/~sterling/adt/

Justin Garrett

"Laborda" <[EMAIL PROTECTED]> wrote in message
007501c2cfed$777f1090$ad629c40@galaxy">news:007501c2cfed$777f1090$ad629c40@galaxy...
> Hello,
>
> Does anyone know where can I find information about data structures
> implemented in PHP. I need to find something about Linked Lists,
implemented
> in PHP.. If anyone has any info, I'd appreciate it. I've tried to google
it
> out but I can't find anything. Thanks.
>
> Laborda.-
>


--- End Message ---
--- Begin Message ---
At 04:43 09.02.2003, Laborda said:
--------------------[snip]--------------------
>Does anyone know where can I find information about data structures
>implemented in PHP. I need to find something about Linked Lists, implemented
>in PHP.. If anyone has any info, I'd appreciate it. I've tried to google it
>out but I can't find anything. Thanks.
--------------------[snip]-------------------- 

As another poster already pointed out associative arrays may be one way to
go /although there are multiple solutions to linked lists, as in many
languages).

However there is one caveat you absolutely need to observe: in PHP there
are NO POINTERS. "Normally" assigning variables of any type will create a
copy of the variable. like this:

    $a1 = array(1,2,3);
    $a2 = $a1;

Here, $a2 is a COPY of $a1:
    $a2[3] = 4;
    echo join(',',$a1), ' - ', join(',',$a2);

will produce
    1,2,3 - 1,2,3,4

OTOH, you may use REFERENCES:
    $a2 =& $a1;
    $a2[3] = 4;
    echo join(',',$a1), ' - ', join(',',$a2);
will now produce
    1,2,3,4 - 1,2,3,4

This said, using array entries for linked lists, you must absolutely make
sure to always use references, not simple assignments.

Assuming a "structure" built as PHP array (unfortunately there's no such
thing as a typedef):

    $start = array('prev' => null, 'next' => null, 'data' => 'First entry');
    $elem  = array('prev' => &$start, 'next' => null, 'data' => 'Second
entry');
    $start['next'] =& $elem;

You get the picture, I believe. Just make sure the "pointers" are actually
references to the list elements, or everything will break up.

HTH,


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message --- Because all of your field names are overwriting each other until the last one wins.

name="date"

This needs to be different for each field so PHP can assign that name as the variable.

HTH,
Jason k Larson


CF High wrote:
Hey all.

Got a problem with I'm sure a simple solution::

In this test form when I submit and insert into my db, only the last select
field get entered; i.e. in this case the day value of 25.

<form name="form1" method="post" action="">

Year
<select name="date" onSelect="return check_submit()">
    <option selected value=2002>2002</option>
</select>

Month
<select name="date">
    <option selected value=12>12</option>
</select>

Day
<select name="date">
    <option selected value=25>25</option>
</select>

<input type="submit" name="textfield">

</form>

Why does this happen?  In Cold Fusion I'm able to refer to the three selects
as #date# and it returns 20021225 as expected.

Any ideas?

Thanks,

--Noah


--

--- End Message ---
--- Begin Message ---
At 04:52 09.02.2003, CF High said:
--------------------[snip]--------------------
>In this test form when I submit and insert into my db, only the last select
>field get entered; i.e. in this case the day value of 25.
>
><form name="form1" method="post" action="">
>
>Year
><select name="date" onSelect="return check_submit()">
>    <option selected value=2002>2002</option>
></select>
>
>Month
><select name="date">
>    <option selected value=12>12</option>
></select>
>
>Day
><select name="date">
>    <option selected value=25>25</option>
></select>
>
><input type="submit" name="textfield">
>
></form>
>
>Why does this happen?  In Cold Fusion I'm able to refer to the three selects
>as #date# and it returns 20021225 as expected.
--------------------[snip]-------------------- 

I don't know much about CF, but in plain HTML as you show here you have 3
different form input (select) fields sharing the same name. Thus the
browser will transmit only one of the three input (select) fields upon
submit (it is undefined which field will be sent, but most browsers will
transmit the last value).

Maybe CF fiddles around with the element names, PHP doesn't. You could e.g.
format the 3 elements to transmit an array, something like this:

<form name="form1" method="post" action="">
Year 
<select name="date[Y]" onSelect="return check_submit()"> 
<option selected value=2002>2002</option> 
</select>
Month 
<select name="date[M]"> 
<option selected value=12>12</option> 
</select>
Day 
<select name="date[D]"> 
<option selected value=25>25</option> 
</select>
<input type="submit" name="textfield">
</form>

In your receiving script you would have an associative array named "date"
in the $_REQUEST structure:

$date_received = $_REQUEST['date'];
$year = $date_received['Y'];
$month = $date_received['M'];
$day = $date_received['D'];

HTH,


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
hi...

couldnt find anything on the list archive about this (maybe i missed it but
my internet explorer crashed before i could find it_)

how do you copy a database from a server over to another.. do all i need to
do is copy the tables over to the sql server after i make the db? or is it
more involved than that..


tnx



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003

--- End Message ---
--- Begin Message ---
This one time, at band camp,
"Sunfire" <[EMAIL PROTECTED]> wrote:
 
> how do you copy a database from a server over to another.. do all i need to
> do is copy the tables over to the sql server after i make the db? or is it
> more involved than that..

assuming you are using MySQL....

mysqldump [dbname] > dbname.sql -u [db_username] -p

This will give you a file called dbname.sql. On the second machine you use this
file to create the second db...

mysqladmin create db_two -u [db2_username] -p

mysql db_two < dbname.sql -u [db_two] -p

hope this helps
Kevin

-- 
 ______                              
(_____ \                             
 _____) )  ____   ____   ____   ____ 
|  ____/  / _  ) / _  | / ___) / _  )
| |      ( (/ / ( ( | |( (___ ( (/ / 
|_|       \____) \_||_| \____) \____)
Kevin Waterson
Port Macquarie, Australia
--- End Message ---
--- Begin Message ---
hi..

was wondering how you would incroment $counter in a while loop.. i want to
print it out next to each record for a record counter on a web page...





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003

--- End Message ---
--- Begin Message ---
On Sunday 09 February 2003 13:37, Sunfire wrote:
> hi..
>
> was wondering how you would incroment $counter in a while loop.. i want to
> print it out next to each record for a record counter on a web page...

manual > "Language reference" > "Expressions"

That should give you enough inspiration.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Schizophrenia beats being alone.
*/

--- End Message ---
--- Begin Message ---
> was wondering how you would incroment $counter in a while loop.. i
want to
> print it out next to each record for a record counter on a web page...

while(whatever)
{
  $counter++;
  echo "You are on loop #$counter"; 
}

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/


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

I realize that this has probably been beaten to death, and I've watched
with some excitement the recent crop of discussions of multiple file
uploads, but only to be disappointed.

I've read in detail the archives and seen countless statements that one
cannot upload multiple files in one selection, requiring instead that you
have multiple input boxes and then a single submit button if you want.
I've also see, however, a few mentions of a script or a class that *do*
allow you to select multiple files in the browse window and make
reference to hotmail multiple attachment uploads.

Does anyone know how to do this?  I would like for my users to be able to
select their files in one swell foop, perhaps even "all in the directory",
rather than having to click repeatedly for each file to upload.

I even tried making myself a hotmail account so I could send myself mail
and try to upload multiple files and then look at the HTML source :-) but
the server had some problem or other and I couldn't get set up.  Well, I
didn't really want an account anyway.


TIA & HAND

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: msg96295/pgp00001.pgp
Description: PGP signature

--- End Message ---

Reply via email to