php-general Digest 14 Mar 2008 08:39:02 - Issue 5347
Topics (messages 271541 through 271562):
Re: avoid calling php script
271541 by: H u g o H i r a m
Re: What's wrong the __autoload()?
271542 by: Roland Häder
271543 by: Andrés Robinet
271544 by: Aschwin
Robert Cummings wrote:
It works like follows...
- $z asserts $a or claims $b
- $y disagrees with $a or $b or both and responds with rebuttal $h
and makes claims $c, $d, sometimes $e
- $z responds with rebuttal $i and often asserts a few other things
that well call $f, $g
VamVan wrote:
Can you tell me how to do this ?
suppose I have a date variable = '02/23/2008'
i need to know if this is the last friday of february
let me know.
$month = 3;
$year = 2008;
for ($day = 31; $day = 21; $day--) { // maximum of 7 days, but
february starts at 28
Hi,
How can I send multiple values from a form to be stored in a database, as
name of the fields is the same?
For example:
?php
foreach ($field_data as $field) {
$field_name=$field[field_name];
$field_id=$field[field_id];
$datatype=$field[datatype_name];
?
input
VamVan wrote:
Can you tell me how to do this ?
suppose I have a date variable = '02/23/2008'
i need to know if this is the last friday of february
Work backwards from the 28th subtracting 86400 from your Unix timestamp
until you get to a Friday. Compare this with your variable.
--
2008. 03. 14, péntek keltezéssel 08.52-kor Aschwin Wesselius ezt írta:
Robert Cummings wrote:
It works like follows...
- $z asserts $a or claims $b
- $y disagrees with $a or $b or both and responds with rebuttal $h
and makes claims $c, $d, sometimes $e
- $z responds
2008. 03. 14, péntek keltezéssel 14.08-kor Suamya Srivastava ezt írta:
Hi,
How can I send multiple values from a form to be stored in a database, as
name of the fields is the same?
For example:
?php
foreach ($field_data as $field) {
$field_name=$field[field_name];
On Thu, Mar 13, 2008 at 9:39 PM, Andrés Robinet [EMAIL PROTECTED] wrote:
-Original Message-
From: VamVan [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 13, 2008 9:13 PM
To: php-general@lists.php.net
Subject: [PHP] Last Friday of every month
Can you tell me how to do
On Fri, Mar 14, 2008 at 6:02 AM, Zoltán Németh [EMAIL PROTECTED] wrote:
2008. 03. 14, péntek keltezéssel 14.08-kor Suamya Srivastava ezt írta:
Hi,
How can I send multiple values from a form to be stored in a database, as
name of the fields is the same?
For example:
?php
On Thu, Mar 13, 2008 at 10:53 PM, Shawn McKenzie [EMAIL PROTECTED] wrote:
Ooo... I want SUDO!
ALL = NOPASSWD: ALL
please!
Which is exactly why you get the following FANTASTIC package!
* No shell access
* No databases
* No scripting support
* No FTP access
Hi,
I maid the modifications you suggested. For the error
context when i display it, it gives a lot of
information, but not easy to understand how the array
is structured. If somebody knows about a site
explaining how to access the context it would be
great.
I also modified the error reporting to
2008. 03. 14, péntek keltezéssel 07.20-kor It Maq ezt írta:
So i'm wondering if there are some rules
that can help me know if an error will be reported
automatically or not.
there is no general rule for that. you have to check the manual for each
function, some of them just returns false on
For example mysql_connect reprted automatically the
error but in the manual
http://us3.php.net/manual/en/function.mysql-connect.php
all they give as information is the return: Returns
a MySQL link identifier on success, or FALSE on
failure., where can i see if it throws an error, and
when you say
1. instead of typing: $conn=ocilogon(usrname,passwrd,db);
can i save this info in a file and have my php script either include or call
it when it needs to make a db connection? what would that look like? i may
want to point my app to a test db at some point it would be nice to only
change it in
At 8:01 AM -0700 3/14/08, good_times wrote:
1. instead of typing: $conn=ocilogon(usrname,passwrd,db);
can i save this info in a file and have my php script either include or call
it when it needs to make a db connection? what would that look like? i may
want to point my app to a test db at some
good_times wrote:
1. instead of typing: $conn=ocilogon(usrname,passwrd,db);
can i save this info in a file and have my php script either include or call
it when it needs to make a db connection? what would that look like? i may
want to point my app to a test db at some point it would be nice
tedd wrote:
At 9:19 PM -0400 3/13/08, Robert Cummings wrote:
- $z asserts $a or claims $b
- $y disagrees with $a or $b or both and responds with rebuttal $h
and makes claims $c, $d, sometimes $e
- $z responds with rebuttal $i and often asserts a few other things
that
At 9:19 PM -0400 3/13/08, Robert Cummings wrote:
- $z asserts $a or claims $b
- $y disagrees with $a or $b or both and responds with rebuttal $h
and makes claims $c, $d, sometimes $e
- $z responds with rebuttal $i and often asserts a few other things
that well call $f, $g
2008. 03. 14, péntek keltezéssel 07.40-kor It Maq ezt írta:
For example mysql_connect reprted automatically the
error but in the manual
http://us3.php.net/manual/en/function.mysql-connect.php
all they give as information is the return: Returns
a MySQL link identifier on success, or FALSE on
At 8:17 AM -0400 3/14/08, Eric Butera wrote:
Just FYI you can use the word last friday in strtotime. So really
you could check and see if the max day in a month is a friday and if
not fall back on last friday. I didn't test it but I just thought I'd
throw that out there.
erics:~ eric$ php -r
I have a link that i want to use as the body of an html email. here
is the code i use:
// Notify about comments
public function emailComment($Link, $ID) {
$mail = new SendMail();
$mail-SetCharSet(ISO-8859-1);
$mail-from(someone, [EMAIL PROTECTED]);
At 4:24 PM +0100 3/14/08, Aschwin Wesselius wrote:
tedd wrote:
At 9:19 PM -0400 3/13/08, Robert Cummings wrote:
- $SJHSKJ mentions Nazis
Aha, you lose. You were the first to mention Nazis. :-)
Hey, at least I've learned something today. I thought he was joking
about Godwin's Law and
Hi everyone,
I am attempting to add a little error checking for a very simple login
system. The info is stored in a MySQL database, and I am using mysqli
to connect to it. I have it working with the solution provided below,
but I am wondering if this is the right way to do it or if there
On Mar 14, 2008, at 10:15 AM, tedd wrote:
At 8:01 AM -0700 3/14/08, good_times wrote:
1. instead of typing: $conn=ocilogon(usrname,passwrd,db);
can i save this info in a file and have my php script either
include or call
it when it needs to make a db connection? what would that look
like?
On Mar 13, 2008, at 8:12 PM, VamVan wrote:
Can you tell me how to do this ?
suppose I have a date variable = '02/23/2008'
i need to know if this is the last friday of february
let me know.
There are plenty of ways. Here's a couple:
OS X:
1. Finder Applications iCal (or Command-space
I am attempting to add a little error checking for a very simple login
system. The info is stored in a MySQL database, and I am using mysqli
to connect to it. I have it working with the solution provided below,
but I am wondering if this is the right way to do it or if there is a
better way?
On Mar 14, 2008, at 11:44 AM, Philip Thompson wrote:
On Mar 13, 2008, at 8:12 PM, VamVan wrote:
Can you tell me how to do this ?
suppose I have a date variable = '02/23/2008'
i need to know if this is the last friday of february
let me know.
There are plenty of ways. Here's a couple:
I think the first thing I'd check is why you'd have more than one row being
returned. Is this a problem with some other part of the system? Bad data
import? Not checking for unique users when creating them? Something
like that.
If you do everything you can to prevent the possibility of
On Mar 14, 2008, at 12:45 PM, Dan Joseph wrote:
I am attempting to add a little error checking for a very simple login
system. The info is stored in a MySQL database, and I am using mysqli
to connect to it. I have it working with the solution provided below,
but I am wondering if this is the
On Mar 14, 2008, at 12:51 PM, TG wrote:
I think the first thing I'd check is why you'd have more than one
row being
returned. Is this a problem with some other part of the system?
Bad data
import? Not checking for unique users when creating them?
Something
like that.
The
$rowcnt = mysqli_num_rows($loginResult);
if($rowcnt !=1){
echo Auth failed;
die(Auth failed... Sorry);
}else{
while($row1 = mysqli_fetch_array($loginResult)) {
$_SESSION['user'] = $row1['loginName'];
On Fri, Mar 14, 2008 at 11:57 AM, tedd [EMAIL PROTECTED] wrote:
At 8:17 AM -0400 3/14/08, Eric Butera wrote:
Just FYI you can use the word last friday in strtotime. So really
you could check and see if the max day in a month is a friday and if
not fall back on last friday. I didn't
Here is the error message captured by my error
handling function:
mysql_connect() [function.mysql-connect]: Access
denied for user 'admin'@'localhost' (using password:
YES)
i put a wrong password and username
--- Zoltán Németh [EMAIL PROTECTED] wrote:
2008. 03. 14, péntek keltezéssel 07.40-kor
On Fri, Mar 14, 2008 at 1:02 PM, Richard Heyes [EMAIL PROTECTED] wrote:
$rowcnt = mysqli_num_rows($loginResult);
if($rowcnt !=1){
echo Auth failed;
die(Auth failed... Sorry);
}else{
while($row1 =
Dan Joseph wrote:
I am attempting to add a little error checking for a very simple login
system. The info is stored in a MySQL database, and I am using mysqli
to connect to it. I have it working with the solution provided below,
but I am wondering if this is the right way to do it or if there
On Mar 14, 2008, at 1:05 PM, Eric Butera wrote:
On Fri, Mar 14, 2008 at 1:02 PM, Richard Heyes
[EMAIL PROTECTED] wrote:
Yes, if it is a lack of being able to see your value using print_r or
echo, then use var_dump().
Seeing the value's and printing them arn't a problem... Just a hold
On Mar 14, 2008, at 1:15 PM, Shawn McKenzie wrote:
Dan Joseph wrote:
I am attempting to add a little error checking for a very simple
login
system. The info is stored in a MySQL database, and I am using
mysqli
to connect to it. I have it working with the solution provided
below,
but I am
What error are you getting? Maybe there's some way to fix that too.
Just remember that errors and notices are like pain. It usually means
there's something wrong. If you're getting an error, there may be a better
way of doing waht you're doing.
Ideally, you should get zero results if
At 1:03 PM -0400 3/14/08, Eric Butera wrote:
On Fri, Mar 14, 2008 at 11:57 AM, tedd [EMAIL PROTECTED] wrote:
You were right -- here it is:
http://webbytedd.com/b1/last-friday/
Hi Tedd,
Thanks for the writeup! You could streamline that a bit by using
getdate() and using the
At 11:38 AM -0500 3/14/08, Philip Thompson wrote:
On Mar 14, 2008, at 10:15 AM, tedd wrote:
At 8:01 AM -0700 3/14/08, good_times wrote:
2. i see an example where a form in a login.html submits to authcheck.php
but authcheck.php just prints ('User not found in LDAP' or 'error occured'
or
here is my simple email lib: http://pastebin.com/m4d107c01
any idea why in the body i have a link with an = sign that gets
replaced with a % sign?
-e
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Friday 14 March 2008 18:33:13 nihilism machine wrote:
here is my simple email lib: http://pastebin.com/m4d107c01
any idea why in the body i have a link with an = sign that gets
replaced with a % sign?
-e
read up on urlencode
--
---
Børge Holen
http://www.arivene.net
--
PHP General
In C, etc. one can place #if's around code to determine whether or not
the compiler should pay any attention to the code.
Is there a similar technique for PHP?
I've not seen anything like this before and a brief search hasn't
turned up anything either...just thought I would ask to make
On Friday 14 March 2008 19:19:30 Eric Gorr wrote:
In C, etc. one can place #if's around code to determine whether or not
the compiler should pay any attention to the code.
Is there a similar technique for PHP?
I've not seen anything like this before and a brief search hasn't
turned up
If you are talking about simply commenting code out, yes, I am aware
of this...however, the #if technique is far more capable in certain
situations.
There are reasons why C, etc. has included the ability to comment out
lines of code and also provide #if's.
But based on your reply, I have
in php you have a number of constructs that can be used to execute code (or
not) based on certain conditions ie is_defined(). Not sure if
the comparison with C holds true as C is compiled and PHP is interpreted.
On Fri, Mar 14, 2008 at 6:34 PM, Eric Gorr [EMAIL PROTECTED] wrote:
If you are
On 14 Mar 2008, at 18:34, Eric Gorr wrote:
If you are talking about simply commenting code out, yes, I am aware
of this...however, the #if technique is far more capable in certain
situations.
There are reasons why C, etc. has included the ability to comment
out lines of code and also
On Mar 14, 2008, at 1:44 PM, TG wrote:
What error are you getting? Maybe there's some way to fix that too.
The error I get without checking the row count is this:
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to
Unfortunately, such things cannot be used to wrap functions.
On Mar 14, 2008, at 2:38 PM, Dave Goodchild wrote:
in php you have a number of constructs that can be used to execute
code (or not) based on certain conditions ie is_defined(). Not sure if
the comparison with C holds true as C is
Eric Gorr wrote:
Unfortunately, such things cannot be used to wrap functions.
On Mar 14, 2008, at 2:38 PM, Dave Goodchild wrote:
in php you have a number of constructs that can be used to execute
code (or not) based on certain conditions ie is_defined(). Not sure if
the comparison
On 14 Mar 2008, at 19:03, Eric Gorr wrote:
Unfortunately, such things cannot be used to wrap functions.
Erm, yes they can. Try it.
?php
if (rand(0,1) == 0)
{
function arse()
{
echo arse 1\n;
}
}
else
{
function arse()
{
On Mar 14, 2008, at 3:10 PM, Stut wrote:
On 14 Mar 2008, at 19:03, Eric Gorr wrote:
Unfortunately, such things cannot be used to wrap functions.
Erm, yes they can. Try it.
?php
if (rand(0,1) == 0)
{
function arse()
{
echo arse 1\n;
}
}
else
{
On Mar 14, 2008, at 3:15 PM, Eric Gorr wrote:
On Mar 14, 2008, at 3:10 PM, Stut wrote:
On 14 Mar 2008, at 19:03, Eric Gorr wrote:
Unfortunately, such things cannot be used to wrap functions.
Erm, yes they can. Try it.
?php
if (rand(0,1) == 0)
{
function arse()
{
Jason Pruim wrote:
On Mar 14, 2008, at 1:15 PM, Shawn McKenzie wrote:
Dan Joseph wrote:
I am attempting to add a little error checking for a very simple login
system. The info is stored in a MySQL database, and I am using mysqli
to connect to it. I have it working with the solution provided
Eric Gorr wrote:
On Mar 14, 2008, at 3:15 PM, Eric Gorr wrote:
On Mar 14, 2008, at 3:10 PM, Stut wrote:
On 14 Mar 2008, at 19:03, Eric Gorr wrote:
Unfortunately, such things cannot be used to wrap functions.
Erm, yes they can. Try it.
?php
if (rand(0,1) == 0)
{
function
OK, here's how it goes:
?php
if(!defined('_THIS_PHP_FILE_PHP')) {
define('_THIS_PHP_FILE_PHP', true);
// define your classes and functions here
} // endif _THIS_PHP_FILE_PHP
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On 14 Mar 2008, at 19:21, Eric Gorr wrote:
On Mar 14, 2008, at 3:15 PM, Eric Gorr wrote:
On Mar 14, 2008, at 3:10 PM, Stut wrote:
On 14 Mar 2008, at 19:03, Eric Gorr wrote:
Unfortunately, such things cannot be used to wrap functions.
Erm, yes they can. Try it.
?php
if (rand(0,1) == 0)
{
Posting Summary for PHP-General List
Week Ending: Friday, 14 March, 2008
Messages| Bytes | Sender
++--
480 (100%) 799678 (100%) EVERYONE
39 (8.1%)
-Original Message-
From: Eric Gorr [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2008 3:22 PM
To: PHP General
Subject: Re: [PHP] PHP and #if
On Mar 14, 2008, at 3:15 PM, Eric Gorr wrote:
On Mar 14, 2008, at 3:10 PM, Stut wrote:
On 14 Mar 2008, at 19:03, Eric Gorr
So... After this post gets sent... Does Dan have some code in here to
kill all traffic on the list for a minimum amount of time? :)
Happy Friday everyone!
On Mar 14, 2008, at 4:00 PM, PostTrack [Dan Brown] wrote:
Posting Summary for PHP-General List
Week Ending: Friday, 14
Hi! I have a simple PHP script:
$mbox = imap_open ({localhost:993/imap/ssl}INBOX, [EMAIL PROTECTED],
123);
if(!$mbox) {
echo 'Error: '.imap_last_error().'br/';
}
Script works fine from local PC, but results to error when executed at web
hoster site.
The error is: Error: Unable to
- Original Message -
From: Jason Pruim [EMAIL PROTECTED]
To: TG [EMAIL PROTECTED]
Cc: PHP General List php-general@lists.php.net
Date: Fri, 14 Mar 2008 14:56:32 -0400
Subject: Re: [PHP] Is this the best way?
On Mar 14, 2008, at 1:44 PM, TG wrote:
What error are you getting?
On Mar 14, 2008, at 5:03 PM, TG wrote:
- Original Message -
From: Jason Pruim [EMAIL PROTECTED]
To: TG [EMAIL PROTECTED]
Cc: PHP General List php-general@lists.php.net
Date: Fri, 14 Mar 2008 14:56:32 -0400
Subject: Re: [PHP] Is this the best way?
On Mar 14, 2008, at 1:44 PM, TG
On Friday 14 March 2008 21:24:30 Jason Pruim wrote:
So... After this post gets sent... Does Dan have some code in here to
kill all traffic on the list for a minimum amount of time? :)
no but he does some time travel.
merry christmas everyone! ;D
Happy Friday everyone!
On Mar 14, 2008, at
Then it's the other query (with the ORDER BY) that you want to look at to fix
the SQL error.
Don't forget to use (assuming MySQL) mysql_real_escape_string() on all
variables being used in the SQL query. That'll help prevent a problem with
single quotes or other bad characters showing up in
On Mar 14, 2008, at 5:40 PM, TG wrote:
Then it's the other query (with the ORDER BY) that you want to look
at to fix
the SQL error.
Don't forget to use (assuming MySQL) mysql_real_escape_string() on all
variables being used in the SQL query. That'll help prevent a
problem with
single
Jason Pruim wrote:
On Mar 14, 2008, at 5:03 PM, TG wrote:
- Original Message -
From: Jason Pruim [EMAIL PROTECTED]
To: TG [EMAIL PROTECTED]
Cc: PHP General List php-general@lists.php.net
Date: Fri, 14 Mar 2008 14:56:32 -0400
Subject: Re: [PHP] Is this the best way?
On Mar 14,
Hello Folks,
I would like to be able to wrap a 'form' inside a php 'if statement' - so
that the form will appear if the 'if condition' is met.
- most likely I cannot have a ?php tag inside another one - and am sure
I'm doing other things wrong also...
- now I get the error - Parse error:
On Fri, Mar 14, 2008 at 7:56 PM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
Hello Folks,
I would like to be able to wrap a 'form' inside a php 'if statement' - so
that the form will appear if the 'if condition' is met.
- most likely I cannot have a ?php tag inside another one - and am
On Fri, Mar 14, 2008 at 7:56 PM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
Hello Folks,
I would like to be able to wrap a 'form' inside a php 'if statement' - so
that the form will appear if the 'if condition' is met.
- most likely I cannot have a ?php tag inside another one - and am
Eric Butera wrote:
On Fri, Mar 14, 2008 at 6:02 AM, Zoltán Németh [EMAIL PROTECTED] wrote:
2008. 03. 14, péntek keltezéssel 14.08-kor Suamya Srivastava ezt írta:
Hi,
How can I send multiple values from a form to be stored in a database, as
name of the fields is the same?
For
On Fri, Mar 14, 2008 at 8:12 PM, Jim Lucas [EMAIL PROTECTED] wrote:
Eric Butera wrote:
On Fri, Mar 14, 2008 at 6:02 AM, Zoltán Németh [EMAIL PROTECTED] wrote:
2008. 03. 14, péntek keltezéssel 14.08-kor Suamya Srivastava ezt írta:
Hi,
How can I send multiple values from a
Am coding something. Cannot quite clear my head. I know what my SQL
looks like. I just cannot see clearly to input it.
What is $_POST[checkregion] going to look like? Is it going to have
all the convenient commas I will need in my SQL? Or do I have to parse
God knows how many checkboxes?
John
http://www.glquebec.org/English/test.php
When I check Knowlton and Thetford Mines or others, only Thetford
Mines shows up in phpinfo(). $_POST[checkregion] only sees Thetford
Mines.
What am I doing wrong? How do I parse value checkregion? Or set this up
differently?
input type=text
$_POST[checkregion] is supposed to be an array, no?
John Taylor-Johnston wrote:
http://www.glquebec.org/English/test.php
When I check Knowlton and Thetford Mines or others, only Thetford
Mines shows up in phpinfo(). $_POST[checkregion] only sees
Thetford Mines.
What am I doing wrong? How do I
On Fri, 2008-03-14 at 23:14 -0400, John Taylor-Johnston wrote:
$_POST[checkregion] is supposed to be an array, no?
You want the following (otherwise each checked entry overwrites the
previous):
input type=checkbox name=checkregion[] value=Knowlton /
input type=checkbox name=checkregion[]
Ah! ok,
Array
(
[0] = Hemmingford
[1] = Huntingdon
)
How do I set up my $sql?
$sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
values ('John', '.implode(',', $_POST['myvalues'].') ';
... Hey!! What is this?
Diagnostic-Code: smtp; 550-5.7.1 mail rejected by policy. SURBL
Will this do it?
$sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
values ('John', '.implode(',', serialise($_POST['checkregion']).') ';
http://ca.php.net/manual/en/function.serialize.php
Array
(
[0] = Hemmingford
[1] = Huntingdon
)
input type=checkbox
Sorry, will this work?
$sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
values ('John', '.serialise($_POST['checkregion']).') ';
John Taylor-Johnston wrote:
Will this do it?
$sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
values ('John', '.implode(',',
On Sat, 2008-03-15 at 00:18 -0400, John Taylor-Johnston wrote:
Sorry, will this work?
$sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
values ('John', '.serialise($_POST['checkregion']).') ';
Depends on what you want to do with the data. But you've certainly
spelled serialize()
Robert,
Array
(
[0] = Hemmingford
[1] = Huntingdon
)
You want the following (otherwise each checked entry overwrites the
previous):
input type=checkbox name=checkregion[] value=Knowlton /
input type=checkbox name=checkregion[] value=Thetford Mines /
How would you proceed?
$sql
On Sat, 2008-03-15 at 00:33 -0400, John Taylor-Johnston wrote:
Robert,
Array
(
[0] = Hemmingford
[1] = Huntingdon
)
You want the following (otherwise each checked entry overwrites the
previous):
input type=checkbox name=checkregion[] value=Knowlton /
input
Robert Cummings wrote:
On Sat, 2008-03-15 at 00:33 -0400, John Taylor-Johnston wrote:
Robert,
Array
(
[0] = Hemmingford
[1] = Huntingdon
)
You want the following (otherwise each checked entry overwrites the
previous):
input type=checkbox name=checkregion[] value=Knowlton /
input
On Sat, 2008-03-15 at 01:00 -0400, John Taylor-Johnston wrote:
Robert Cummings wrote:
On Sat, 2008-03-15 at 00:33 -0400, John Taylor-Johnston wrote:
Robert,
Array
(
[0] = Hemmingford
[1] = Huntingdon
)
You want the following (otherwise each checked entry overwrites the
84 matches
Mail list logo