php-general Digest 2 May 2004 10:48:04 -0000 Issue 2739

Topics (messages 185111 through 185135):

Sorting text with multibyte characters
        185111 by: Michal Migurski
        185114 by: Red Wingate
        185117 by: Michal Migurski

- Delete records in an Access DB
        185112 by: francesco.automationsoft.biz
        185113 by: Torsten Roehr

Re: Select from 24 tables
        185115 by: Richard A. DeVenezia
        185116 by: Michal Migurski
        185119 by: Travis Low
        185122 by: Michal Migurski
        185124 by: Travis Low
        185125 by: Curt Zirzow

php user management functionality
        185118 by: bruce
        185121 by: Travis Low

Re: reversing an IF statement
        185120 by: Curt Zirzow

Re: Php & MySql selection question
        185123 by: Curt Zirzow

Re: creating a mailing list
        185126 by: Manuel Lemos
        185128 by: Curt Zirzow

Re: Installing sendmail in win9X/Me
        185127 by: Manuel Lemos

Re: Batch/Prepared statements for Mysql in PHP
        185129 by: Curt Zirzow

String Question
        185130 by: Dave Carrera

Frage
        185131 by: Draw-A-Line
        185133 by: Jordi Canals

[Newbie Guide] For the benefit of new members
        185132 by: Ma Siva Kumar

Re: https & sessions failing to persist
        185134 by: Jordi Canals

Numeric Index of an array
        185135 by: Natascha Chrobok

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

Does anyone have any thoughts on how to effectively sort text with
multi byte characters? I am working on a project that uses lots of German
text, and the letters with umlauts don't sort correctly. I'm using the
mb_* functions in a few places (to adapt an ASCII-encoded database to XML
output for flash, which is always expected to be in UTF-8), but none of
them seems to be made for string comparison.

thanks,
-mike.

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

--- End Message ---
--- Begin Message ---
Run into this before, PHP seams to do quite well when you set the locale
right ( de_DE ) which will place AÄBCD.... instead of ABCD....ÄÖÜ.

Hope this helps :-)

-- red

Michal Migurski wrote:

Hi,

Does anyone have any thoughts on how to effectively sort text with
multi byte characters? I am working on a project that uses lots of German
text, and the letters with umlauts don't sort correctly. I'm using the
mb_* functions in a few places (to adapt an ASCII-encoded database to XML
output for flash, which is always expected to be in UTF-8), but none of
them seems to be made for string comparison.

thanks,
-mike.

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

--- End Message ---
--- Begin Message ---
> Run into this before, PHP seams to do quite well when you set the locale
> right ( de_DE ) which will place AÄBCD.... instead of ABCD....ÄÖÜ.
>
> Hope this helps :-)

Thanks, I hadn't thought of that.

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

--- End Message ---
--- Begin Message ---
Hi all, 
I have this problem:
I want to delete records in an Access DB. I use this code:

$query="DELETE FROM Test_Table WHERE name='franco';"; 
// the connection parameters

$path="d:/inetpub/webs/my_site/mdb-database/" ;

$db_name="test.mdb" ;

$dsource=$path.$db_name ;

$cn_string="Provider=Microsoft.Jet.OLEDB.4.0;" ;

$cn_string.="Data Source=$dsource;" ;

// connection

$cn=new COM("ADODB.Connection");

$cn->open($cn_string);

// object Recordset and send query by  Open() metod

$rs=new COM("ADODB.Recordset") ;

$rs->open($query,$cn) ;

// clean Recordset object

$rs->Release() ;

$rs=null ;

/* close connection */

$cn->Close() ;

$cn->Release() ;

$cn=null ;



but I have this error message:

Fatal error: Call to undefined function: open() in 
D:\Inetpub\webs\metagenonlinecom\canc.php on line 11


Where is the problem? Is this the correct way to delete records from an Access DB? If 
this is a bad tecnic, can you suggest me what is the correct way?

Thanks in advance to all.

(The server where this script run is a Microsoft server).

Francesco  






--- End Message ---
--- Begin Message ---
So the problem is not the delete statement but that you cannot even open a
connection, right? Have you tried PHP's ODBC functions to connect to the
Access DB?:

http://de.php.net/manual/en/function.odbc-connect.php

There are some user comments regarding Access - maybe this helps.

Regards, Torsten


<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi all,
I have this problem:
I want to delete records in an Access DB. I use this code:

$query="DELETE FROM Test_Table WHERE name='franco';";
// the connection parameters

$path="d:/inetpub/webs/my_site/mdb-database/" ;

$db_name="test.mdb" ;

$dsource=$path.$db_name ;

$cn_string="Provider=Microsoft.Jet.OLEDB.4.0;" ;

$cn_string.="Data Source=$dsource;" ;

// connection

$cn=new COM("ADODB.Connection");

$cn->open($cn_string);

// object Recordset and send query by  Open() metod

$rs=new COM("ADODB.Recordset") ;

$rs->open($query,$cn) ;

// clean Recordset object

$rs->Release() ;

$rs=null ;

/* close connection */

$cn->Close() ;

$cn->Release() ;

$cn=null ;



but I have this error message:

Fatal error: Call to undefined function: open() in
D:\Inetpub\webs\metagenonlinecom\canc.php on line 11


Where is the problem? Is this the correct way to delete records from an
Access DB? If this is a bad tecnic, can you suggest me what is the correct
way?

Thanks in advance to all.

(The server where this script run is a Microsoft server).

Francesco

--- End Message ---
--- Begin Message ---
Dave Carrera wrote:
> Hi List,
>
> How do I select data from 24 table in my database.
>
> Each one is identical in structure layout being
>
> Id,name,list
>
> I want to select where like $_POST[var] from a form all of the tables
> but I am having trouble :(
>
> I thought making a var string like
>
> $string = "table1,table2,table3,.....";
>
> And doing
>
> (select * from $string where list like \"%$_POST[var]%\");
>
> Would work but I get a MySql error which say "Column: 'list' in where
> clause is ambiguous"
>
> I am stumped so I ask the list for help or advise please.
>
> Any advise is very much appreciated and I thank you in advance for
> any help or pointers.
>
> Thank you
>
> Dave C

Try constructing a query that looks like this...

select 't1' as source, t1.* from t1 where t1.list like "$criteria"
union
select 't2' as source, t2.* from t2 where t2.list like "$criteria"
union
select 't3' as source, t3.* from t3 where t3.list like "$criteria"
union
...
select 't24' as source, t24.* from t24 where t24.list like "$criteria"
;


This query can be created by
1. storing all the table names in an array
2. constructing the individual select portion using array_map()
3. combining all individual selects using join($selects, 'union')


-- 
Richard A. DeVenezia

--- End Message ---
--- Begin Message ---
> This isn't always desirable, or even possible.  I once designed a
> database to hold characteristics for a series of 70 different tests.
> There were about 50 different characteristics used in various
> combinations for each test.  Each characteristic could be one of many
> values.  So the characteristics tables all looked like this:
>
>    id, name, value
>
> And the test tables looked like this:
>
>    id, name, value

In my experience, it's usually a safe assumption that if you have a bunch
of tables all structured identically and used in similar ways, you should
probably merge them all into a single table with an extra column that
corresponds to whatever differentiating characteristic used to distinguish
your original tables.

I.e., go with John Holmes' suggestion before you're really up the creek.

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

--- End Message ---
--- Begin Message --- Michal Migurski wrote:
In my experience, it's usually a safe assumption that if you have a bunch
of tables all structured identically and used in similar ways, you should
probably merge them all into a single table with an extra column that
corresponds to whatever differentiating characteristic used to distinguish
your original tables.

I.e., go with John Holmes' suggestion before you're really up the creek.

Up what creek? You didn't really provide any technical justification for your suggestion.


In my experience, the best way to deliver a quality application is to start with a fully-normalized database schema, then de-normalize it slightly here and there if performance is really a problem. But I've rarely had to do that. In most cases, an upgrade to a faster server with more memory solves the problem more quickly and cheaply than an application re-write would.

On the other hand, I've been called in many times to deal with application problems that arise from using "mashed-together" schemas such as the one you propose.

John W. Holmes wrote:
> The first thing you need to do is reorganize your database schema and
> put all of this into one table. You can see what a pain it is having 24
> similar tables already and it's only going to get worse.

The "pain" only occurs when writing the SQL statements to join the tables. I don't think it's a good idea to optimize the database schema for the sake of the programmer, who only has to write the SQL one time. Later, when the customer wants to fix bugs, or add enhancements, the pain is far greater. That's usually when I get called in, long after the original programmer has flown the coop.

The only times I ever purposely deliver denormalized applications such as you suggest are when the customers are asking for quick-and-dirty stopgap solutions. Then it makes sense to optimize for the application writer. However, I have found that stopgap solutions have a way of becoming permanent. These days, I usually turn down such jobs.

cheers,

Travis

--
Travis Low
<mailto:[EMAIL PROTECTED]>
<http://www.dawnstar.com>

--- End Message ---
--- Begin Message ---
> Up what creek?  You didn't really provide any technical justification
> for your suggestion.

Up the creek of having to call for help on php-general because you have 24
identical tables you need to join, having never performed a join before.

> The "pain" only occurs when writing the SQL statements to join the
> tables.  I don't think it's a good idea to optimize the database schema
> for the sake of the programmer, who only has to write the SQL one time.

I wholeheartedly disagree. :) I think that optimizing for the sake of the
programmer, the bug fixer, and the possible inheritor of the project is a
/great/ idea. Servers keep getting faster, while the human attention span
and rate of familiarization with code stays approximately constant, so
optimizing your development time is at least as sensible as optimizing SQL
select performance, which is probably better handled through well-chosen
indexes anyway.

Optimizing for the programmer usually translates into thinking about the
humans who will need to interpret your code, and making it easy to pick up
the gist of your intent. A 24-table join is not a typical characteristic
of what I'd consider a well-planned DB schema, whose meaning can be
quickly grokked by a newcomer to the project.

If all those 24 tables store the same kind of data, then there's no reason
to split them up. Of course, we haven't seen the specific usage of those
tables in this thread, but I'm basing my posts on the assumption that it's
better for the OP to have a "marbles" table with a "color"  column, than
tables named "red_marbles", "blue_marbles", 'green_marbles,"  etc. If
that's not the kind of data we're talking about, then I stand corrected,
and John Nichel's initial response is all that's needed.

A huge table count is often evidence of a need for some refactoring.

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

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

Getting back to the original posting, I'm basically saying that I don't think it's a good idea to structure or restructure a database for the sake of simplifying a few SQL statements. Especially if the data being joined is in separate tables for a good reason.

Regarding optimizing for programmer/bug-fixer/etc, after thinking about it, I realized that what constitutes "optimization" really depends a lot on your development situation, so I'll refrain from further comments on that. I probably shouldn't have brought it up, sorry.

cheers,

Travis

Michal Migurski wrote:
Up what creek?  You didn't really provide any technical justification
for your suggestion.


Up the creek of having to call for help on php-general because you have 24
identical tables you need to join, having never performed a join before.


The "pain" only occurs when writing the SQL statements to join the
tables.  I don't think it's a good idea to optimize the database schema
for the sake of the programmer, who only has to write the SQL one time.


I wholeheartedly disagree. :) I think that optimizing for the sake of the
programmer, the bug fixer, and the possible inheritor of the project is a
/great/ idea. Servers keep getting faster, while the human attention span
and rate of familiarization with code stays approximately constant, so
optimizing your development time is at least as sensible as optimizing SQL
select performance, which is probably better handled through well-chosen
indexes anyway.

Optimizing for the programmer usually translates into thinking about the
humans who will need to interpret your code, and making it easy to pick up
the gist of your intent. A 24-table join is not a typical characteristic
of what I'd consider a well-planned DB schema, whose meaning can be
quickly grokked by a newcomer to the project.

If all those 24 tables store the same kind of data, then there's no reason
to split them up. Of course, we haven't seen the specific usage of those
tables in this thread, but I'm basing my posts on the assumption that it's
better for the OP to have a "marbles" table with a "color"  column, than
tables named "red_marbles", "blue_marbles", 'green_marbles,"  etc. If
that's not the kind of data we're talking about, then I stand corrected,
and John Nichel's initial response is all that's needed.

A huge table count is often evidence of a need for some refactoring.

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





-- Travis Low <mailto:[EMAIL PROTECTED]> <http://www.dawnstar.com>

--- End Message ---
--- Begin Message ---
* Thus wrote Travis Low ([EMAIL PROTECTED]):
> Hi Michal,
> 
> Getting back to the original posting, I'm basically saying that I don't 
> think it's a good idea to structure or restructure a database for the sake 
> of simplifying a few SQL statements.  Especially if the data being joined 
> is in separate tables for a good reason.

The problem is that we're not talking about normalization in this
case. The OT post is using 24 tables for each letter of the
alphabet (Dont ask me how that number was derived.) So each table
represents the same exact scructure.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
hey....

doing some basic research... has anyone found a seriously good user
management script (preferably free) that can be incorporated within a web
application.

i'm looking for something that allows for the following functions:
 - user registration/login
 - admin function
 - group/team definition
 - email verification
 - database driven (mysql/postgres)
 - ability to grant user multiple rights/access levels
 - ability to check/deny by IP Address
 - session based function
 - page security
 - linux/apache/php

we've seen a few, but nothing that really grabs us.... we're considering
taking something like phpbb/gforge and just ripping the login/admin function
out, although we'd prefer another approach.... but if we have to rip the
functionality out of another app, has anybody seen an app (open source/free)
that has a serious login/admin/user management function that we should look
at...

thanks

bruce
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message --- I wrote a job-tracking/workflow management application called Willow Job Tracker. You can download a copy of the free GPL version from here:

http://dawnstar.com/index.php?display=ProductDetails&id=780

And there's a demo here:

http://dawnstar.com/wjtf/

Login to the demo using admin/admin.

Currently, only the MySQL DB is supported, but you can add support for other databases by implementing the Db.class.php for each database.

Also, there are no provisions for denying based on IP, but you could add that pretty easily. Though I question the utility of that, since so many people live behind firewalls.

As for user registration, you'd have to clone the Add User page to make a Registration page, but that should be pretty easy too.

Other than that, I think it has everything you listed. You'd have to rip out the job tracking stuff, but frankly, you could just remove the links and leave the code. There is also extensive documentation to help you get started with your customizations.

Have fun.

cheers,

Travis


bruce wrote:
hey....

doing some basic research... has anyone found a seriously good user
management script (preferably free) that can be incorporated within a web
application.

i'm looking for something that allows for the following functions:
 - user registration/login
 - admin function
 - group/team definition
 - email verification
 - database driven (mysql/postgres)
 - ability to grant user multiple rights/access levels
 - ability to check/deny by IP Address
 - session based function
 - page security
 - linux/apache/php

we've seen a few, but nothing that really grabs us.... we're considering
taking something like phpbb/gforge and just ripping the login/admin function
out, although we'd prefer another approach.... but if we have to rip the
functionality out of another app, has anybody seen an app (open source/free)
that has a serious login/admin/user management function that we should look
at...

thanks

bruce
[EMAIL PROTECTED]


-- Travis Low <mailto:[EMAIL PROTECTED]> <http://www.dawnstar.com>

--- End Message ---
--- Begin Message ---
* Thus wrote Kim Steinhaug ([EMAIL PROTECTED]):
> Often I end up using a "dumb" IF statement which to me seems that
> it could have been done some other way.
> 
> Example :
> if(
>     ($_GET["id"]==1) or
>     ($_GET["mode"]=="home") or
>     ((!isset($_GET["item"])) && ($_GET["mode"]=="news"))

For starters, don't intermatch 'OR' with &&, the have different
precedence's and can lead to unexpected behaviour. The proper 'OR'
that should be used is ||. see: http://php.net/operators

Here is an approach I use to avoid making the if statement real
complicated and kinda makes it more understandable what you are
trying to accomplish with the condition:

$is_ok = $_GET["id"]  == 1 ||
         $_GET["mode"] == "home" ||
         (!isset($_GET["item"]) && $_GET["mode"] == "news"));

if (! is_ok ) {
  // yada...
}


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
* Thus wrote Dave Carrera ([EMAIL PROTECTED]):
> Hi List,
> 
> I am trying to make a search box for my site and I ask the list how can I
> search 24 tables to find a search string posted by a form.

oohh.. ouch ;)

> 
> I get Column: 'listing' in where clause is ambiguous when I run 
> 
> $sql = mysql_query("select * from $tbs where listing like
> \"$_POST[tglstring]\"") or die(mysql_error());
>       
> $tbs is a string containing 24 table names (1 for each letter of the
> alphabet).

You cant search tables like that and get back what your expecting.
If you have two tables say:

  create table t1 {
    id int,
    name  varchar(50)
  )
  create table t2 {
    id int,
    name  varchar(50)
  )


If you select from both of those tables like:
  select * from t1, t2

The field list returned from mysql will be:
  id, name, id, name

And If you add a condition to the sql statement:
  select * from t1, t2 where name like 'foo%'

Mysql complains about ambiguous column, because It has no idea from
which table you want 'name' to be like. And even if you did tell it
what tables too look at:

  select * from t1, t2 where t1.name like 'foo%' or t2.name like
  'foo%'

Your data is going to be all messed up anyway. You can use a UNION
statment to fix this problem or restructure your data so you dont
have this problem, the later being prefered method.

You should get on the mysql mailing list. I think i've already said
to much about mysql.

Curt.
-- 
"I used to think I was indecisive, but now I'm not so sure."

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

On 04/29/2004 06:44 AM, Chris O'Shea wrote:
I have a list of email addresses in mySQL from people who have signed up on
my site and I want to use PHP to email out to the list.

My initial thought was to go through the loop, sending an email to each
person, but then I saw this somewhere:

"It is worth noting that the mail() function is not suitable for larger
volumes of email in a loop.

This function opens and closes an SMTP socket for each email... not very
efficient."

This is a myth. SMTP connections for queueing only happen with mail() under Windows. Under Unix/Linux you can always configure your local mailer, eventually in php.ini to just queue the message for later delivery. This is what is recommended for mass mailing with PHP mail function, unless your local mailer is qmail. In that case you do not need to configure anything because qmail never attempts to deliver message immediately.



Does anybody know the best way of doing a mass mail through php?

mail() function is just fine in most cases.



Also, do you know how php mail() handles bounced emails? Ideally I'd like to
either receive them or use a script to record then.

It depends on your environment. For an OS independent solution, you may want to try this class that lets you specify the bounce address using the Return-Path header. Keep in mind that just specifying the Return-Path address to the mail() function does not do anything. This class just does some magic to figure how to set the bounce address depending on your environment.


http://www.phpclasses.org/mimemessage


--


Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--- End Message ---
--- Begin Message ---
* Thus wrote Manuel Lemos ([EMAIL PROTECTED]):
> Hello,
> 
> On 04/29/2004 06:44 AM, Chris O'Shea wrote:
> 
> >Does anybody know the best way of doing a mass mail through php?
> 
> mail() function is just fine in most cases.

imo, php should refuse mass mailing ;)

> 
> >Also, do you know how php mail() handles bounced emails? Ideally I'd like 
> >to
> >either receive them or use a script to record then.
> 
> It depends on your environment. For an OS independent solution, you may 
> want to try this class that lets you specify the bounce address using 
> the Return-Path header. Keep in mind that just specifying the 
> Return-Path address to the mail() function does not do anything. This 
> class just does some magic to figure how to set the bounce address 
> depending on your environment.

There is also the Errors-To: header that can be added, most smtp
server will honor that header, if not they will look at the
envelope address to send the errors to.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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

On 04/30/2004 02:05 PM, Helmut Kemper wrote:
I need install sendmail in windows 9X/Me for use mail() command.

PHP work only in localhost which active site server (similar to apache) and send mail by proxy network.

PHP never uses sendmail under Windows. Sendmail support is only available with PHP on Unix/Linux. You need to connfigure PHP to use your network SMTP server.


You may also try for instance this class that comes with sub-class specialized in deliverying via SMTP. It comes with a wrapper function named smtp_mail() that works exactly as the mail() function but lets you configure additional parameters like SMTP authentication if you need it:

http://www.phpclasses.org/mimemessage

You will also need this:

http://www.phpclasses.org/smtpclass



--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--- End Message ---
--- Begin Message ---
* Thus wrote electroteque ([EMAIL PROTECTED]):
> I was wondering if there is any current API for creating match/prepare
> statements, therefore say i have a script to insert, update and insert in
> the same post, is there a way to reduce to many queries to the database to
> do it all in one hit ? Although i usually return the last inc id then add it
> to the second query ?

It sounds like you need procedural sql statements. you need to ask
someone on the mysql list or use a database that already supports
that.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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

How would I show 100 chars after finding the first instance of a searched
word in a string.

So I have a string of which I search for the first instance of "hello" and
display from there 100 more chars.

My output word then be something like:

 hello and show the next 100 chars...

Thank you in advance for any help or advice given.

Dave C

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.672 / Virus Database: 434 - Release Date: 28/04/2004
 

--- End Message ---
--- Begin Message ---
Hallo,
ich hoffe mir kann jemand bei folgendem Problem helfen. Habe ein Formular
erstellt und darin ist ein „file field“ eingebettet zum Hochladen von
Dateien (z.B. Word-Dokumente). Habe den Zusatz  enctype="multipart/form-data
“ in das form tag eingefügt und an ein php-Script zur Auswertung geschickt.
Im php-Script habe ich die hochgeladene Datei aus dem temp-Verzeichnis des
Server auf ein Verzeichnis innerhalb meiner Web site  mit em Befehl
move_uploaded_file (move_uploaded_file($_FILES['Dokument']['tmp_name'],
$uploaddir . $_FILES['Dokument']['name']) umgeleitet. Wie kann ich die
hochgeladene Datei direkt vom Formular aus als Attachment an meine Email
senden – wie es mit den restlichen Daten des Formulars passiert? Geht das
auch über die mail() Funktion?
Klaus

Klaus Steinkuhl
www.Draw-a-Line.com
Web and Graphic Design

--- End Message ---
--- Begin Message --- Draw-A-Line wrote:
Hallo,
ich hoffe mir kann jemand bei folgendem Problem helfen. Habe ein Formular
erstellt und darin ist ein „file field“ eingebettet zum Hochladen von
Dateien (z.B. Word-Dokumente). Habe den Zusatz  enctype="multipart/form-data
“ in das form tag eingefügt und an ein php-Script zur Auswertung geschickt.
Im php-Script habe ich die hochgeladene Datei aus dem temp-Verzeichnis des
Server auf ein Verzeichnis innerhalb meiner Web site  mit em Befehl
move_uploaded_file (move_uploaded_file($_FILES['Dokument']['tmp_name'],
$uploaddir . $_FILES['Dokument']['name']) umgeleitet. Wie kann ich die
hochgeladene Datei direkt vom Formular aus als Attachment an meine Email
senden – wie es mit den restlichen Daten des Formulars passiert? Geht das
auch über die mail() Funktion?
Klaus

Klaus Steinkuhl
www.Draw-a-Line.com
Web and Graphic Design


Klaus,


If you write in English, we will understand your question, and perhaps somebody could help you ...

Regards,
Jordi.

--- End Message ---
--- Begin Message ---
=======================================
This message is for the benefit of new 
subscribers and those new to PHP.  Please 
feel free to add more points and send to the 
list.
=======================================
1. If you have any queries/problems about PHP 
try http://www.php.net/manual/en first. You 
can download a copy and use it offline also. 

Please also try 
http://www.php.net/manual/faq.php 
for answers to frequently answered questions 
about PHP (added by Christophe Chisogne).

2. Try http://www.google.com next. Searching 
for "php YOUR QUERY" may fetch you relevant 
information within the first 10 results.

3. There is a searchable archive of the 
mailing list discussion at 
http://phparch.com/mailinglists. Many of the 
common topics are discussed repeatedly, and 
you may get answer to your query from the 
earlier discussions. 

For example: One of the repeatedly discussed 
question in the list is "Best PHP editor". 
Everyone has his/her favourite editor. 
You can get all the opinions by going through 
the list archives. If you want a chosen list 
try this link : 
http://phpeditors.linuxbackup.co.uk/ 
(contributed by Christophe Chisogne).

4. Not sure if PHP is working or you want 
find out what extensions are available to 
you?

Just put the following code into a file with 
a .php extension and access it through your 
webserver:

<?php
        phpinfo();
?> 

If PHP is installed you will see a page with 
a lot of information on it. If PHP is not 
installed (or not working correctly) your 
browser will try to download the file.

(contributed by Teren and reworded by Chris W 
Parker)

5. If you are stuck with a script and do not 
understand what is wrong, instead of posting 
the whole script, try doing some research 
yourself. One useful trick is to print 
the variable/sql query using print or echo 
command and check whether you get what you 
expected. 

After diagnosing the problem, send the 
details of your efforts (following steps 1, 
2 & 3) and ask for help.

6. PHP is a server side scripting language. 
Whatever processing PHP does takes place 
BEFORE the output reaches the client. 
Therefore, it is not possible to access 
users'  computer related information (OS, 
screen size etc) using PHP. Nor can you 
modify any the user side settings. You need 
to go for JavaScript and ask the question in 
a JavaScript list.

On the other hand, you can access the 
information that is SENT by the user's 
browser when a client requests a page from 
your server. You can find details about 
browser, OS etc as reported by 
this request. - contributed by Wouter van 
Vliet and reworded by Chris W Parker.

7. Provide a clear descriptive subject line. 
Avoid general subjects like "Help!!", "A 
Question" etc.  Especially avoid blank 
subjects. 

8. When you want to start a new topic, open a 
new mail composer and enter the mailing list 
address [EMAIL PROTECTED] instead of 
replying to an existing thread and replacing 
the subject and body with your message.

9. It's always a good idea to post back to 
the list once you've solved your problem. 
People usually add [SOLVED] to the subject 
line of their email when posting solutions. 
By posting your solution you're helping the 
next person with the same question. 
[contribued by Chris W Parker]

10. Ask smart questions  
http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)

11. Do not send your email to the list with 
attachments. If you don't have a place to 
upload your code, try the many pastebin 
websites (such as www.pastebin.com).
[contributed by Burhan Khalid]


Hope you have a good time programming with 
PHP.
-- 
Integrated Management Tools for leather 
industry
----------------------------------
http://www.leatherlink.net

Ma Siva Kumar,
BSG LeatherLink (P) Ltd,
Chennai - 600106

--- End Message ---
--- Begin Message --- Luis Bernardo wrote:
Apache or IIS? CGI or ISAPI module?


Hi,


Apache and, if possible, running on Linux or BSD. For me, Windows and IIS have to much security holes that we cannont solve (must wait that M$ want to release a security patch).

Regards,
Jordi.

--- End Message ---
--- Begin Message --- How can I get the numeric Index of an array when the index is a string?

i.e

$myArray = array ("first" => "my first value",
                   "second" => "my second value",
                   "third" => "my third value");

Lets say I want the Index of the "my second one": this would be "second" or numerid 1 (because the numeric index starts at zero).

How can I get the numeric index when I only have the string-index (so array_keys is a nono) without making a loop like:

$i = 0; 
foreach ($myArray as $index => $value)
        {
        if ($index == 'second')
                {       
                echo $i;
                }
        $i++;
        }

Is there another way to get the numeric index?

thanx,

Natascha
--- End Message ---

Reply via email to