php-general Digest 13 Apr 2005 15:38:43 -0000 Issue 3395

Topics (messages 212982 through 213014):

Re: HELP!
        212982 by: Stephen Johnson

image display
        212983 by: Cima
        212985 by: Petar Nedyalkov

error handling
        212984 by: Cima
        212986 by: Petar Nedyalkov
        212989 by: Stephen March

Re: Defined constant in mysql_query  -  Question.
        212987 by: Petar Nedyalkov

Index of /base-1.1
        212988 by: Mark Sargent
        212996 by: David Robley
        213001 by: Mark Sargent

Problem with recorset
        212990 by: kioto

User Management
        212991 by: Dasmeet Singh
        212994 by: angelo.zlogic.co.za
        212997 by: Dasmeet Singh
        212998 by: Stephen March
        212999 by: Satyam
        213000 by: Dasmeet Singh
        213008 by: chris
        213013 by: aznFETISH

How get words on a webpage
        212992 by: Ken

php SMPP
        212993 by: kyriacos sakkas

Re: ld returned 1 exit status, make: *** [sapi/cli/php] Error   1
        212995 by: Marek Kilimajer

Re: Drop down list - persistant value
        213002 by: Peter H. Lemieux

Selectively Extract Sub-Array from an Array
        213003 by: Tom Rawson

OT - Blank subject lines!!!
        213004 by: Miles Thompson

Re: HELP! HELP !
        213005 by: chris

Re: scripting workflow
        213006 by: chris

Re: [NOVICE] error handling
        213007 by: John DeSoi

trying to load mysql extensions
        213009 by: Ross
        213011 by: Greg Donald

PHP 4 to PHP 5 Migration shortcut
        213010 by: Vishal Kashyap . [SaiHertz]

database querying form in php
        213012 by: babu

uploading files
        213014 by: marc serra

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Yes -- 

In your example - $result_id  would be accessed on page2 as

$result_id = $_GET['result_id'];

Then through out your script on page 2 you could access $result_id.

Hope that helps.


æ-- 
åæçäå- $result_id æèçååé2

$result_id = $_get['result_id ' ];

çåééåæçåæäååé2 æèèå $result_idã

åæååã

<?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: çæä <[EMAIL PROTECTED]>
> Date: Wed, 13 Apr 2005 11:00:36 +0800
> To: <php-general@lists.php.net>
> Subject: [PHP] HELP!
> 
> HI,
> 
> Any body give me any hinder I would be very appreciated!
> 
> I want to use a parameter of fist page in the second page, how can I realize
> it.
> 
> For example, there is a segment in the first page:
> 
> â<tr>
> 
> <td>com</td><td><a
> href='/cgi-bin/english/E_new_domain_list.cgi?domainType=1'><? echo
> $num_com;?></a></td>
> 
> <td><a href="autorenew.php?$result_id = 1"><? echo
> $buy_com_num;?></a></td>
> 
> </tr>â
> 
> But I wan  to use the parameter  â$result_idâ in the second
> page(autorenew.php) :
> 
> âswitch($result_id){
> 
> case "1" :
> 
>  ââ..;
> 
>  Break;
> 
> case "2" :
> 
>  ââ..;
> 
>  Break;
> 
> Can the parameter â$result_idâ pass from fist page to second
> page(autorenew.php)?
> 
> Sincerely yours,
> 
> justin
> 
>        E-mail/MSN: [EMAIL PROTECTED]
> 
> 
> 
> 

--- End Message ---
--- Begin Message ---
hi,

what is the best way to display an image, that is stored in a database in
postgres, in a table form along with other fields that are in the same
table?

postgresql 8.0
e.g my_table(name varchar(15),sex character (1), picture_id oid)

in a table in php, i'd like to show all the rows in my_table with all the
fields including the picture.

thanx.

--- End Message ---
--- Begin Message ---
On Wednesday 13 April 2005 09:11, Cima wrote:
> hi,
>
> what is the best way to display an image, that is stored in a database in
> postgres, in a table form along with other fields that are in the same
> table?
>
> postgresql 8.0
> e.g my_table(name varchar(15),sex character (1), picture_id oid)
>
> in a table in php, i'd like to show all the rows in my_table with all the
> fields including the picture.

You'll have to write a separate php script that sends an image MIME type, 
reads the image from the pgsql database and sends it to the client. 

You can't use a single script since the images in a browser are loaded by 
separate http requests and the MIME type of the web page (text/html) is 
different from the MIME type of the image (image/jpeg, image/gif, image/png 
etc.).

>
> thanx.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436

Attachment: pgpL4J4MbcZXA.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
hi,

im working with php 4 and postgresql 8 and i would like to know how to
handle certain errors generated. in postgresql,  i've written a stored
function that selects a record from a table and in case no record is found i
'raise an exception'. fine, now in my php script  i call that the stored
function which works properly when there is a record but when the record
doesnt exist, i would like to be able to place my own error message and not
e.g  'fatal error, .....'. how do i capture(in php)  the exception i raised
in postgres so that i know the record doesnt exist?


thanx.

--- End Message ---
--- Begin Message ---
On Wednesday 13 April 2005 08:46, Cima wrote:
> hi,
>
> im working with php 4 and postgresql 8 and i would like to know how to
> handle certain errors generated. in postgresql,  i've written a stored
> function that selects a record from a table and in case no record is found
> i 'raise an exception'. fine, now in my php script  i call that the stored
> function which works properly when there is a record but when the record
> doesnt exist, i would like to be able to place my own error message and not
> e.g  'fatal error, .....'. how do i capture(in php)  the exception i raised
> in postgres so that i know the record doesnt exist?

Possible scenarios are:

1. Use string parsing to recognise the error message.
2. Upgrade to PHP 5, which is not that good if you need to change a lot of 
code afterwards.

>
>
> thanx.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436

Attachment: pgpalilWfeD3Z.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Personally, I create a custom error handler for all my apps (currently 4.3.*
compliant).  While I normally use Smarty and have separate error templates,
here is a quick example.

    function errorHandler($errno, $errstr, $errfile, $errline )
    {
        print "Error #: $errno <br/>Error Message: $error_Message";
    }  

    set_error_handler("errorHandler");

    call_some_pgsql_function();


-----Original Message-----
From: Cima [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 12, 2005 11:46 PM
To: php
Subject: [PHP] error handling

hi,

im working with php 4 and postgresql 8 and i would like to know how to
handle certain errors generated. in postgresql,  i've written a stored
function that selects a record from a table and in case no record is found i
'raise an exception'. fine, now in my php script  i call that the stored
function which works properly when there is a record but when the record
doesnt exist, i would like to be able to place my own error message and not
e.g  'fatal error, .....'. how do i capture(in php)  the exception i raised
in postgres so that i know the record doesnt exist?


thanx.

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


--- End Message ---
--- Begin Message ---
On Wednesday 13 April 2005 04:37, Labunski wrote:
> Hi,
> Can I use Constant in mysql query like this:
>
>
> define("LANG", "eng");
> mysql_query("SELECT * FROM data WHERE col = 'articles' ORDER BY
> subjectLANG");

You can use:

 mysql_query("SELECT * FROM data WHERE col = 'articles' ORDER BY 
subject".LANG);
>
>
> Thanks a LOT,
> Lab.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436

Attachment: pgpPdMkeOhZNq.pgp
Description: PGP signature


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

typing localhost/bse-1.1 gives me access, but, in this format,


Index of /base-1.1

Icon Name <http://localhost/base-1.1/?C=N;O=D> Last modified <http://localhost/base-1.1/?C=M;O=A> Size <http://localhost/base-1.1/?C=S;O=A> Description <http://localhost/base-1.1/?C=D;O=A>
------------------------------------------------------------------------
[DIR] Parent Directory <http://localhost/> - [DIR] admin/ <http://localhost/base-1.1/admin/> 04-Apr-2005 05:27 - [ ] base_ag_common.php <http://localhost/base-1.1/base_ag_common.php> 04-Apr-2005 05:26 3.5K

a listing of the dir, which, I guess, is not too good. What have I done wrong here..?
Cheers.

Mark Sargent.
--- End Message ---
--- Begin Message ---
Mark Sargent wrote:

> Hi All,
> 
> typing localhost/bse-1.1 gives me access, but, in this format,
> 
> 
>  Index of /base-1.1
> 
> Icon  Name <http://localhost/base-1.1/?C=N;O=D>                    Last
> modified <http://localhost/base-1.1/?C=M;O=A>      Size
> <http://localhost/base-1.1/?C=S;O=A>  Description
> <http://localhost/base-1.1/?C=D;O=A>
> ------------------------------------------------------------------------
> [DIR] Parent Directory <http://localhost/>
> -   [DIR] admin/ <http://localhost/base-1.1/admin/>
> 04-Apr-2005 05:27    -   [   ] base_ag_common.php
> <http://localhost/base-1.1/base_ag_common.php>      04-Apr-2005 05:26 
> 3.5K
>  
> a listing of the dir, which, I guess, is not too good. What have I done
> wrong here..?

Forgotten to add appropriate information for DirectoryIndex in your Apache
configuration maybe?


David

--- End Message ---
--- Begin Message ---
David Robley wrote:

Mark Sargent wrote:



Hi All,

typing localhost/bse-1.1 gives me access, but, in this format,


Index of /base-1.1

Icon Name <http://localhost/base-1.1/?C=N;O=D> Last
modified <http://localhost/base-1.1/?C=M;O=A> Size
<http://localhost/base-1.1/?C=S;O=A> Description
<http://localhost/base-1.1/?C=D;O=A>
------------------------------------------------------------------------
[DIR] Parent Directory <http://localhost/>
- [DIR] admin/ <http://localhost/base-1.1/admin/>
04-Apr-2005 05:27 - [ ] base_ag_common.php
<http://localhost/base-1.1/base_ag_common.php> 04-Apr-2005 05:26 3.5K

a listing of the dir, which, I guess, is not too good. What have I done
wrong here..?



Forgotten to add appropriate information for DirectoryIndex in your Apache configuration maybe?


David



Hi All,

thanx, David, will check tomorrow at work. Cheers.

Mark Sargent.
--- End Message ---
--- Begin Message ---
Hi all sorry for the newbie's question but i want understand the problem.
I have use a simple command with sqlite to get a data from a table.

$dbFile = realpath("./")."/data.db";

$db = sqlite_open($dbFile);

if (!(is_resource($db))) {
die("Impossibile aprire uno stream: ".
sqlite_error_string(sqlite_last_error($db)));
}

$query = "SELECT id, file, time FROM file";

$res = sqlite_unbuffered_query($db, $query);

while (list($id, $file, $time) = sqlite_fetch_array($res)) {
echo $id.$file.$time."\n";
} I i want use a OOP to get a data from a a table i get for every execution
of loop while the first record.

include("./classdb.php");

class DbData extends SqliteDbConnect
{
       function GetQueryResult($query)
       {
               $res = sqlite_unbuffered_query($this->dbLink, $query);
               return $rows = sqlite_fetch_array($res);
       }

}


$db =& new DbData("./", "data.db");

$query = "SELECT id, filem time FROM file";

while (list($id, $file, $time) = $db->GetQueryResult($query)) {
echo $id.$file.$time."\n"; }

I have tested the script with CLI on PHP4/Win.
Thanks so much to all.

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

I am developing an applicaton in PHP where different users would have different permissions and access to different functions/pages of website. Now whats the best way to do tht?

One way I can think of is keep all permissions in a table and divide everyting on site into functions..and when every function is called, check whether thecurrent user has permission to particular function..

But this method looks quiet complicated..is ther any other way to do this?

Also if you can give me some links to articles/tutorials on user/levels management in PHP, it would be really helpful..

Thanks in advance
--- End Message ---
--- Begin Message ---

use an include file at the top of each page.
in this include file you will check to see whether that user has access 
to see that page, if they dont then just redirect to the main menu page 
or an error page.

hope this helps

Angelo Zanetti
Z Logic

www.zlogic.co.za

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

--- End Message ---
--- Begin Message ---
Thanks..

And how to manage user and their permissions.. should I store each page name in a table and then store permissions of each and every user to individual pages in another table?

Is there any other way to do this?


[EMAIL PROTECTED] wrote:


use an include file at the top of each page.
in this include file you will check to see whether that user has access to see that page, if they dont then just redirect to the main menu page or an error page.

hope this helps

Angelo Zanetti
Z Logic

www.zlogic.co.za

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

--- End Message ---
--- Begin Message ---
This is one of the many reasons I've been using Fusebox for the past few
years.  http://www.fusebox.org

It's an open sourced framework that provides you with an interesting way to
do includes, to break your application out into MVC (Model View Controller)
and allows you to provide a better granular security. You then control the
users permissions to a series of circuits and fuses (much like folders and
functions) - rather than to specific code pages.

For my purposes I find it more beneficial to diagram out my UML Use Cases (A
user will do 'x', whereas an administrator will do 'y').  Eventually you
will need a mechanism to store that information - whether it be a MySQL
table or a directory server accessible via LDAP.

I generally try to develop a table for roles (or groups), for users,
permissions.  Assign the permissions to the roles, and assign a user to
role.

I haven't found an "easy" solution per-se, but this is effective for me.

Cheers,
~Stephen March, CIS, BSc



-----Original Message-----
From: Dasmeet Singh [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 13, 2005 4:15 AM
To: php-general@lists.php.net; [EMAIL PROTECTED]
Subject: Re: [PHP] User Management

Thanks..

And how to manage user and their permissions.. should I store each page 
name in a table and then store permissions of each and every user to 
individual pages in another table?

Is there any other way to do this?


[EMAIL PROTECTED] wrote:

> 
> use an include file at the top of each page.
> in this include file you will check to see whether that user has access 
> to see that page, if they dont then just redirect to the main menu page 
> or an error page.
> 
> hope this helps
> 
> Angelo Zanetti
> Z Logic
> 
> www.zlogic.co.za
> 
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.

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

--- End Message ---
--- Begin Message ---
One of the most flexible ways to do this is to have one table with each user 
information, then a table of groups and group members.  Users, per se, don't 
have permissions, they acquire them from the groups they belong to, it is 
easier that way than to assign permissions to each individual user, you just 
have a group of, say, administrators, receptionists, cashiers, purchasing, 
whatever and then assign people to one or more groups.

Then, you can have a third level which allows you to assign permissions to 
each group.  As I said, you may have this level or not.

Then, in each page you can say which group can use it (if you didn't use the 
third level) or which permission is required to see it.

Satyam


"Dasmeet Singh" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Thanks..
>
> And how to manage user and their permissions.. should I store each page 
> name in a table and then store permissions of each and every user to 
> individual pages in another table?
>
> Is there any other way to do this?
>
>
> [EMAIL PROTECTED] wrote:
>
>>
>> use an include file at the top of each page.
>> in this include file you will check to see whether that user has access 
>> to see that page, if they dont then just redirect to the main menu page 
>> or an error page.
>>
>> hope this helps
>>
>> Angelo Zanetti
>> Z Logic
>>
>> www.zlogic.co.za
>>
>> ----------------------------------------------------------------
>> This message was sent using IMP, the Internet Messaging Program. 

--- End Message ---
--- Begin Message --- Thanks I checked fusebox.. its really nice and interesting.. Still I wasnt able to find anything related to managing users on its site..

or I have to seperately built a user authentication system?

Stephen March wrote:

This is one of the many reasons I've been using Fusebox for the past few
years.  http://www.fusebox.org

It's an open sourced framework that provides you with an interesting way to
do includes, to break your application out into MVC (Model View Controller)
and allows you to provide a better granular security. You then control the
users permissions to a series of circuits and fuses (much like folders and
functions) - rather than to specific code pages.

For my purposes I find it more beneficial to diagram out my UML Use Cases (A
user will do 'x', whereas an administrator will do 'y').  Eventually you
will need a mechanism to store that information - whether it be a MySQL
table or a directory server accessible via LDAP.

I generally try to develop a table for roles (or groups), for users,
permissions.  Assign the permissions to the roles, and assign a user to
role.

I haven't found an "easy" solution per-se, but this is effective for me.

Cheers,
~Stephen March, CIS, BSc



-----Original Message-----
From: Dasmeet Singh [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 13, 2005 4:15 AM
To: php-general@lists.php.net; [EMAIL PROTECTED]
Subject: Re: [PHP] User Management

Thanks..

And how to manage user and their permissions.. should I store each page name in a table and then store permissions of each and every user to individual pages in another table?

Is there any other way to do this?


[EMAIL PROTECTED] wrote:


use an include file at the top of each page.
in this include file you will check to see whether that user has access to see that page, if they dont then just redirect to the main menu page or an error page.

hope this helps

Angelo Zanetti
Z Logic

www.zlogic.co.za

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



--- End Message ---
--- Begin Message ---
Use an $_SESSION array variable to contain the pages they can access.

"Dasmeet Singh" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi!
>
> I am developing an applicaton in PHP where different users would have 
> different permissions and access to different functions/pages of website. 
> Now whats the best way to do tht?
>
> One way I can think of is keep all permissions in a table and divide 
> everyting on site into functions..and when every function is called, check 
> whether thecurrent user has permission to particular function..
>
> But this method looks quiet complicated..is ther any other way to do this?
>
> Also if you can give me some links to articles/tutorials on user/levels 
> management in PHP, it would be really helpful..
>
> Thanks in advance 

--- End Message ---
--- Begin Message ---
I use something like this the numbers 1,2,3,4 are an array of member group 
ID's so it checks the users session to see if they are a member to one of 
those groups

$_product_id = array(1,2,3,4);
require_once("/home/blah/public_html/members/plugins/protect/php_include/check.inc.php");

<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
>
> use an include file at the top of each page.
> in this include file you will check to see whether that user has access
> to see that page, if they dont then just redirect to the main menu page
> or an error page.
>
> hope this helps
>
> Angelo Zanetti
> Z Logic
>
> www.zlogic.co.za
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program. 

--- End Message ---
--- Begin Message ---
On 4/13/05, issin <[EMAIL PROTECTED]> wrote:
> Ken,
> 
>         Echo and printf can't get words on other webpage. I want get words,
> no only show.
>         Thanks!
> 
> Issin
> 
> -----Original Message-----
> From: Ken [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 12, 2005 3:16 PM
> To: issin
> Subject: Re: [PHP] How get words on a webpage
> 
> Man....
> 
> one thing: RTFM
> 
> http://www.php.net/echo/
> http://www.php.net/printf/
> 
> On Apr 12, 2005 9:07 AM, issin <[EMAIL PROTECTED]> wrote:
> > Dear all,
> >
> >            I want get words include "today ****** tonight" on
> > www.XXX.com/index.html, and then show on my webpage.
> >
> >            Please advise, thanks!
> >
> > issin
> >
> > ________ Information from NOD32 ________
> > This message was checked by NOD32 Antivirus System for Linux Mail Server.
> > http://www.nod32.com
> >
> >
> 
> ________ Information from NOD32 ________
> This message was checked by NOD32 Antivirus System for Linux Mail Server.
> http://www.nod32.com
> 

ahhh! I get your drift now.
you can do so by using fopen

$fp = fopen("http://www.XXX.com/index.html";, r);
$contents = fread($fp, 10000000);
fclose($fp);'

then use string functions or regexp to search $contents for what you want.

HTH.

Ken

--- End Message ---
--- Begin Message ---
Hi all,
        Just wondering if anybody has had experience using SMPP with php. I
have used the one available class that has limited functionality for
sending simple messages, but would like to do a little bit more
(concatenated messages over 170 chars.).
        Ipworks has some libraries, but I have not been able to compile the php
side of them (keep getting compilation errors for on file), so now I am
stuck.
        Any pointers to existing scripts, or advice on how to create SMPP pdu's
manually will be very appreciated.
        
thanks
        Kyriacos
-- 
Kyriacos Sakkas  Netsmart Development Team
Tel: + 357 22 452565  Fax: + 357 22 452566
kyriacos(at)netsmart.com.cy http://www.netsmart.com.cy
Taking Business to a New Level!

--- End Message ---
--- Begin Message --- Mark Sargent wrote:
Mark Sargent wrote:

Hi All,

keep getting this error with make on Fedora 3, home machine. Successfully installed on work FC3 machine earlier today. I did make twice, to no avail, and then redid the configure then another make, with the same results.

collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

Let me know if you need me to post more info from the make. Cheers.

php=5.0.3
apache=2.0.53 (apache installed fine)

Mark Sargent.

Hi All,

php-5.0.4 installed without a hitch..oh well, can't really complain
about that, now can I..? cheers.

Great, but next time post more output from the make command. The message says only that linking failed, the reason was above it.
--- End Message ---
--- Begin Message ---
I use a function to create select boxes:

function make_select($fieldname,$options,$selected,$opt="") {

        # make a select box with option text $opt
        # $fieldname = name of html field
        # $options = associative array of select options
        # $selected = field key of selected item
        # $opt = optional attributes, e.g., styles, etc.

        $output.="\n<select name=\"$fieldname\" $opt >";

        foreach ($options as $key=>$val) {

            $output.="\n<option value=\"$key\"";
            if ($key==$selected) {
                $output.=" selected";
            }
            $output.=">$val";
        }

        $output.="\n</select>\n";
        return $output;

}

By passing the previously selected item as $selected it will automatically reselect the chosen item. For instance,

<?php echo make_select("myfield",$options,$_POST["myfield"]) ?>


I've written similar functions for check boxes and radio buttons. They've made form creation and handling enormously easier.

Peter


Jacques wrote:
I am using PHP. I have a registration page where the user has to select his country form a drop down list. If the username that the user selected for himself exists in the database I am sending him back to the registration form with all the fields completed with the values he previously entered. This is easy to do for a textfield but how do I indicate on the drop down list which country he originally selected?

Please help.

Jacques


--- End Message ---
--- Begin Message ---
On PHP 4.3.x ... (not using PHP 5)

Say I have two arrays, the first has keys 'key1' ... 'key20'.  The 
second has some other keys with different names (i.e. they do not 
overlap those in the first array).  I want to add certain elements from 
array1 to array2.  I can do it like this:

        $array2['key3'] = $array1['key3'];
        $array2['key8'] = $array1['key8'];
        $array2['key17'] = $array1['key17'];

or like this:

        $array2 += array('key3' => $array1['key3'], 'key8' => $array1['key8'],
                'key17' => $array1['key17']);

What would be nicer is something like:

        $array2 += array_select($array1, 'key3', 'key8', 'key17');

In other words ... a way to create an array that is a selected subset 
of another.

Is there a function that does this that I'm missing?  I realize I could 
write one but I was looking for something built-in.  Nothing I can see 
under array functions in the manual seems to do it.

Thanks,

--
Tom

--- End Message ---
--- Begin Message --- I assume others are seeing these as well - infrequent postings with blank subject lines. Always throws me for a bit of a loop, forcing a "pause and adjust".

For those replying to them, or hijacking them, please stop.

Regards - Miles Thompson

PS Truly Canadian - note the "please"! /mt


--- End Message ---
--- Begin Message ---
Read in the manual about the $_GET variable

"Justin Joe" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
>
>
>
> HI,
>
> Any body give me any hinder I would be very appreciated!
>
> I want to use a parameter of the second page in the first page, how can I
> realize it.
>
> For example, there is a segment in the first page:
>
> "<tr>
>
>  <td>com</td><td><a
> href='/cgi-bin/english/E_new_domain_list.cgi?domainType=1'><? echo
> $num_com;?></a></td>
>
>  <td><a href="autorenew.php?$result_id = 1"><? echo
> $buy_com_num;?></a></td>
>
> </tr>"
>
> But I want to use the parameter  "$result_id" which in the second
> page(autorenew.php) :
>
>  "switch($result_id){
>
>  case "1" :
>
>   ....;
>
>   Break;
>
> case "2" :
>
>   ....;
>
>   Break;
>
> Can the parameter "$result_id" pass from the second page(autorennew.php) 
> to
> the first page?
>
> Sincerely yours,
>
> justin
>
>         E-mail/MSN: [EMAIL PROTECTED]
>
>
>
> 

--- End Message ---
--- Begin Message ---
I hand code everything I do in php. I separate functions and class in 
referenced files that are grouped by function in the site(i.e. - all queries 
are in queries.php, the db connection is done in dbconn.php, etc...). This 
will allow a project to grow without having to rewrite everything. Also 
debugging is easy. If you know a query is failing, open the queries.php 
file.

The structure I use is to build the entire page as a variable, usually 
called $page, that I print after it has been completed. So from the html 
doctype tag to the closing html tag I simply append to one variable and 
print.

CJ


"DuSTiN KRySaK" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I just have a few questions regarding workflow when producing scripts.
>
> First off, do people prefer to have all their code in one file? Or 
> multiple separate files? I know functions and classes are good to keep in 
> separate files, but i am talking about say for example a news system, etc.
>
> Next off, how about when actually assembling the files? Do you produce all 
> of your html output, then say build all of your functions - then say build 
> the logic?
>
> Does that make sense?
>
> I had in the past use DW for building php apps, and as an exercise to 
> myself I am forcing myself to hand code to learn better. But I do however 
> want to increase my productivity.
>
> If anyone has any pointers on this type of stuff - it would be much 
> appreciated!
>
> Thanks!
>
> d 

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

On Apr 13, 2005, at 1:46 AM, Cima wrote:

im working with php 4 and postgresql 8 and i would like to know how to
handle certain errors generated. in postgresql, i've written a stored
function that selects a record from a table and in case no record is found i
'raise an exception'. fine, now in my php script i call that the stored
function which works properly when there is a record but when the record
doesnt exist, i would like to be able to place my own error message and not
e.g 'fatal error, .....'. how do i capture(in php) the exception i raised
in postgres so that i know the record doesnt exist?


You don't say what php library you are using, but perhaps this is what you need:

http://www.php.net/manual/en/function.pg-result-error.php

The only problem with using raise exception for this is that I don't think there is a way for you to assign an error code so you end up parsing a string. This is bad if you want to work in multiple languages. If PostgreSQL is going to generate an error anyway, you might want to let it do that since it should return an error code. See also

http://www.php.net/manual/en/function.pg-result-error-field.php


John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL

--- End Message ---
--- Begin Message ---
I get the following warning when trying to load this extension. (php_mssql)


PHP Warning: PHP Startup: Unable to load dynamic library 
'c:\PHP\ext\php_msql.dll'

(All the other extensions load ok.)


I am runnning php5 with IIS 5.1 and mysqlserver 4.1. The server works fine 
and mysql server is running ok.

Ross 

--- End Message ---
--- Begin Message ---
On 4/13/05, Ross <[EMAIL PROTECTED]> wrote:
> I get the following warning when trying to load this extension. (php_mssql)
> 
> PHP Warning: PHP Startup: Unable to load dynamic library
> 'c:\PHP\ext\php_msql.dll'
> 
> (All the other extensions load ok.)
> 
> I am runnning php5 with IIS 5.1 and mysqlserver 4.1. The server works fine
> and mysql server is running ok.


Check your php.ini and make sure c:\PHP\ext is included in your
extension_dir paths.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

--- End Message ---
--- Begin Message ---
Dear PHP enlightened ,

I was planning to move my PHP 4.3.x based product t PHP 5.x and for
this I was looking for some kinda shortcut scripts or utility to
migrate the 4.3.x file to PHP 5.x .
Any pointers would be appreaciated.

-- 
With Best Regards,
Vishal Kashyap.
Lead Software Developer,
http://saihertz.com,
http://vishalkashyap.tk

--- End Message ---
--- Begin Message ---
HI,

I ilke to create user interface for a group of people for entering the queries 
and to see the results in a browser. The users have the knowledge of database. 
for example: the users will have a login check, and if successful they will see 
a window where they can enter the sql queries and can see the results.I also 
want to implement a history of queries where the user can use it when ever 
needed.
i have done the user authentication part. But i do not get an idea how the User 
interface can be?
I have seen PhpMyadmin.its nice , but lillte bit complex for me as i also need 
some code to know how it implemented.
can some one please point to some examples or so.

Thanks
babu


Send instant messages to your online friends http://uk.messenger.yahoo.com 

--- End Message ---
--- Begin Message --- Hi, i want to create a form to upload a file on a server. My problem is that i want to check the filesize before sending it because if the filesize is superior than 2 MB it failed and i don't want to wait for a long time for uploading a file that will fail.

Can you please give me a solution to check the filesize.

Marc.
--- End Message ---

Reply via email to