php-general Digest 12 Apr 2010 00:16:16 -0000 Issue 6687

2010-04-11 Thread php-general-digest-help

php-general Digest 12 Apr 2010 00:16:16 - Issue 6687

Topics (messages 303986 through 303992):

Re: Inserting into multiple tables
303986 by: Gary
303990 by: Nathan Rixham

Re: PHP execute very slow : PHP Version 5.2.6
303987 by: Al

need help w/ unfamiliar syntax
303988 by: lala
303989 by: Daniel Egeberg

Re: imagecopyresize
303991 by: Karl DeSaulniers

PHP  MYSQL sorting
303992 by: Ernie Kemp

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---

Tommy

Thanks for your reply.  The code you had read I was trying to concatonate 
the insert commands without the semicolon at the endI had also tried 
using the semicolons on each line...same result.


I am reading about the mysqli_multi_query now, so far I am not getting the 
results. Interestingly, it lead me to the mysqli_store_result(), however it 
said it returned a false result on the insert command.


Thank you for your reply...

Gary


Tommy Pham tommy...@gmail.com wrote in message 
news:013601cad93e$e0bca6a0$a235f3...@com...

Hi Gary,


-Original Message-
From: Gary [mailto:gwp...@ptd.net]
Sent: Saturday, April 10, 2010 2:28 PM
To: php-gene...@lists.php.net
Subject: [PHP] Inserting into multiple tables

I am experimenting with multiple tables, it is only a test that is my
local
machine only. This is the current code, which does not work , I have
tried
to concatonate the insert statements.  I have tried multiple $query
variables, but it is just overwriting itself (only the last one gets
inserted). I also tried writing the $query as an array, which got me an
error message (saying it was expecting a string and I offered an
array).

Someone point me in the right direction?

Gary

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
head
meta http-equiv=Content-Type content=text/html; charset=utf-8 /
titleUntitled Document/title
/head

body

form action=?php echo $_SERVER['PHP_SELF'];? method=post

labelFirst Name /label input name=fname type=text /br /br
/
labelLast Name /labelinput name=lname type=text /br /br /
labelStreet Address /labelinput name=street type=text /br
/br
/
labelTown /labelinput name=town type=text /br /br /
labelState /labelinput name=state type=text /br /br /
labelZip Code/labelinput name=zip type=text /br /br /
labelTelephone/labelinput name=phone type=text /br /br /
labelFax/labelinput name=fax type=text /br /br /
labelE-Mail/labelinput name=email type=text /br /br /
labelComments/labelbr /textarea name=comments cols=100
rows=15/textareabr /br /

input name=submit type=submit value=submit /
/form

?php

$fname=($_POST['fname']);
$lname=($_POST['lname']);
$street=($_POST['street']);
$town=($_POST['town']);
$state=($_POST['state']);
$zip=($_POST['zip']);
$phone=($_POST['phone']);
$fax=($_POST['fax']);
$email=($_POST['email']);
$comments=($_POST['comments']);
$REMOTE_ADDR=$_SERVER['REMOTE_ADDR'];

$dbc=mysqli_connect('localhost','root','','test');
$query=INSERT INTO address (street, town, state,
zip).VALUES('$street','$town','$state','$zip').
INSERT INTO comments(comments).VALUES('$comments').
INSERT INTO
contact(phone,fax,email).VALUES('$phone','$fax','$email').
INSERT INTO name (fname, lname).VALUES('$fname','$lname');

$result = mysqli_query($dbc, $query)
or die('Error querying database.');



I see 2 problems:

1) your sql statements are not separated by semicolon - very important when 
executing multiquery
2) you could try mysql_multi_query 
http://www.php.net/manual/en/mysqli.multi-query.php


Regards,
Tommy


mysqli_close($dbc);

?
/body
/html



__ Information from ESET Smart Security, version of virus
signature database 5016 (20100410) __

The message was checked by ESET Smart Security.

http://www.eset.com





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




__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5017 (20100411) __


The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5017 (20100411) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



---End Message---
---BeginMessage---
Gary wrote:
 Adam
 
 Thank you for your well thought out response.
 
 Two points:
 
 I did not include any anti-injection functions because this was an 
 experiment for multiple tables, it is on my machine only.
 
 Since these are php scripts, I dont think anyone will mind (not to mention 
 this board always provides great

RE: [PHP] Inserting into multiple tables

2010-04-11 Thread Tommy Pham
Hi Gary,

 -Original Message-
 From: Gary [mailto:gwp...@ptd.net]
 Sent: Saturday, April 10, 2010 2:28 PM
 To: php-general@lists.php.net
 Subject: [PHP] Inserting into multiple tables
 
 I am experimenting with multiple tables, it is only a test that is my
 local
 machine only. This is the current code, which does not work , I have
 tried
 to concatonate the insert statements.  I have tried multiple $query
 variables, but it is just overwriting itself (only the last one gets
 inserted). I also tried writing the $query as an array, which got me an
 error message (saying it was expecting a string and I offered an
 array).
 
 Someone point me in the right direction?
 
 Gary
 
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 head
 meta http-equiv=Content-Type content=text/html; charset=utf-8 /
 titleUntitled Document/title
 /head
 
 body
 
 form action=?php echo $_SERVER['PHP_SELF'];? method=post
 
 labelFirst Name /label input name=fname type=text /br /br
 /
 labelLast Name /labelinput name=lname type=text /br /br /
 labelStreet Address /labelinput name=street type=text /br
 /br
 /
 labelTown /labelinput name=town type=text /br /br /
 labelState /labelinput name=state type=text /br /br /
 labelZip Code/labelinput name=zip type=text /br /br /
 labelTelephone/labelinput name=phone type=text /br /br /
 labelFax/labelinput name=fax type=text /br /br /
 labelE-Mail/labelinput name=email type=text /br /br /
 labelComments/labelbr /textarea name=comments cols=100
 rows=15/textareabr /br /
 
 input name=submit type=submit value=submit /
 /form
 
 ?php
 
 $fname=($_POST['fname']);
 $lname=($_POST['lname']);
 $street=($_POST['street']);
 $town=($_POST['town']);
 $state=($_POST['state']);
 $zip=($_POST['zip']);
 $phone=($_POST['phone']);
 $fax=($_POST['fax']);
 $email=($_POST['email']);
 $comments=($_POST['comments']);
 $REMOTE_ADDR=$_SERVER['REMOTE_ADDR'];
 
 $dbc=mysqli_connect('localhost','root','','test');
 $query=INSERT INTO address (street, town, state,
 zip).VALUES('$street','$town','$state','$zip').
 INSERT INTO comments(comments).VALUES('$comments').
 INSERT INTO
 contact(phone,fax,email).VALUES('$phone','$fax','$email').
 INSERT INTO name (fname, lname).VALUES('$fname','$lname');
 
 $result = mysqli_query($dbc, $query)
 or die('Error querying database.');
 

I see 2 problems:

1) your sql statements are not separated by semicolon - very important when 
executing multiquery
2) you could try mysql_multi_query 
http://www.php.net/manual/en/mysqli.multi-query.php

Regards,
Tommy

 mysqli_close($dbc);
 
 ?
 /body
 /html
 
 
 
 __ Information from ESET Smart Security, version of virus
 signature database 5016 (20100410) __
 
 The message was checked by ESET Smart Security.
 
 http://www.eset.com
 
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



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



Re: [PHP] Re: PHP execute very slow : PHP Version 5.2.6

2010-04-11 Thread kranthi
have you tried using a profiler like xdebug? or may be it is not a php
issue at all..
i find https://addons.mozilla.org/en-US/firefox/addon/1843 to be
helpful in these situations

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



Re: [PHP] Determining Top # from MySQL

2010-04-11 Thread Floyd Resler

On Apr 10, 2010, at 10:02 PM, Ashley M. Kirchner wrote:

 
 
 Given a MySQL query like this $q = select num from table, I get a result
 like this:
 
 
 
 +---+
 
 |num|
 
 +---+
 
 |  1|
 
 |  4|
 
 |  6|
 
 |  2|
 
 |  4|
 
 |  5|
 
 |  3|
 
 |  2|
 
 |  4|
 
 |  2|
 
 |  3|
 
 |  3|
 
 |  2|
 
 |  1|
 
 +---+
 
 
 
 What I want is a listing of numbers sorted by the amount of times they
 appear (so I can take a top 5, or top 10):
 
 
 
 +---+-+
 
 |num|count|
 
 +---+-+
 
 |  2|4|
 
 |  3|3|
 
 |  4|3|
 
 |  1|2|
 
 |  5|1|
 
 |  6|1|
 
 +---+-+
 
 
 
 Is this a query that I can feed to MySQL, or is this something I need to
 sort out in PHP?
 

This query should do it for you:
SELECT
 num,
COUNT(num) AS total 
FROM 
table 
GROUP BY
 num 
ORDER BY
 COUNT(num) DESC 
LIMIT 10

Take care,
Floyd


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



Re: [PHP] Inserting into multiple tables

2010-04-11 Thread Gary

Tommy

Thanks for your reply.  The code you had read I was trying to concatonate 
the insert commands without the semicolon at the endI had also tried 
using the semicolons on each line...same result.


I am reading about the mysqli_multi_query now, so far I am not getting the 
results. Interestingly, it lead me to the mysqli_store_result(), however it 
said it returned a false result on the insert command.


Thank you for your reply...

Gary


Tommy Pham tommy...@gmail.com wrote in message 
news:013601cad93e$e0bca6a0$a235f3...@com...

Hi Gary,


-Original Message-
From: Gary [mailto:gwp...@ptd.net]
Sent: Saturday, April 10, 2010 2:28 PM
To: php-general@lists.php.net
Subject: [PHP] Inserting into multiple tables

I am experimenting with multiple tables, it is only a test that is my
local
machine only. This is the current code, which does not work , I have
tried
to concatonate the insert statements.  I have tried multiple $query
variables, but it is just overwriting itself (only the last one gets
inserted). I also tried writing the $query as an array, which got me an
error message (saying it was expecting a string and I offered an
array).

Someone point me in the right direction?

Gary

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
head
meta http-equiv=Content-Type content=text/html; charset=utf-8 /
titleUntitled Document/title
/head

body

form action=?php echo $_SERVER['PHP_SELF'];? method=post

labelFirst Name /label input name=fname type=text /br /br
/
labelLast Name /labelinput name=lname type=text /br /br /
labelStreet Address /labelinput name=street type=text /br
/br
/
labelTown /labelinput name=town type=text /br /br /
labelState /labelinput name=state type=text /br /br /
labelZip Code/labelinput name=zip type=text /br /br /
labelTelephone/labelinput name=phone type=text /br /br /
labelFax/labelinput name=fax type=text /br /br /
labelE-Mail/labelinput name=email type=text /br /br /
labelComments/labelbr /textarea name=comments cols=100
rows=15/textareabr /br /

input name=submit type=submit value=submit /
/form

?php

$fname=($_POST['fname']);
$lname=($_POST['lname']);
$street=($_POST['street']);
$town=($_POST['town']);
$state=($_POST['state']);
$zip=($_POST['zip']);
$phone=($_POST['phone']);
$fax=($_POST['fax']);
$email=($_POST['email']);
$comments=($_POST['comments']);
$REMOTE_ADDR=$_SERVER['REMOTE_ADDR'];

$dbc=mysqli_connect('localhost','root','','test');
$query=INSERT INTO address (street, town, state,
zip).VALUES('$street','$town','$state','$zip').
INSERT INTO comments(comments).VALUES('$comments').
INSERT INTO
contact(phone,fax,email).VALUES('$phone','$fax','$email').
INSERT INTO name (fname, lname).VALUES('$fname','$lname');

$result = mysqli_query($dbc, $query)
or die('Error querying database.');



I see 2 problems:

1) your sql statements are not separated by semicolon - very important when 
executing multiquery
2) you could try mysql_multi_query 
http://www.php.net/manual/en/mysqli.multi-query.php


Regards,
Tommy


mysqli_close($dbc);

?
/body
/html



__ Information from ESET Smart Security, version of virus
signature database 5016 (20100410) __

The message was checked by ESET Smart Security.

http://www.eset.com





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




__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5017 (20100411) __


The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




__ Information from ESET NOD32 Antivirus, version of virus signature 
database 5017 (20100411) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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



[PHP] Re: PHP execute very slow : PHP Version 5.2.6

2010-04-11 Thread Al



On 4/10/2010 9:07 PM, Kristijan Marin wrote:

Hi,



I'm experiencing very slow performance of my php scripts ... At first and
for a long time I thought it was Oracle

fault cause I didn't use binding (I rewrote the code ), but the performance
is still bad.

So I tested my sql statement and did some time measurement and found out
that Oracle can fetch  300 records in less

then 2 seconds, but PHP needs  210seconds ... to display it to the user 
I'm using default php.ini



I have a horizontal menu with buttons to switch pages . and just
switching pages takes time with minimum or no oracle interactions.



My php version: 5.2.6

OS: Windows XP sP3 and Windows Server 2008



Testing it in PHPEd using internal PHPEd server and FastCGI ... and also on
Windows 2008 server in IIS ...same results  both using the same
php.ini



Would anyone know what could be the cause of this ?



Any hit is appreciated.



Kris




Use microtime() and record execution times at various points in your script. 
Save the times and its corresponding script line number in a string, with 
suitable formating br /s etc. At the end of the script, echo it.


Incidentally, are you echo-ing output to the client as the info is available, or 
using output buffering? Will make big difference if you are sending a lot of 
output pieces.


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



Re: [PHP] need help w/ unfamiliar syntax

2010-04-11 Thread Daniel Egeberg
On Sun, Apr 11, 2010 at 20:30, lala l...@mail.theorb.net wrote:
 Hi all,

 I've wasted two days trying to find this in the documentation.  Google is no
 help here either; they only index text.

 While looking at some code using objects I came across this:

    $this-{$spec}

 The example works with or without the curly braces, but I know they aren't
 there for just for decoration ;)

 Will somebody be so kind as to point me where in the docs this syntax is
 explained?

 tia

It's documented here:
http://php.net/manual/en/language.variables.variable.php

It works for function and class names as well.

-- 
Daniel Egeberg

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



Re: [PHP] Inserting into multiple tables

2010-04-11 Thread Nathan Rixham
Gary wrote:
 Adam
 
 Thank you for your well thought out response.
 
 Two points:
 
 I did not include any anti-injection functions because this was an 
 experiment for multiple tables, it is on my machine only.
 
 Since these are php scripts, I dont think anyone will mind (not to mention 
 this board always provides great answers).,
 
 However I think I may have answered my question about the importance of 
 normalization of tables.  I have written a number of databases used on 
 various web sites, however, they all are used as a collection of data from 
 input forms.
 
 Most of the information about mutilple tables deals with the retreval of 
 data from, not inserting into, meaning they are more used for known data 
 inserted by the database owner/administrator to be retrieved by queries into 
 the DB.
 
 Am I on the right track?
 

I'm unsure if this is of use to you or not (and it has been covered in
part already), but here goes:

Generally when working with database tables, we normalise, or split
information up at natural points where you have a greater than 1-1
relationships between the data items.

An example may be a table structure to store User, Blog Post and Comments.

With this common example it's very inefficient to store all the
information in one table, because it is split naturally in to three.

We have three relationships here; all 1-* (meaning one to many).

1 User to * Blog Posts
1 Blog Post to * Comments

Thus naturally, and on first glance we would have 3 tables:

| Table User
--
| UserID  |  Username  |  Password  | ...


| Table BlogPost
--
| PostID  |  PostTitle  |  PostersUserID  | ...


| Table Comment
--
| CommentID  |  CommentOnPostID  |  CommentersUserID  | ...


As you can see from the above, all of the rows (or items) in our tables
are linked via IDs to each other.

We can further normalise the above tables to take in to account *-*
(many to many) type relationships, and to fully separate cross cutting
concerns. For instance it may be that a BlogPost has 3 different Users
as author(s).

aside: cross cutting concerns can be considered as something (in this
case a table) trying to handle something which is of no concern to it
(in this case the BlogPost table needs to be aware of Users and their IDs).

To handle the aforementioned we can introduce something commonly
referred to as link tables, consider:


| Table User
--
| UserID  |  Username  |  Password  | ...


| Table BlogPost
--
| PostID  |  PostTitle  |  ...


| Table BlogPostAuthors
--
| BlogPostID  |  UserID  |


The link table BlogPostAuthors acts as a many-to-many join table
between BlogPosts and Users. Similarly we could introduce the same kind
of link table between BlogPosts and Comments, / Users and Comments.

In a real system we may even have another two primary tables introduced,
Roles and UserRoles, as the system may have multiple Roles (Author,
Commenter, Admin etc) and each User may have multiple Roles themselves,
in one capacity I am an Admin, in another I'm an Author. (UserRoles may
be better considered as Personas?)

Ultimately there are many considerations to take in to account, the
relationships between types of data, the frequency at which
inserts/updates/selects occur, the complexity and speed of each query,
and much more.

Designing a table structure is different for each job, with different
considerations and things to weigh up, generally though normalisation
can cater for at least some future scope creep.

It's also worth noting that some consider it bad practise to design a
system from the storage point upwards, because the application and data
should not be constrained by persistence layer features or limitations -
which would indicate designing the data model in UML or suchlike and
dealing with Objects rather than Tables (then later mapping objects to
tables in order to persist them, if choosing a RDBMS as the persistence
layer).

It may also be worth noting that an EAV model is the ultimate in
normalisation and allows all data to be persisted in a single 3 column
structure (or 4 if you partition data). I'll save details of this though.

Do hope that helps in some way, and if you need any more info just shout.

Nathan

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



Re: [PHP] Re: imagecopyresize

2010-04-11 Thread Karl DeSaulniers

Hello all.
I got my script to work, however, I am very new to php and I feel  
that it is just way to bloated and a tad bit sloppy.

You can find a copy of my script here:

http://designdrumm.com/upload_images_test.php.zip

If anyone knows a way to shrink this or a way to short-hand most of  
it, I would love to see it done and learn from it.

Pending if anyone has time to look into it for me.
TIA if you can.
Best,


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP] PHP MYSQL sorting

2010-04-11 Thread Ernie Kemp
 

Simple idea I thought.

 

I need a webpage that displays a drop down list of number with a checkbox on
the side that when checked will select the database again only in descending
order.

Small database with maybe 100  records.

 

The user can click the submit button when they have located the correct
number.

 

The trick is to make the checkbox trigger a new Select statement.

 

Thanks.

 

 

 

 

 

 

 



Re: [PHP] PHP MYSQL sorting

2010-04-11 Thread kranthi
You can use javascript to trigger an onclick function every time a checkbox
is selected.
The onclick function can make an ajax call to a remote php script which can
then make the database query.


Re: [PHP] need help w/ unfamiliar syntax

2010-04-11 Thread kranthi
guess you are looking for
http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing

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



Re: [PHP] PHP MYSQL sorting

2010-04-11 Thread Nilesh Govindarajan

On 04/12/10 05:46, Ernie Kemp wrote:

Simple idea I thought.

I need a webpage that displays a drop down list of number with a
checkbox on the side that when checked will select the database again
only in descending order.

Small database with maybe 100 records.

The user can click the submit button when they have located the correct
number.

The trick is to make the checkbox trigger a new Select statement.

Thanks.



Use jquery, trigger an ajax request onclick of that checkbox.

--
Nilesh Govindarajan
Site  Server Administrator
www.itech7.com
मेरा भारत महान !
मम भारत: महत्तम भवतु !

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



Re: [PHP] need help w/ unfamiliar syntax

2010-04-11 Thread Robert Cummings



Daniel Egeberg wrote:

On Sun, Apr 11, 2010 at 20:30, lala l...@mail.theorb.net wrote:

Hi all,

I've wasted two days trying to find this in the documentation.  Google is no
help here either; they only index text.

While looking at some code using objects I came across this:

   $this-{$spec}

The example works with or without the curly braces, but I know they aren't
there for just for decoration ;)

Will somebody be so kind as to point me where in the docs this syntax is
explained?

tia


It's documented here:
http://php.net/manual/en/language.variables.variable.php

It works for function and class names as well.


The style used above is superfluous since no additional operations are 
being done within the braces and so the braces are redundant. This is 
why it works either way.


Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



[PHP] Mail Function Problem

2010-04-11 Thread Alice Wei

Hi, 

I have an issue here where I see no PHP errors on my mail function usage, and 
yet I am not getting the mail in the desired account. Here is what I have for 
my PHP code:

$headers = From: aj...@alumni.iu.edu;
$to = aj...@alumni.iu.edu ;
$subject = Comments Regarding My Studio;
$body = From: $your_name\n E-Mail: $email\n Reason Contact: $question\n 
Comments:\n $comments;
mail($to, $subject, $body,$headers);

This is what I have in my PHP.ini:

[mail function]
; For Win32 only.
SMTP = smtp.live.com
smtp_port = 587

; For Win32 only.
sendmail_from = aj...@alumni.iu.edu

; For Unix only.  You may supply arguments as well (default: sendmail -t -i).
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra 
parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

Yet, I don't see any mail in my aj...@alumni.iu.edu Mailbox, can anyone on the 
list please give me some pointers on what I may have done wrong here?
Thanks for your help.
  
_
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

Re: [PHP] Inserting into multiple tables

2010-04-11 Thread Paul M Foster
On Sun, Apr 11, 2010 at 12:21:28AM -0400, Gary wrote:


snip

 
 Most of the information about mutilple tables deals with the retreval of
 data from, not inserting into, meaning they are more used for known data
 inserted by the database owner/administrator to be retrieved by queries into
 the DB.
 
 Am I on the right track?

Yes. The emphasis on multiple tables is mostly to ensure data integrity.
It goes back to the beginning of relational databases. And where you
have multiple tables, the most difficult task (and the one which takes
up the most pages in texts) is queries on those multiple tables.
Insertions are considered elementary, and they are typically done one
table at a time. You'll notice the syntax for queries is considerably
more complex than that for inserts, because the task is more complex.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Mail Function Problem

2010-04-11 Thread Kevin Kinsey

Alice Wei wrote:
Hi, 

I have an issue here where I see no PHP errors on my mail 

 function usage, and yet I am not getting the mail in the
 desired account. Here is what I have for my PHP code:


$headers = From: aj...@alumni.iu.edu;
$to = aj...@alumni.iu.edu ;
$subject = Comments Regarding My Studio;
$body = From: $your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n 
$comments;
mail($to, $subject, $body,$headers);


I don't see any way for you to know if there are any errors.

Try this as a very basic start:

$headers = From: aj...@alumni.iu.edu;
$to = aj...@alumni.iu.edu ;
$subject = Comments Regarding My Studio;
$body = From: $your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n 
$comments;
$success=mail($to, $subject, $body,$headers);

if ($success) {
   echo Mail was sent successfully!;
} else {
   echo Sending of mail failed!;
}




This is what I have in my PHP.ini:

[mail function]
; For Win32 only.
SMTP = smtp.live.com
smtp_port = 587

; For Win32 only.
sendmail_from = aj...@alumni.iu.edu

; For Unix only.  You may supply arguments as well (default: sendmail -t -i).
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra 
parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

Yet, I don't see any mail in my aj...@alumni.iu.edu Mailbox, can

 anyone on the list please give me some pointers on what I may have done wrong 
here?

Thanks for your help.


Thanks to the worldwide brotherhood of crooks known as spammers,
sending e-mail these days isn't nearly as easy as PHP makes it look.
You might wanna look into an errors-to header to help debug any
problems with sender authorization, bad ports, etc.

HTH,

KDK

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