php-windows Digest 14 Apr 2010 02:07:32 -0000 Issue 3789
Topics (messages 30019 through 30033):
Re: Trouble running a select query against a database, when I know the
connection is working, and the data is there
30019 by: Richard Quadling
30020 by: Jacob Kruger
30021 by: Toby Hart Dyke
30022 by: Richard Quadling
30023 by: Richard Quadling
30024 by: Jacob Kruger
30025 by: Jacob Kruger
30033 by: Jacob Kruger
Re: Send Mail from PHP Using SMTP Authentication
30026 by: Alice Wei
30028 by: Ferenc Kovacs
30029 by: Alice Wei
30030 by: Ferenc Kovacs
30031 by: Toby Hart Dyke
30032 by: Alice Wei
Using PHP to launch more PHP scripts and use WinCache.
30027 by: Richard Quadling
Administrivia:
To subscribe to the digest, e-mail:
php-windows-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-windows-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-wind...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
On 13 April 2010 09:36, Jacob Kruger <jac...@mailzone.co.za> wrote:
> if ($arr.count > 0)
Try ...
if (mysql_num_rows($arr) > 0)
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
Thanks.
Will try it out - think the .count is just related to $arr being sort of an
array of records - and think I got it out of the PHP tutorial from
w3schools.com, and it's worked on other pages.
Anyway, the following does now seem to work fine:
$qry = mysql_query($sql);
if (mysql_num_rows($qry) > 0)
{
echo "<ul>";
while($row = mysql_fetch_array($qry))
{
echo "<li>" . $row['LinkName'] . " - " . $row['LinkDescription'] . " - ";
echo "<a href='" . $row['LinkURL'] . "' target='_blank'>" . $row['LinkURL'] .
"</a></li>";
}
echo "</ul>";
}
Thanks again
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'
----- Original Message -----
From: Ferenc Kovacs
To: Jacob Kruger
Sent: Tuesday, April 13, 2010 10:46 AM
Subject: Re: [PHP-WIN] Trouble running a select query against a database,
when I know the connection is working, and the data is there
On Tue, Apr 13, 2010 at 10:36 AM, Jacob Kruger <jac...@mailzone.co.za> wrote:
I am trying to simply just loop through a set of records to spit out <li />
tags for the data therein, and on the same page, it's successfully running
another query against the same connection - which I have also tried turning off
just in case it was a problem with running two queries against the same
connection (really don't think so), but it just tells me there are no records
being returned, although I have tried simplifying the sql statement, pulling
records from another table, etc. etc., and I really don't know what am doing
wrong with this really simple bit of scripting:
$qry = mysql_query("select CatName from tblCats where Id = " .
$_REQUEST['id']);
$arr = mysql_fetch_array($qry);
echo "<h2>" . $arr['CatName'] . "</h2>";
//that part works fine
$sql = "select Id, CatID, LinkName, LinkDescription, LinkURL from tblLinks
where CatID = " . $_REQUEST['id'] . ";";
//the SQL statement seems to come out fine as well if I echo it out to the
browser
$qry = mysql_query($sql);
$arr = mysql_fetch_array($qry);
if ($arr.count > 0)
where did you get that $arr.count thingie?
you can count the result rows with mysql_num_rows
http://www.php.net/manual/en/function.mysql-num-rows.php
Tyrael
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 5023 (20100412) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 5024 (20100413) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
--- End Message ---
--- Begin Message ---
On 4/13/2010 9:36 AM, Jacob Kruger wrote:
$qry = mysql_query($sql);
$arr = mysql_fetch_array($qry);
if ($arr.count > 0)
{
echo "<ul>";
while($row = mysql_fetch_array($arr))
You retrieve a row, check if it has any elements, then attempt to
retrieve the next row, using the array you just created as the argument.
You should be using $qry as the argument, but you're skipping over the
first row.
Toby
--- End Message ---
--- Begin Message ---
On 13 April 2010 10:40, Jacob Kruger <jac...@mailzone.co.za> wrote:
> Thanks.
>
> Will try it out - think the .count is just related to $arr being sort of an
> array of records - and think I got it out of the PHP tutorial from
> w3schools.com, and it's worked on other pages.
>
> Anyway, the following does now seem to work fine:
>
> $qry = mysql_query($sql);
> if (mysql_num_rows($qry) > 0)
> {
> echo "<ul>";
> while($row = mysql_fetch_array($qry))
> {
> echo "<li>" . $row['LinkName'] . " - " . $row['LinkDescription'] . " - ";
> echo "<a href='" . $row['LinkURL'] . "' target='_blank'>" . $row['LinkURL'] .
> "</a></li>";
> }
> echo "</ul>";
> }
>
> Thanks again
>
> Stay well
>
> Jacob Kruger
> Blind Biker
> Skype: BlindZA
> '...fate had broken his body, but not his spirit...'
>
> ----- Original Message -----
> From: Ferenc Kovacs
> To: Jacob Kruger
> Sent: Tuesday, April 13, 2010 10:46 AM
> Subject: Re: [PHP-WIN] Trouble running a select query against a database,
> when I know the connection is working, and the data is there
>
>
>
>
>
> On Tue, Apr 13, 2010 at 10:36 AM, Jacob Kruger <jac...@mailzone.co.za> wrote:
>
> I am trying to simply just loop through a set of records to spit out <li
> /> tags for the data therein, and on the same page, it's successfully running
> another query against the same connection - which I have also tried turning
> off just in case it was a problem with running two queries against the same
> connection (really don't think so), but it just tells me there are no records
> being returned, although I have tried simplifying the sql statement, pulling
> records from another table, etc. etc., and I really don't know what am doing
> wrong with this really simple bit of scripting:
>
> $qry = mysql_query("select CatName from tblCats where Id = " .
> $_REQUEST['id']);
> $arr = mysql_fetch_array($qry);
> echo "<h2>" . $arr['CatName'] . "</h2>";
> //that part works fine
> $sql = "select Id, CatID, LinkName, LinkDescription, LinkURL from tblLinks
> where CatID = " . $_REQUEST['id'] . ";";
> //the SQL statement seems to come out fine as well if I echo it out to the
> browser
> $qry = mysql_query($sql);
> $arr = mysql_fetch_array($qry);
> if ($arr.count > 0)
>
>
> where did you get that $arr.count thingie?
> you can count the result rows with mysql_num_rows
> http://www.php.net/manual/en/function.mysql-num-rows.php
>
> Tyrael
>
>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature
> database 5023 (20100412) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature
> database 5024 (20100413) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
Nope.
Breakdown of $arr.count
1 - $arr
2 - .
3 - count
1 - $arr
This is a variable which, in this instance, is a mysql result
resource. Not usefully expressable as a string under normal
conditions.
2 - .
This is the append/concatentate operator.
3 - count
In this state, this will try and find the value of the constant called 'count'.
If it doesn't find one, it will assume the text of 'count'.
So, this becomes something like ...
"Resource id #5count"
And when you test that "> 0", you get false.
e.g.
php -r "var_dump(fopen('./AUTOEXEC.BAT', 'rt').count);"
outputs ...
Notice: Use of undefined constant count - assumed 'count' in Command
line code on line 1
string(19) "Resource id #5count"
and ...
php -r "var_dump(fopen('./AUTOEXEC.BAT', 'rt').count > 0);"
outputs ...
Notice: Use of undefined constant count - assumed 'count' in Command
line code on line 1
bool(false)
My error_reporting level is set to -1.
If yours is set to E_ALL, then the E_NOTICES won't be seen on any
version less than PHP6/trunk.
So, first set the error reporting to -1 (to really show ALL messages)
and re-run your code.
You'll see the error.
Regards,
Richard.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
On 13 April 2010 11:00, Toby Hart Dyke <t...@hartdyke.com> wrote:
> On 4/13/2010 9:36 AM, Jacob Kruger wrote:
>>
>> $qry = mysql_query($sql);
>> $arr = mysql_fetch_array($qry);
>> if ($arr.count > 0)
>> {
>> echo "<ul>";
>> while($row = mysql_fetch_array($arr))
>
> You retrieve a row, check if it has any elements, then attempt to retrieve
> the next row, using the array you just created as the argument. You should
> be using $qry as the argument, but you're skipping over the first row.
>
> Toby
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Good catch Toby.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
Yup, figured that one out as well.
Thanks
Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'
----- Original Message -----
From: "Toby Hart Dyke" <t...@hartdyke.com>
To: "Jacob Kruger" <jac...@mailzone.co.za>
Cc: <php-wind...@lists.php.net>
Sent: Tuesday, April 13, 2010 12:00 PM
Subject: Re: [PHP-WIN] Trouble running a select query against a database,
when I know the connection is working, and the data is there
On 4/13/2010 9:36 AM, Jacob Kruger wrote:
$qry = mysql_query($sql);
$arr = mysql_fetch_array($qry);
if ($arr.count > 0)
{
echo "<ul>";
while($row = mysql_fetch_array($arr))
You retrieve a row, check if it has any elements, then attempt to retrieve
the next row, using the array you just created as the argument. You should
be using $qry as the argument, but you're skipping over the first row.
Toby
--
PHP Windows 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 5024 (20100413) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 5024 (20100413) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
--- End Message ---
--- Begin Message ---
Thanks - will definitely be setting errors to show all as well - in old days
with classic ASP, it was around the first server settings change you
implemented to test/develop things.
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'
----- Original Message -----
From: "Richard Quadling" <rquadl...@googlemail.com>
To: "Jacob Kruger" <jac...@mailzone.co.za>
Cc: <php-wind...@lists.php.net>
Sent: Tuesday, April 13, 2010 12:01 PM
Subject: Re: [PHP-WIN] Trouble running a select query against a database,
when I know the connection is working, and the data is there
On 13 April 2010 10:40, Jacob Kruger <jac...@mailzone.co.za> wrote:
Thanks.
Will try it out - think the .count is just related to $arr being sort of
an array of records - and think I got it out of the PHP tutorial from
w3schools.com, and it's worked on other pages.
Anyway, the following does now seem to work fine:
$qry = mysql_query($sql);
if (mysql_num_rows($qry) > 0)
{
echo "<ul>";
while($row = mysql_fetch_array($qry))
{
echo "<li>" . $row['LinkName'] . " - " . $row['LinkDescription'] . " - ";
echo "<a href='" . $row['LinkURL'] . "' target='_blank'>" .
$row['LinkURL'] . "</a></li>";
}
echo "</ul>";
}
Thanks again
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'
----- Original Message -----
From: Ferenc Kovacs
To: Jacob Kruger
Sent: Tuesday, April 13, 2010 10:46 AM
Subject: Re: [PHP-WIN] Trouble running a select query against a database,
when I know the connection is working, and the data is there
On Tue, Apr 13, 2010 at 10:36 AM, Jacob Kruger <jac...@mailzone.co.za>
wrote:
I am trying to simply just loop through a set of records to spit out <li
/> tags for the data therein, and on the same page, it's successfully
running another query against the same connection - which I have also
tried turning off just in case it was a problem with running two queries
against the same connection (really don't think so), but it just tells me
there are no records being returned, although I have tried simplifying the
sql statement, pulling records from another table, etc. etc., and I really
don't know what am doing wrong with this really simple bit of scripting:
$qry = mysql_query("select CatName from tblCats where Id = " .
$_REQUEST['id']);
$arr = mysql_fetch_array($qry);
echo "<h2>" . $arr['CatName'] . "</h2>";
//that part works fine
$sql = "select Id, CatID, LinkName, LinkDescription, LinkURL from tblLinks
where CatID = " . $_REQUEST['id'] . ";";
//the SQL statement seems to come out fine as well if I echo it out to the
browser
$qry = mysql_query($sql);
$arr = mysql_fetch_array($qry);
if ($arr.count > 0)
where did you get that $arr.count thingie?
you can count the result rows with mysql_num_rows
http://www.php.net/manual/en/function.mysql-num-rows.php
Tyrael
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 5023 (20100412) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 5024 (20100413) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
Nope.
Breakdown of $arr.count
1 - $arr
2 - .
3 - count
1 - $arr
This is a variable which, in this instance, is a mysql result
resource. Not usefully expressable as a string under normal
conditions.
2 - .
This is the append/concatentate operator.
3 - count
In this state, this will try and find the value of the constant called
'count'.
If it doesn't find one, it will assume the text of 'count'.
So, this becomes something like ...
"Resource id #5count"
And when you test that "> 0", you get false.
e.g.
php -r "var_dump(fopen('./AUTOEXEC.BAT', 'rt').count);"
outputs ...
Notice: Use of undefined constant count - assumed 'count' in Command
line code on line 1
string(19) "Resource id #5count"
and ...
php -r "var_dump(fopen('./AUTOEXEC.BAT', 'rt').count > 0);"
outputs ...
Notice: Use of undefined constant count - assumed 'count' in Command
line code on line 1
bool(false)
My error_reporting level is set to -1.
If yours is set to E_ALL, then the E_NOTICES won't be seen on any
version less than PHP6/trunk.
So, first set the error reporting to -1 (to really show ALL messages)
and re-run your code.
You'll see the error.
Regards,
Richard.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 5024 (20100413) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 5024 (20100413) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
--- End Message ---
--- Begin Message ---
Thanks.
Figured it out, and also know shouldn't just copy and paste too much code as
such...<smile>
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'
----- Original Message -----
From: "Toby Hart Dyke" <t...@hartdyke.com>
To: "Jacob Kruger" <jac...@mailzone.co.za>
Cc: <php-wind...@lists.php.net>
Sent: Tuesday, April 13, 2010 12:00 PM
Subject: Re: [PHP-WIN] Trouble running a select query against a database,
when I know the connection is working, and the data is there
On 4/13/2010 9:36 AM, Jacob Kruger wrote:
$qry = mysql_query($sql);
$arr = mysql_fetch_array($qry);
if ($arr.count > 0)
{
echo "<ul>";
while($row = mysql_fetch_array($arr))
You retrieve a row, check if it has any elements, then attempt to retrieve
the next row, using the array you just created as the argument. You should
be using $qry as the argument, but you're skipping over the first row.
Toby
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 5026 (20100413) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 5026 (20100413) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
--- End Message ---
--- Begin Message ---
Date: Mon, 12 Apr 2010 22:13:10 +0200
Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
From: tyr...@gmail.com
To: aj...@alumni.iu.edu
CC: php-wind...@lists.php.net
http://www.php.net/manual/en/ini.core.php#ini.include-path
Tyrael
I tried installing the Pear Mail package, it is now located in
php/PEAR/Mail, and my code is located in the htdocs. Here is the code:
require_once("Mail.php");
$mail
= Mail::factory("mail");
$your_name = $_POST['your_name'];
$email
= $_POST['email'];
$question = $_POST['question'];
$comments=
$_POST['comments'];
$submit = $_POST['submit'];
if($_POST['submit']=="Submit")
{
$from = "elite.engl...@att.net";
$to = $email;
$subject =
"Comments Regarding HH Web Design Studio";
$body = "From:
$your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n
$comments";
$host = "smtp.att.yahoo.com";
$username =
"my_user_name";
$password = "password";
$headers = array ('From'
=> $from,
'To' => $to,
'Subject' => $subject);
$mail->send($to,
$headers, $body);
if (PEAR::isError($mail)) echo "<p>" .
$mail->getMessage() . "</p>";
This is what I get:
Fatal error: Class 'Mail' not found in C:\xampp\htdocs\Alice.Wei\web\mail.php
on line 30
Do I need to move the Mail PEAR class to the
same folder as my web folder? How can I make sure that my Pear is
running?
Thanks for your help.
Alice
On Mon, Apr 12, 2010 at 10:06 PM, Alice Wei <aj...@alumni.iu.edu> wrote:
Hi,
Just as I am exploring some of my alternatives for using the mail() in PHP, I
came across a web page that one of the users on the list has provided me:
http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm.
Does anyone know what the Mail.php is referring to here?
<?php
require_once "Mail.php";
$from = "Sandra Sender <sen...@example.com>";
$to = "Ramona Recipient <recipi...@example.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
?>
If it is something from PEAR package, why isn't it necessary for it to specify
the path to that code?
Can it tell by itself?
Thanks for your help.
Alice
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5
--- End Message ---
--- Begin Message ---
On Tue, Apr 13, 2010 at 2:24 PM, Alice Wei <aj...@alumni.iu.edu> wrote:
>
> Date: Mon, 12 Apr 2010 22:13:10 +0200
> Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
> From: tyr...@gmail.com
> To: aj...@alumni.iu.edu
> CC: php-wind...@lists.php.net
>
> http://www.php.net/manual/en/ini.core.php#ini.include-path
>
> Tyrael
>
> I tried installing the Pear Mail package, it is now located in
> php/PEAR/Mail, and my code is located in the htdocs. Here is the code:
>
> require_once("Mail.php");
> $mail
> = Mail::factory("mail");
>
> $your_name = $_POST['your_name'];
> $email
> = $_POST['email'];
> $question = $_POST['question'];
> $comments=
> $_POST['comments'];
> $submit = $_POST['submit'];
>
> if($_POST['submit']=="Submit")
> {
> $from = "elite.engl...@att.net";
> $to = $email;
> $subject =
> "Comments Regarding HH Web Design Studio";
> $body = "From:
> $your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n
> $comments";
>
> $host = "smtp.att.yahoo.com";
> $username =
> "my_user_name";
> $password = "password";
> $headers = array ('From'
> => $from,
> 'To' => $to,
> 'Subject' => $subject);
> $mail->send($to,
> $headers, $body);
>
> if (PEAR::isError($mail)) echo "<p>" .
> $mail->getMessage() . "</p>";
>
> This is what I get:
>
> Fatal error: Class 'Mail' not found in
> C:\xampp\htdocs\Alice.Wei\web\mail.php
> on line 30
>
> Do I need to move the Mail PEAR class to the
> same folder as my web folder? How can I make sure that my Pear is
> running?
> Thanks for your help.
>
>
http://www.php.net/manual/en/ini.core.php#ini.include-path
set the PEAR path to your include_path in your php.ini
...
gosh
Tyrael
--- End Message ---
--- Begin Message ---
Date: Tue, 13 Apr 2010 15:42:29 +0200
Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
From: tyr...@gmail.com
To: aj...@alumni.iu.edu
CC: php-wind...@lists.php.net
On Tue, Apr 13, 2010 at 2:24 PM, Alice Wei <aj...@alumni.iu.edu> wrote:
Date: Mon, 12 Apr 2010 22:13:10 +0200
Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
From: tyr...@gmail.com
To: aj...@alumni.iu.edu
CC: php-wind...@lists.php.net
http://www.php.net/manual/en/ini.core.php#ini.include-path
Tyrael
I tried installing the Pear Mail package, it is now located in
php/PEAR/Mail, and my code is located in the htdocs. Here is the code:
require_once("Mail.php");
$mail
= Mail::factory("mail");
$your_name = $_POST['your_name'];
$email
= $_POST['email'];
$question = $_POST['question'];
$comments=
$_POST['comments'];
$submit = $_POST['submit'];
if($_POST['submit']=="Submit")
{
$from = "elite.engl...@att.net";
$to = $email;
$subject =
"Comments Regarding HH Web Design Studio";
$body = "From:
$your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n
$comments";
$host = "smtp.att.yahoo.com";
$username =
"my_user_name";
$password = "password";
$headers = array ('From'
=> $from,
'To' => $to,
'Subject' => $subject);
$mail->send($to,
$headers, $body);
if (PEAR::isError($mail)) echo "<p>" .
$mail->getMessage() . "</p>";
This is what I get:
Fatal error: Class 'Mail' not found in C:\xampp\htdocs\Alice.Wei\web\mail.php
on line 30
Do I need to move the Mail PEAR class to the
same folder as my web folder? How can I make sure that my Pear is
running?
Thanks for your help.
http://www.php.net/manual/en/ini.core.php#ini.include-path
set the PEAR path to your include_path in your php.ini
I did have that. I have include_path = ".;C:\xampp\php\PEAR;". Do I have to
physically type in pear install Mail to install the Mail package here?
Thanks.
Alice
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5
--- End Message ---
--- Begin Message ---
On Tue, Apr 13, 2010 at 3:54 PM, Alice Wei <aj...@alumni.iu.edu> wrote:
>
> ------------------------------
> Date: Tue, 13 Apr 2010 15:42:29 +0200
>
> Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
> From: tyr...@gmail.com
> To: aj...@alumni.iu.edu
> CC: php-wind...@lists.php.net
>
>
>
> On Tue, Apr 13, 2010 at 2:24 PM, Alice Wei <aj...@alumni.iu.edu> wrote:
>
>
> Date: Mon, 12 Apr 2010 22:13:10 +0200
> Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
> From: tyr...@gmail.com
> To: aj...@alumni.iu.edu
> CC: php-wind...@lists.php.net
>
> http://www.php.net/manual/en/ini.core.php#ini.include-path
>
> Tyrael
>
> I tried installing the Pear Mail package, it is now located in
> php/PEAR/Mail, and my code is located in the htdocs. Here is the code:
>
> require_once("Mail.php");
> $mail
> = Mail::factory("mail");
>
> $your_name = $_POST['your_name'];
> $email
> = $_POST['email'];
> $question = $_POST['question'];
> $comments=
> $_POST['comments'];
> $submit = $_POST['submit'];
>
> if($_POST['submit']=="Submit")
> {
> $from = "elite.engl...@att.net";
> $to = $email;
> $subject =
> "Comments Regarding HH Web Design Studio";
> $body = "From:
> $your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n
> $comments";
>
> $host = "smtp.att.yahoo.com";
> $username =
> "my_user_name";
> $password = "password";
> $headers = array ('From'
> => $from,
> 'To' => $to,
> 'Subject' => $subject);
> $mail->send($to,
> $headers, $body);
>
> if (PEAR::isError($mail)) echo "<p>" .
> $mail->getMessage() . "</p>";
>
> This is what I get:
>
> Fatal error: Class 'Mail' not found in
> C:\xampp\htdocs\Alice.Wei\web\mail.php
> on line 30
>
> Do I need to move the Mail PEAR class to the
> same folder as my web folder? How can I make sure that my Pear is
> running?
> Thanks for your help.
>
>
> http://www.php.net/manual/en/ini.core.php#ini.include-path
> set the PEAR path to your include_path in your php.ini
>
> I did have that. I have *include_path = ".;C:\xampp\php\PEAR;"*. Do I have
> to physically type in pear install Mail to install the Mail package here?
>
>
As far as I remember, the xampp is by default contains the Mail package, but
you should check the presence of the Mail.php in the C:\xampp\php\PEAR
directory.
the include_path seems good but the last ; is not necessary.
Could you check that you removed the ; from the begining of the line, and
that you don't have any other active include_path line in your php.ini, and
you modified the correct php.ini?
last time when I checked xampp, the php.ini was in xampp/apache/bin
Tyrael
> Thanks.
>
> Alice
>
>
> ------------------------------
> The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
> Hotmail. Get
> busy.<http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5>
>
--- End Message ---
--- Begin Message ---
On 4/13/2010 2:54 PM, Alice Wei wrote:
I tried installing the Pear Mail package, it is now located in
php/PEAR/Mail, and my code is located in the htdocs. Here is the code:
$host = "smtp.att.yahoo.com";
Although you have other problems (see below) this is unlikely to work.
When sending email, you need to either authenticate yourself with the
server, or use an SMTP server in your local domain (which *may* accept
all mail without authentication). This will be a mail server run by your
ISP.
Given your email address domain (iu.edu) you should probably try
mail.iu.edu or smtp.iu.edu, or just ask your local administrator where
you should be sending email, and if you need to authenticate.
All that said, you define $host, but don't seem to use it anywhere. I've
never used the Pear Mail package, so can't tell you where that should go.
Fatal error: Class 'Mail' not found in C:\xampp\htdocs\Alice.Wei\web\mail.php
>set the PEAR path to your include_path in your php.ini
I did have that. I have include_path = ".;C:\xampp\php\PEAR;". Do I have to
physically type in pear install Mail to install the Mail package here?
Did you restart the web server after changing that? Changes to the
server php.ini won't get picked up until a restart.
Toby
--- End Message ---
--- Begin Message ---
Date: Tue, 13 Apr 2010 16:05:31 +0200
Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
From: tyr...@gmail.com
To: aj...@alumni.iu.edu
CC: php-wind...@lists.php.net
On Tue, Apr 13, 2010 at 3:54 PM, Alice Wei <aj...@alumni.iu.edu> wrote:
Date: Tue, 13 Apr 2010 15:42:29 +0200
Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
From: tyr...@gmail.com
To: aj...@alumni.iu.edu
CC: php-wind...@lists.php.net
On Tue, Apr 13, 2010 at 2:24 PM, Alice Wei <aj...@alumni.iu.edu> wrote:
Date: Mon, 12 Apr 2010 22:13:10 +0200
Subject: Re: [PHP-WIN] Send Mail from PHP Using SMTP Authentication
From: tyr...@gmail.com
To: aj...@alumni.iu.edu
CC: php-wind...@lists.php.net
http://www.php.net/manual/en/ini.core.php#ini.include-path
Tyrael
I tried installing the Pear Mail package, it is now located in
php/PEAR/Mail, and my code is located in the htdocs. Here is the code:
require_once("Mail.php");
$mail
= Mail::factory("mail");
$your_name = $_POST['your_name'];
$email
= $_POST['email'];
$question = $_POST['question'];
$comments=
$_POST['comments'];
$submit = $_POST['submit'];
if($_POST['submit']=="Submit")
{
$from = "elite.engl...@att.net";
$to = $email;
$subject =
"Comments Regarding HH Web Design Studio";
$body = "From:
$your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n
$comments";
$host = "smtp.att.yahoo.com";
$username =
"my_user_name";
$password = "password";
$headers = array ('From'
=> $from,
'To' => $to,
'Subject' => $subject);
$mail->send($to,
$headers, $body);
if (PEAR::isError($mail)) echo "<p>" .
$mail->getMessage() . "</p>";
This is what I get:
Fatal error: Class 'Mail' not found in C:\xampp\htdocs\Alice.Wei\web\mail.php
on line 30
Do I need to move the Mail PEAR class to the
same folder as my web folder? How can I make sure that my Pear is
running?
Thanks for your help.
http://www.php.net/manual/en/ini.core.php#ini.include-path
set the PEAR path to your include_path in your php.ini
I did have that. I have include_path = ".;C:\xampp\php\PEAR;". Do I have to
physically type in pear install Mail to install the Mail package here?
As far as I remember, the xampp is by default contains the Mail package, but
you should check the presence of the Mail.php in the C:\xampp\php\PEAR
directory.
the include_path seems good but the last ; is not necessary.
Could you check that you removed the ; from the begining of the line, and that
you don't have any other active include_path line in your php.ini, and you
modified the correct php.ini?
last time when I checked xampp, the php.ini was in xampp/apache/bin
Interesting, l just checked my phpinfo() page, and the Loaded configuration
file is claimed to be located at C:\xampp\php\php.ini, and the configure
command, it reads cscript/nologo configure.js "--enable-snashot-build". The
PHP_PEAR_SYSCONF_DIR is C:\xampp\php, When I use cmd to run the command, I type
C:\xampp\php>pear and the output returns blank.
Looks like I don't have PEAR installed. If these are included properly, how can
I install it?
Thanks.
Alice
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
--- End Message ---
--- Begin Message ---
Hello.
I've been trying to use WinCache to allow me to pass data between 2
scripts, where script a launches script b.
I can do this at the command line easily enough ...
<?php
// test1.php
wincache_ucache_set('foobar', 'barfoo');
$a = wincache_ucache_get('foobar');
echo 'Entry in the cache is: ', $a;
$handle = fopen ("php://stdin","r");
$line = fgets($handle);
?>
and
<?php
// test2.php
$a = wincache_ucache_get('foobar');
echo 'The entry from ucache is ', $a;
$handle = fopen ("php://stdin","r");
$line = fgets($handle);
?>
and running these ...
start C:\PHP5\php.exe -f test1.php
start C:\PHP5\php.exe -f test2.php
Now I want to do something similar from a PHP script.
<?php
// controller.php
// Set the ucache values
// Launch child tasks
// Loop, reporting child values
?>
<?php
//child
// loop for a while, setting the ucache values for this child.
?>
What I'm stuck with is how do I launch a PHP script so that it has the
launching script as the parent process _AND_ does not block execution
of the parent script.
I can launch them as separate processes in any number of ways, but
then the parent isn't known.
Any suggestions?
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---