php-general Digest 26 Feb 2009 12:47:57 -0000 Issue 5980
Topics (messages 288795 through 288813):
non-auto increment question
288795 by: PJ
288796 by: Gary W. Smith
288797 by: Ashley Sheridan
288801 by: Ashley Sheridan
288802 by: PJ
288803 by: Jerry Schwartz
288804 by: Jerry Schwartz
288807 by: Jim Lucas
288808 by: Jim Lucas
288809 by: Lester Caine
Can't set expect.timeout
288798 by: Clement Yui-Wah Lee
288799 by: Ashley Sheridan
288800 by: Clement Yui-Wah Lee
Re: Web Development work
288805 by: phphelp -- kbk
288806 by: 9el
Re: Spaces Not Detected from Regular Expression preg_match
288810 by: Alice Wei
Converting Euro sign
288811 by: Merlin Morgenstern
288812 by: Per Jessen
A puzzler (well, for me at least)
288813 by: Richard Heyes
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 ---
I want to insert a new table entry 1 number higher than the highest in
the field (id). I cannot use auto-increment.
And I want to show the value of the field to be added in an input field
on the web page:
if (isset($_REQUEST["AddNewBooksRequest"])) {
$SQL = "SELECT MAX(id) FROM book";
$result = mysql_query($sql, $db);
$bookCount = mysql_num_rows($result);
for ($i=0; $i < $bookCount; $i++) {
$row = mysql_fetch_array($result);
$idIN = $row["id"]+1;
}
$idIN = $_POST["idIN"];
$titleIN = $_POST["titleIN"];
...snip...
<td colspan="2">
<?
echo "<input type='text' name='titleIN' value='$idIN' disabled size='2'>";
?>
</td>
What am I doing wrong? (The query works and returns the right nr. but
what do I have to do to add 1 to that number and then display it in the
on page and post it to the table?
--
Phil Jourdan --- [email protected]
http://www.ptahhotep.com
http://www.chiccantine.com
--- End Message ---
--- Begin Message ---
Not sure that this is the problem BUT you should probably qualify the name of
the variable such that "SELECT MAX(id) AS id FROM book". But you don't want
"max(id) as id" but rather "max(id) + 1 as id". With that you can then just
return the final value. Also, if you don't want to alias the value (or
whatever it's called) you should use $row[0] to get it by ordinal posistion.
As for now wanting to use autoincrement, you can run into a race condition
where two people are inserting at the same time, thus having the same generated
id.
Hope that helps.
________________________________
From: PJ [mailto:[email protected]]
Sent: Wed 2/25/2009 2:01 PM
To: MySql; [email protected]
Subject: non-auto increment question
I want to insert a new table entry 1 number higher than the highest in
the field (id). I cannot use auto-increment.
And I want to show the value of the field to be added in an input field
on the web page:
if (isset($_REQUEST["AddNewBooksRequest"])) {
$SQL = "SELECT MAX(id) FROM book";
$result = mysql_query($sql, $db);
$bookCount = mysql_num_rows($result);
for ($i=0; $i < $bookCount; $i++) {
$row = mysql_fetch_array($result);
$idIN = $row["id"]+1;
}
$idIN = $_POST["idIN"];
$titleIN = $_POST["titleIN"];
...snip...
<td colspan="2">
<?
echo "<input type='text' name='titleIN' value='$idIN' disabled size='2'>";
?>
</td>
What am I doing wrong? (The query works and returns the right nr. but
what do I have to do to add 1 to that number and then display it in the
on page and post it to the table?
--
Phil Jourdan --- [email protected]
http://www.ptahhotep.com <http://www.ptahhotep.com/>
http://www.chiccantine.com <http://www.chiccantine.com/>
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[email protected]
--- End Message ---
--- Begin Message ---
On Wed, 2009-02-25 at 14:10 -0800, Gary W. Smith wrote:
> Not sure that this is the problem BUT you should probably qualify the name of
> the variable such that "SELECT MAX(id) AS id FROM book". But you don't want
> "max(id) as id" but rather "max(id) + 1 as id". With that you can then just
> return the final value. Also, if you don't want to alias the value (or
> whatever it's called) you should use $row[0] to get it by ordinal posistion.
>
> As for now wanting to use autoincrement, you can run into a race condition
> where two people are inserting at the same time, thus having the same
> generated id.
>
> Hope that helps.
>
>
> ________________________________
>
> From: PJ [mailto:[email protected]]
> Sent: Wed 2/25/2009 2:01 PM
> To: MySql; [email protected]
> Subject: non-auto increment question
>
>
>
> I want to insert a new table entry 1 number higher than the highest in
> the field (id). I cannot use auto-increment.
> And I want to show the value of the field to be added in an input field
> on the web page:
> if (isset($_REQUEST["AddNewBooksRequest"])) {
> $SQL = "SELECT MAX(id) FROM book";
> $result = mysql_query($sql, $db);
> $bookCount = mysql_num_rows($result);
> for ($i=0; $i < $bookCount; $i++) {
> $row = mysql_fetch_array($result);
> $idIN = $row["id"]+1;
> }
> $idIN = $_POST["idIN"];
> $titleIN = $_POST["titleIN"];
>
> ...snip...
>
> <td colspan="2">
> <?
> echo "<input type='text' name='titleIN' value='$idIN' disabled size='2'>";
> ?>
> </td>
>
> What am I doing wrong? (The query works and returns the right nr. but
> what do I have to do to add 1 to that number and then display it in the
> on page and post it to the table?
>
> --
>
> Phil Jourdan --- [email protected]
> http://www.ptahhotep.com <http://www.ptahhotep.com/>
> http://www.chiccantine.com <http://www.chiccantine.com/>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/[email protected]
>
>
>
Yeah, this sort of situation is really what auto increment is for. If
you get two people visiting the page with this code on at the same time
then you'll screw up your database.
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On Wed, 2009-02-25 at 19:03 -0500, PJ wrote:
> Ashley Sheridan wrote:
> > On Wed, 2009-02-25 at 14:10 -0800, Gary W. Smith wrote:
> >> Not sure that this is the problem BUT you should probably qualify the
> >> name of the variable such that "SELECT MAX(id) AS id FROM book". But
> >> you don't want "max(id) as id" but rather "max(id) + 1 as id". With
> >> that you can then just return the final value. Also, if you don't
> >> want to alias the value (or whatever it's called) you should use
> >> $row[0] to get it by ordinal posistion.
> >>
> >> As for now wanting to use autoincrement, you can run into a race
> >> condition where two people are inserting at the same time, thus
> >> having the same generated id.
> >>
> >> Hope that helps.
> >>
> >>
> >> ________________________________
> >>
> >> From: PJ [mailto:[email protected]]
> >> Sent: Wed 2/25/2009 2:01 PM
> >> To: MySql; [email protected]
> >> Subject: non-auto increment question
> >>
> >>
> >>
> >> I want to insert a new table entry 1 number higher than the highest in
> >> the field (id). I cannot use auto-increment.
> >> And I want to show the value of the field to be added in an input field
> >> on the web page:
> >> if (isset($_REQUEST["AddNewBooksRequest"])) {
> >> $SQL = "SELECT MAX(id) FROM book";
> >> $result = mysql_query($sql, $db);
> >> $bookCount = mysql_num_rows($result);
> >> for ($i=0; $i < $bookCount; $i++) {
> >> $row = mysql_fetch_array($result);
> >> $idIN = $row["id"]+1;
> Actually, I am wondering how to get rid of some of the code here as it
> seems a little bloated....
> How do I get rid of the row counting - since there can never be more
> than one row returned with this query.
> >> }
> >> $idIN = $_POST["idIN"];
> >> $titleIN = $_POST["titleIN"];
> >>
> >> ...snip...
> >>
> >> <td colspan="2">
> >> <?
> >> echo "<input type='text' name='titleIN' value='$idIN' disabled
> >> size='2'>";
> >> ?>
> >> </td>
> >>
> >> What am I doing wrong? (The query works and returns the right nr. but
> >> what do I have to do to add 1 to that number and then display it in the
> >> on page and post it to the table?
> >>
> >> --
> >>
> >> Phil Jourdan --- [email protected]
> >> http://www.ptahhotep.com <http://www.ptahhotep.com/>
> >> http://www.chiccantine.com <http://www.chiccantine.com/>
> >>
> >>
> >> --
> >> MySQL General Mailing List
> >> For list archives: http://lists.mysql.com/mysql
> >> To unsubscribe: http://lists.mysql.com/[email protected]
> >>
> >>
> >>
> > Yeah, this sort of situation is really what auto increment is for. If
> > you get two people visiting the page with this code on at the same time
> > then you'll screw up your database.
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> Being rather new to all this, I understood from the MySql manual that
> the auto_increment is to b e used immediately after an insertion not
> intermittently. My application is for administrators (the site owner &
> designates) to update the database from and administration directory,
> accessed by user/password login... so there's really very little
> possibility of 2 people accessing at the same time.
> By using MAX + 1 I keep the id number in the $idIn and can reuse it in
> other INSERTS
The auto increment value is automatically inserted by MySQL, just don't
specify what to put into that field when executing the sql statement in
PHP. You can have PHP return the value that was just inserted using the
auto_insert_id() function, which allows you to use it for other things,
like inserting into other tables for a relational database structure.
Also, depending on how the page is called, you could end up with one
user inserting the same value into the database. if the page is called
via get (i.e. a link on a page rather than as the result of a form) then
some browsers will actually (in an attempt to make things faster) call
the page more than once.
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
> On Wed, 2009-02-25 at 14:10 -0800, Gary W. Smith wrote:
>> Not sure that this is the problem BUT you should probably qualify the
>> name of the variable such that "SELECT MAX(id) AS id FROM book". But
>> you don't want "max(id) as id" but rather "max(id) + 1 as id". With
>> that you can then just return the final value. Also, if you don't
>> want to alias the value (or whatever it's called) you should use
>> $row[0] to get it by ordinal posistion.
>>
>> As for now wanting to use autoincrement, you can run into a race
>> condition where two people are inserting at the same time, thus
>> having the same generated id.
>>
>> Hope that helps.
>>
>>
>> ________________________________
>>
>> From: PJ [mailto:[email protected]]
>> Sent: Wed 2/25/2009 2:01 PM
>> To: MySql; [email protected]
>> Subject: non-auto increment question
>>
>>
>>
>> I want to insert a new table entry 1 number higher than the highest in
>> the field (id). I cannot use auto-increment.
>> And I want to show the value of the field to be added in an input field
>> on the web page:
>> if (isset($_REQUEST["AddNewBooksRequest"])) {
>> $SQL = "SELECT MAX(id) FROM book";
>> $result = mysql_query($sql, $db);
>> $bookCount = mysql_num_rows($result);
>> for ($i=0; $i < $bookCount; $i++) {
>> $row = mysql_fetch_array($result);
>> $idIN = $row["id"]+1;
Actually, I am wondering how to get rid of some of the code here as it
seems a little bloated....
How do I get rid of the row counting - since there can never be more
than one row returned with this query.
>> }
>> $idIN = $_POST["idIN"];
>> $titleIN = $_POST["titleIN"];
>>
>> ...snip...
>>
>> <td colspan="2">
>> <?
>> echo "<input type='text' name='titleIN' value='$idIN' disabled
>> size='2'>";
>> ?>
>> </td>
>>
>> What am I doing wrong? (The query works and returns the right nr. but
>> what do I have to do to add 1 to that number and then display it in the
>> on page and post it to the table?
>>
>> --
>>
>> Phil Jourdan --- [email protected]
>> http://www.ptahhotep.com <http://www.ptahhotep.com/>
>> http://www.chiccantine.com <http://www.chiccantine.com/>
>>
>>
>> --
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe: http://lists.mysql.com/[email protected]
>>
>>
>>
> Yeah, this sort of situation is really what auto increment is for. If
> you get two people visiting the page with this code on at the same time
> then you'll screw up your database.
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
Being rather new to all this, I understood from the MySql manual that
the auto_increment is to b e used immediately after an insertion not
intermittently. My application is for administrators (the site owner &
designates) to update the database from and administration directory,
accessed by user/password login... so there's really very little
possibility of 2 people accessing at the same time.
By using MAX + 1 I keep the id number in the $idIn and can reuse it in
other INSERTS
--
Phil Jourdan --- [email protected]
http://www.ptahhotep.com
http://www.chiccantine.com
--- End Message ---
--- Begin Message ---
>Being rather new to all this, I understood from the MySql manual that
>the auto_increment is to b e used immediately after an insertion not
>intermittently. My application is for administrators (the site owner &
>designates) to update the database from and administration directory,
>accessed by user/password login... so there's really very little
>possibility of 2 people accessing at the same time.
>By using MAX + 1 I keep the id number in the $idIn and can reuse it in
>other INSERTS
[JS] Are you looking for something like LAST_INSERT_ID()? If you INSERT a
record that has an auto-increment field, you can retrieve the value that got
inserted with "SELECT LAST_INSERT_ID()". It is connection-specific, so
you'll always have your "own" value. You can then save it to reuse, either
as a session variable or (more easily) as a hidden field on your form.
Regards,
Jerry Schwartz
The Infoshop by Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032
860.674.8796 / FAX: 860.674.8341
www.the-infoshop.com
www.giiexpress.com
www.etudes-marche.com
>--
>
>Phil Jourdan --- [email protected]
>http://www.ptahhotep.com
>http://www.chiccantine.com
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe: http://lists.mysql.com/mysql?unsub=jschwa...@the-
>infoshop.com
--- End Message ---
--- Begin Message ---
>Being rather new to all this, I understood from the MySql manual that
>the auto_increment is to b e used immediately after an insertion not
>intermittently. My application is for administrators (the site owner &
>designates) to update the database from and administration directory,
>accessed by user/password login... so there's really very little
>possibility of 2 people accessing at the same time.
[JS] Being rather old to all this, I can tell you that if something is even
remotely possible it will happen just before your performance review. Never
depend upon this.
Regards,
Jerry Schwartz
The Infoshop by Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032
860.674.8796 / FAX: 860.674.8341
www.the-infoshop.com
www.giiexpress.com
www.etudes-marche.com
>By using MAX + 1 I keep the id number in the $idIn and can reuse it in
>other INSERTS
>--
>
>Phil Jourdan --- [email protected]
>http://www.ptahhotep.com
>http://www.chiccantine.com
>
>--
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe: http://lists.mysql.com/mysql?unsub=jschwa...@the-
>infoshop.com
--- End Message ---
--- Begin Message ---
PJ wrote:
From: PJ [mailto:[email protected]]
Sent: Wed 2/25/2009 2:01 PM
To: MySql; [email protected]
Subject: non-auto increment question
I want to insert a new table entry 1 number higher than the highest in
the field (id). I cannot use auto-increment.
And I want to show the value of the field to be added in an input field
on the web page:
if (isset($_REQUEST["AddNewBooksRequest"])) {
$SQL = "SELECT MAX(id) FROM book";
$result = mysql_query($sql, $db);
$bookCount = mysql_num_rows($result);
for ($i=0; $i < $bookCount; $i++) {
$row = mysql_fetch_array($result);
$idIN = $row["id"]+1;
Actually, I am wondering how to get rid of some of the code here as it
seems a little bloated....
How do I get rid of the row counting - since there can never be more
than one row returned with this query.
Ok, so, you want to know how to do this "your way" with a little less
code? Give this a try:
<?php
$id = null;
if (isset($_REQUEST["AddNewBooksRequest"])) {
$SQL = "SELECT MAX(id)+1 AS id FROM book LIMIT 1";
if ( ( $result = mysql_query($sql, $db) ) !== false ) {
while ( $row = mysql_fetch_row($result) ) {
list($id) = $row;
}
}
}
$idIN = $_POST["idIN"];
$titleIN = $_POST["titleIN"];
?>
<td colspan="2">
<input type='text'
name='id'
value='<?php echo $id; ?>'
disabled="disabled"
size='2'
/>
</td>
}
$idIN = $_POST["idIN"];
$titleIN = $_POST["titleIN"];
...snip...
<td colspan="2">
<?
echo "<input type='text' name='titleIN' value='$idIN' disabled
size='2'>";
?>
Ok, so, I am confused. You are asking about and $id variable, yet you
show us code that attempts to insert the $idIN variable into a hidden
field for the $titleIN variable. Did you cut/paste the wrong segment of
code or is this what you are actually trying to use? if it is the
latter, then that explains why your above example is not working like
you would expect...
Anyways, you will note that in the above example I corrected the
variable/name mismatch. If I have it wrong sorry.
</td>
What am I doing wrong? (The query works and returns the right nr. but
what do I have to do to add 1 to that number and then display it in the
on page and post it to the table?
--
--- End Message ---
--- Begin Message ---
Jim Lucas wrote:
PJ wrote:
From: PJ [mailto:[email protected]]
Sent: Wed 2/25/2009 2:01 PM
To: MySql; [email protected]
Subject: non-auto increment question
I want to insert a new table entry 1 number higher than the highest in
the field (id). I cannot use auto-increment.
And I want to show the value of the field to be added in an input field
on the web page:
if (isset($_REQUEST["AddNewBooksRequest"])) {
$SQL = "SELECT MAX(id) FROM book";
$result = mysql_query($sql, $db);
$bookCount = mysql_num_rows($result);
for ($i=0; $i < $bookCount; $i++) {
$row = mysql_fetch_array($result);
$idIN = $row["id"]+1;
Actually, I am wondering how to get rid of some of the code here as it
seems a little bloated....
How do I get rid of the row counting - since there can never be more
than one row returned with this query.
Ok, so, you want to know how to do this "your way" with a little less
code? Give this a try:
<?php
$id = null;
if (isset($_REQUEST["AddNewBooksRequest"])) {
$SQL = "SELECT MAX(id)+1 AS id FROM book LIMIT 1";
if ( ( $result = mysql_query($sql, $db) ) !== false ) {
Note: the above will not work either. You need to watch the case on your
variable names.
You define $SQL = '' but then use $sql... That won't work, you need to have
them the same case!
while ( $row = mysql_fetch_row($result) ) {
list($id) = $row;
}
}
}
$idIN = $_POST["idIN"];
$titleIN = $_POST["titleIN"];
?>
<td colspan="2">
<input type='text'
name='id'
value='<?php echo $id; ?>'
disabled="disabled"
size='2'
/>
</td>
}
$idIN = $_POST["idIN"];
$titleIN = $_POST["titleIN"];
...snip...
<td colspan="2">
<?
echo "<input type='text' name='titleIN' value='$idIN' disabled
size='2'>";
?>
Ok, so, I am confused. You are asking about and $id variable, yet you
show us code that attempts to insert the $idIN variable into a hidden
field for the $titleIN variable. Did you cut/paste the wrong segment of
code or is this what you are actually trying to use? if it is the
latter, then that explains why your above example is not working like
you would expect...
Anyways, you will note that in the above example I corrected the
variable/name mismatch. If I have it wrong sorry.
</td>
What am I doing wrong? (The query works and returns the right nr. but
what do I have to do to add 1 to that number and then display it in the
on page and post it to the table?
--
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
--- End Message ---
--- Begin Message ---
PJ wrote:
Being rather new to all this, I understood from the MySql manual that
the auto_increment is to b e used immediately after an insertion not
intermittently. My application is for administrators (the site owner &
designates) to update the database from and administration directory,
accessed by user/password login... so there's really very little
possibility of 2 people accessing at the same time.
By using MAX + 1 I keep the id number in the $idIn and can reuse it in
other INSERTS
The real way of doing this is via a facility in the sql standard called
SEQUENCE. Libraries like ADOdb emulate this for MySQL which does not
support it. The method provides a unique series of numbers, so that if
two people are adding things they do not get the same one. As has been
pointed out, AUTOINC only knows the number after the event, but often
you DO need to know the number to populate the detail tables, and while
writing the master and getting the 'last_id' can work, a simple call to
get the next value of the sequence is tidier.
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
--- End Message ---
--- Begin Message ---
Hi,
Apparently I can't set the value for expect.timeout to any
values other than 0 (the default is 10). Can someone try
the following script and see if you see the same problem as
me? My php is 5.1.6, php-expect is 0.2.4, the platform is a
Redhat Enterprise Linux 5.3
Test method:
1. Drop the following script onto your php server machine
(use a different ini_set() line in each successive test).
2. Use a browser to execute the script and see what
phpinfo() would return the value for expect.timeout (and
expect.logfile)
<?php
// ini_set("expect.timeout", "0"); // This worked
// ini_set("expect.timeout", 0); // This worked
// ini_set("expect.timeout", 1); // No effect
// ini_set("expect.timeout", 5); // No effect
// ini_set("expect.timeout", "5"); // No effect
ini_set("expect.timeout", "50"); // No effect
ini_set("expect.logfile", "/tmp/tmp"); // This worked
phpinfo();
?>
Thanks!
Clement
--- End Message ---
--- Begin Message ---
On Wed, 2009-02-25 at 18:08 -0500, Clement Yui-Wah Lee wrote:
> Hi,
>
> Apparently I can't set the value for expect.timeout to any
> values other than 0 (the default is 10). Can someone try
> the following script and see if you see the same problem as
> me? My php is 5.1.6, php-expect is 0.2.4, the platform is a
> Redhat Enterprise Linux 5.3
>
> Test method:
>
> 1. Drop the following script onto your php server machine
> (use a different ini_set() line in each successive test).
>
> 2. Use a browser to execute the script and see what
> phpinfo() would return the value for expect.timeout (and
> expect.logfile)
>
>
> <?php
> // ini_set("expect.timeout", "0"); // This worked
> // ini_set("expect.timeout", 0); // This worked
> // ini_set("expect.timeout", 1); // No effect
> // ini_set("expect.timeout", 5); // No effect
> // ini_set("expect.timeout", "5"); // No effect
> ini_set("expect.timeout", "50"); // No effect
>
> ini_set("expect.logfile", "/tmp/tmp"); // This worked
> phpinfo();
>
> ?>
>
> Thanks!
>
> Clement
>
Do you have permissions to change this ini setting? Some hosting
companies disallow certain variables to be set through ini_set and only
allow them to be done via .htaccess, and some go even further by
disallowing certain ones to be changed at all. Have you tried it on a
different hosting (i.e. on your local machine) ?
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Ash,
Thanks for your answer. I am quite sure that I do have the
needed permission to effect the change. As you can tell
from my test script, I was able to set timeout to 0 (zero),
and I could also set logfile to "/tmp/tmp". I just could
not set timeout to any values other than 0 or the default
value of 10.
I was testing on a local machine.
Thanks!
Clement
Ashley Sheridan wrote:
On Wed, 2009-02-25 at 18:08 -0500, Clement Yui-Wah Lee wrote:
Hi,
Apparently I can't set the value for expect.timeout to any
values other than 0 (the default is 10). Can someone try
the following script and see if you see the same problem as
me? My php is 5.1.6, php-expect is 0.2.4, the platform is a
Redhat Enterprise Linux 5.3
Test method:
1. Drop the following script onto your php server machine
(use a different ini_set() line in each successive test).
2. Use a browser to execute the script and see what
phpinfo() would return the value for expect.timeout (and
expect.logfile)
<?php
// ini_set("expect.timeout", "0"); // This worked
// ini_set("expect.timeout", 0); // This worked
// ini_set("expect.timeout", 1); // No effect
// ini_set("expect.timeout", 5); // No effect
// ini_set("expect.timeout", "5"); // No effect
ini_set("expect.timeout", "50"); // No effect
ini_set("expect.logfile", "/tmp/tmp"); // This worked
phpinfo();
?>
Thanks!
Clement
Do you have permissions to change this ini setting? Some hosting
companies disallow certain variables to be set through ini_set and only
allow them to be done via .htaccess, and some go even further by
disallowing certain ones to be changed at all. Have you tried it on a
different hosting (i.e. on your local machine) ?
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Hello -- - Ernie -- -- -
Consulting work is a business. Work doesn't fall from the sky. You
have to figure out what you do. Not good enough to say "I'm a
programmer" -- that and a dollar will get you half-a-cup of coffee at
McDonalds.
Figure out where your strengths are. Figure out where you have or can
cultivate contacts. Spread the word. If you don't have a demonstrable
portfolio of projects from your employer or clients that you can show
or discuss with others, you had better develop one. Do you have an
industry that you know more about than the average developer? Do you
have graphics skills, too? Do you understand how a business works?
Every unemployed programmer calls himself a Web Developer. Every
unemployed graphic designer calls himself a Web Designer. People who
have been doing one or both for *years* call themselves the same
thing. Most potential customers have no clue who is good or bad. Can
you do the design work, or just the programming work. This isn't a
place to get work; (based on the nature of your questions) there are
100s of folks here with more experience and savvy than you, and I bet
every one of the independents have room for more clients.
I have been in this business for 20 years. If you are flailing around
asking naive questions like this, you probably are better off with a
job. Maybe 10 years ago, someone with mid-level skills and no
business acumen could be a successful "web developer" just because
the industry was growing so fast and there were so few people with
real skills. Now the situation is the opposite: there are lots and
lots of people with skills. There are still jobs around, but you have
to work harder to get them.
If you want to be in business, you need to think like a business
person (who just happens to have a technical set of skills).
Good luck,
Ken
--- End Message ---
--- Begin Message ---
Very wise words or wisdom Ken. And Ernie, I just gave you most of the
renowned places where freelancers or even large companies bid for works.
There are programmers like you and as Ken said, even thousand times better
programmers than you who are going along the way. Its a wonder how you do
not know those names. You just gotta be friends with the google.
A software engineer doesnt mean that he is god. And web developer doesnt
mean unemployed. I and my team is member with lot other freelancing sites
and have local and overseas permanent clients for whom we working remotely.
Starting from making a blog to making crawler or video upload/download site.
Or, real-estate sales, rental with Map API integrated search results. Or,
say Facebook applications or iPhone apps!
We just need to learn fast the best of the technologies with the best of the
methods and yet we have to be business oriented.
Thanks
Lenin
www.twitter.com/nine_L
-----------------------------------------------------------------------
Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get
a Free CD of Ubuntu mailed to your door without any cost. Visit :
www.ubuntu.com
----------------------------------------------------------------------
2009/2/26 phphelp -- kbk <[email protected]>
> Hello -- - Ernie -- -- -
>
> Consulting work is a business. Work doesn't fall from the sky. You have to
> figure out what you do. Not good enough to say "I'm a programmer" -- that
> and a dollar will get you half-a-cup of coffee at McDonalds.
>
> Figure out where your strengths are. Figure out where you have or can
> cultivate contacts. Spread the word. If you don't have a demonstrable
> portfolio of projects from your employer or clients that you can show or
> discuss with others, you had better develop one. Do you have an industry
> that you know more about than the average developer? Do you have graphics
> skills, too? Do you understand how a business works?
>
> Every unemployed programmer calls himself a Web Developer. Every unemployed
> graphic designer calls himself a Web Designer. People who have been doing
> one or both for *years* call themselves the same thing. Most potential
> customers have no clue who is good or bad. Can you do the design work, or
> just the programming work. This isn't a place to get work; (based on the
> nature of your questions) there are 100s of folks here with more experience
> and savvy than you, and I bet every one of the independents have room for
> more clients.
>
> I have been in this business for 20 years. If you are flailing around
> asking naive questions like this, you probably are better off with a job.
> Maybe 10 years ago, someone with mid-level skills and no business acumen
> could be a successful "web developer" just because the industry was growing
> so fast and there were so few people with real skills. Now the situation is
> the opposite: there are lots and lots of people with skills. There are still
> jobs around, but you have to work harder to get them.
>
> If you want to be in business, you need to think like a business person
> (who just happens to have a technical set of skills).
>
> Good luck,
>
> Ken
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
> To: [email protected]
> Date: Wed, 25 Feb 2009 14:42:36 -0600
> From: [email protected]
> Subject: [PHP] Re: Spaces Not Detected from Regular Expression preg_match
>
> Shawn McKenzie wrote:
> > Shawn McKenzie wrote:
> >> Alice Wei wrote:
> >>> Hi,
> >>>
> >>> I have a code as in the following:
> >>>
> >>> <?php
> >>>
> >>> $file = "test.txt";
> >>> $fp = fopen($file, "r");
> >>>
> >>> while(!feof($fp)) {
> >>> $data = fgets($fp, 1024);
> >>>
> >>> if ((preg_match("/0/",$data)) ||
> >>> (preg_match("/\"\s\"/",$data)) ||
> >>> (preg_match("/\"\s\"/",$data))) {
> >>> //Don't do a thing
> >>> }
> >>>
> >>> }
> >>> fclose($fp);
> >>>
> >>> ?>
> >>>
> >>>
> >>> This is the input file:
> >>>
> >>> 1
> >>> 23kd
> >>> 3dkd2
> >>> " "
> >>> 4
> >>> 5
> >>> 6
> >>>
> >>> For the output, I get nothing running it from the command prompt, but I
> >>> would like to have " " in the output,
> >>> could anyone please give me some guides on what I have done wrong in my
> >>> regular expression?
> >>>
> >>> Thanks for your help.
> >>>
> >>> Alice
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> _________________________________________________________________
> >>> Search from any Web page with powerful protection. Get the FREE Windows
> >>> Live Toolbar Today!
> >>> http://get.live.com/toolbar/overview
> >> Ummm... #1 you haven't "output" anything in your code. Your code says,
> >> if " " is found in $data, then "Don't do a thing".
> >>
> >>
> >>
> >
> > So if your wanting to see if there is a match in the line and return the
> > match (which in this example seems pointless because you know that you
> > are matching ""), then something like this:
> >
> > if (preg_match("/0/",$data, $matches) ||
> > preg_match("/\"\s\"/",$data, $matches))
> > {
> > print_r($matches);
> > }
> >
> > BTW, the second and third conditions in your if appeared to be the same,
> > also \s matches whitespace, spaces, tabs, returns, etc...
> >
>
> I'll wait for a reply with more information as the more I look at your
> code it seems your off on a strange track. I don't know the variability
> of your input data, but if you had a line 0 " " then the first
> preg_match would match the 0 and not the " ". Maybe that's what you
> want, dunno...
Thanks, but I found that using line numbers of each and its remainder by a
certain number works etter than using regular expressions here, since there is
a lot of variability in the data from line to line.
Alice
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
_________________________________________________________________
Express yourself with gadgets on Windows Live Spaces
http://discoverspaces.live.com?source=hmtag1&loc=us
--- End Message ---
--- Begin Message ---
Hello everybody,
I have an xml-file where a euro sign is in. Now the sign shows up as
questionmark after importing into a mysql db.
On the utf_8_decode site I found that iconv will help here, but first of
all I do not even know if the xml file is utf8encoded (I doubt it),
and secondly I do not want to install another module just for this.
Any ideas on how to build a workaround?
Thank you for any hint,
Merlin
--- End Message ---
--- Begin Message ---
Merlin Morgenstern wrote:
> Hello everybody,
>
> I have an xml-file where a euro sign is in. Now the sign shows up as
> questionmark after importing into a mysql db.
Check the character set of your mysql table.
> On the utf_8_decode site I found that iconv will help here, but first
> of all I do not even know if the xml file is utf8encoded (I doubt it),
It should say in the XML file.
--
Per Jessen, Zürich (3.2°C)
--- End Message ---
--- Begin Message ---
Hi,
I've been recently wondering (musing if you will) about timings, and
roughly how long, in a very real sense, it takes on a modern computer
for a single line of PHP, or Javascript (or interpreted code in
general) to execute. Nanoseconds? Quicker?
You could say I have too much time on my hands...
Cheers.
--
Richard Heyes
HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)
--- End Message ---