[PHP] APC + PHP Problem (apc_fcntl_lock failed: Bad file descriptor)

2008-06-01 Thread Scott McNaught [Synergy 8]
Hello,

I am running a production server with APC and php. We recently had a crash
where APC bombed out. When it does this, the server serves empty, white
pages.

Here is what the error_log says.

[Mon Jun  2 11:20:36 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun 02 11:20:37 2008] [notice] child pid 6104 exit signal Segmentation
fault (11)
[Mon Jun  2 11:20:40 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:40 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:41 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:41 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:41 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:42 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:43 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:45 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
[Mon Jun  2 11:20:45 2008] [apc-error] apc_fcntl_lock failed: Bad file
descriptor
...
And so it goes on until apache was restarted.



I have not yet found a resolution for this.  There are no calls made to
apc_store() on the server. It is solely script caching.  

I have seen bug reports on this:
http://pecl.php.net/bugs/bug.php?id=4769 
http://pecl.php.net/bugs/bug.php?id=9745 

After looking at these, I think what is happening is the cache is filling
up, and when it expunge()s it gets in a loop, php kills the process after
the 30sec timeout, and the lock is left. Then no more subsequent requests
can be served.

Has anyone else experienced this, and does anyone know of a fix for this?


I am running PHP 5.2.5, and APC 3.0.15. This is the PHP info for APC.

APC Support  enabled  
Version  3.0.15  
MMAP Support  Enabled  
MMAP File Mask  no value  
Locking type  File Locks  
Revision  $Revision: 3.151 $  
Build Date  Oct 29 2007 19:02:05  

Directive Local Value Master Value 
apc.cache_by_default On On 
apc.enable_cli Off Off 
apc.enabled On On 
apc.file_update_protection 2 2 
apc.filters no value no value 
apc.gc_ttl 3600 3600 
apc.include_once_override Off Off 
apc.localcache Off Off 
apc.localcache.size 512 512 
apc.max_file_size 1M 1M 
apc.mmap_file_mask no value no value 
apc.num_files_hint 1000 1000 
apc.report_autofilter Off Off 
apc.rfc1867 Off Off 
apc.rfc1867_freq 0 0 
apc.rfc1867_name APC_UPLOAD_PROGRESS APC_UPLOAD_PROGRESS 
apc.rfc1867_prefix upload_ upload_ 
apc.shm_segments 1 1 
apc.shm_size 30 30 
apc.slam_defense 0 0 
apc.stat On On 
apc.stat_ctime Off Off 
apc.ttl 0 0 
apc.user_entries_hint 4096 4096 
apc.user_ttl 0 0 
apc.write_lock On On


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



[PHP] basic php problem

2006-06-15 Thread Ross

I want to set a page number of a page

if(!isset($_REQUEST['page'])) {
$page =$_REQUEST['page'] + 1;
echo page is .$page; // this echos out page is 1


}


The problem is when I try and use $page further down in the body $page is 0

Question ?=$page; ? BR /
? echo page is.$page; ?
?=$question[($page-1)]; ?


I also get an undefined index notice

Notice: Undefined index: page in 
c:\Inetpub\wwwroot\lss\module_one\evaluation.php on line 8
page is 1

but I though if I do a if(!isset($_REQUEST['page'])) this is the way to set 
a previously undefined index?

Ross

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



Re: [PHP] basic php problem

2006-06-15 Thread nicolas figaro

Ross a écrit :

I want to set a page number of a page

if(!isset($_REQUEST['page'])) {
$page =$_REQUEST['page'] + 1;
echo page is .$page; // this echos out page is 1


}


The problem is when I try and use $page further down in the body $page is 0

Question ?=$page; ? BR /
? echo page is.$page; ?
?=$question[($page-1)]; ?


I also get an undefined index notice

Notice: Undefined index: page in 
c:\Inetpub\wwwroot\lss\module_one\evaluation.php on line 8

page is 1

but I though if I do a if(!isset($_REQUEST['page'])) this is the way to set 
a previously undefined index?


  

you have to check if page exists in $_REQUEST

if (!array_key_exists($_REQUEST,page))
{ $page = 1;
}

why do you wish to add something that's not set to a constant value ?

$page =$_REQUEST['page'] + 1;


NF

Ross

  


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



Re: [PHP] basic php problem

2006-06-15 Thread nicolas figaro

nicolas figaro a écrit :

Ross a écrit :

I want to set a page number of a page

if(!isset($_REQUEST['page'])) {
$page =$_REQUEST['page'] + 1;
echo page is .$page; // this echos out page is 1


}


The problem is when I try and use $page further down in the body 
$page is 0


Question ?=$page; ? BR /
? echo page is.$page; ?
?=$question[($page-1)]; ?



2nd try (did I miss the question at first try ?)
$page is local to your curly brackets if it's not used upper in your code.
try to put $page = 0;  before the if statement.

N F

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



Re: [PHP] basic php problem

2006-06-15 Thread Dave Goodchild

On 15/06/06, Ross [EMAIL PROTECTED] wrote:



I want to set a page number of a page

if(!isset($_REQUEST['page'])) {
$page =$_REQUEST['page'] + 1;
echo page is .$page; // this echos out page is 1


}


The problem is when I try and use $page further down in the body $page is
0

Question ?=$page; ? BR /
? echo page is.$page; ?
?=$question[($page-1)]; ?


I also get an undefined index notice

Notice: Undefined index: page in
c:\Inetpub\wwwroot\lss\module_one\evaluation.php on line 8
page is 1

but I though if I do a if(!isset($_REQUEST['page'])) this is the way to
set
a previously undefined index?

Ross


Firstly, there is no need to set the page by adding 1 to $_REQUEST['page']

if $_REQUEST['page'] is not set, why not do this:

$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;

(ternary operator)






--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


Re: [PHP] basic php problem

2006-06-15 Thread D. Dante Lorenso

Dave Goodchild wrote:

if $_REQUEST['page'] is not set, why not do this:
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
(ternary operator)


// test, numeric read, with default and bounds checking
$page = empty($_REQUEST['page']) ? 1 : intval($_REQUEST['page']);
$page = min(max($page, 1), $MAX_PAGE);

Dante

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



Re: [PHP] basic php problem

2006-06-15 Thread Richard Lynch
On Thu, June 15, 2006 8:11 am, Ross wrote:

 I want to set a page number of a page

 if(!isset($_REQUEST['page'])) {
 $page =$_REQUEST['page'] + 1;

These two together make no sense at all...

If the $_REQUEST['page'] is NOT set, then why use it?  It's NOT THERE.

 echo page is .$page; // this echos out page is 1
 }

Here is a more sensible approach:

//use page requested, or default to page 1:
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;

You can write that as a 6-line if statement if you like:

if (isset($_REQUEST['page']){
  $page = $_REQUEST['page'];
}
else{
  $page = 1;
}

 The problem is when I try and use $page further down in the body $page
 is 0

In that case, you are on ?page=2 in your script, and you didn't do
ANYTHING about $page in the original version.

 Question ?=$page; ? BR /
 ? echo page is.$page; ?
 ?=$question[($page-1)]; ?


 I also get an undefined index notice

 Notice: Undefined index: page in
 c:\Inetpub\wwwroot\lss\module_one\evaluation.php on line 8
 page is 1

 but I though if I do a if(!isset($_REQUEST['page'])) this is the way
 to set
 a previously undefined index?

No.

isset() CHECKS if a variable/index is set.  It does not alter anything
at all.  It just tests.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] R: [PHP] Problem with Frames and Sessions

2005-11-28 Thread Sebastian \En3pY\ Zdrojewski
Change the logon script. The cookies of each frame are loaded separately, so
if you want the session to be active in all the frames, at least once you
got to reload them. The easiest way, I think, is to change the logon script:
put it on a main page and once the user is logged in, create the frameset.
The session will be available in all the frames.

Cheers,

En3pY 


Sebastian Konstanty Zdrojewski 



URL: http://www.en3py.net/
E-Mail: [EMAIL PROTECTED]



Le informazioni contenute in questo messaggio sono riservate e
confidenziali. Il loro utilizzo è consentito esclusivamente al destinatario
del messaggio, per le finalità indicate nel messaggio stesso. Qualora Lei
non fosse la persona a cui il presente messaggio è destinato, La invito ad
eliminarlo dal Suo Sistema ed a distruggere le varie copie o stampe, dandone
gentilmente comunicazione. Ogni utilizzo improprio è contrario ai principi
del D.lgs 196/03 e alla legislazione Europea (Direttiva 2002/58/CE). 

-Messaggio originale-
Da: Shaun [mailto:[EMAIL PROTECTED] 
Inviato: martedì 29 novembre 2005 0.53
A: php-general@lists.php.net
Oggetto: [PHP] Problem with Frames and Sessions

Hi,

I have a frameset with a left column and a main column. I have a login
script with a form in the left column. When I log in I get a menu in the
left column which targets to the main column. My problem is that when I
click on links in the left column nothing appears in the main frame, however
if I refresh the browser then the links work. I am sure this must be a PHP
session problem but I don't have any experience using frames, does anyone
have suggestions as to what the problem might be?

Thanks for your advice.

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

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.8/184 - Release Date: 27/11/2005
 


smime.p7s
Description: S/MIME cryptographic signature


[PHP] Wierd PHP Problem

2005-02-23 Thread Ahmed Abdel-Aliem
Hi 
i use the following code as a login page for a restricted area
it works fine on some servers when i enter the right username and password
but it doesn't work on some servers when i enter the right username
and password, and returns wrong username and password
can any one tell me what possible reasons could make this code works
on some servers and doesn't on other servers ?

here is the code :
?
session_start();  
include 'config.php'; 
$username = $HTTP_POST_VARS['username']; 
$password = $HTTP_POST_VARS['password']; 
if((!$username) || (!$password)){ 
include 'header.html';
echo font color=\#99\bPlease enter ALL of the
information!/b/font br /;
include 'login_form.html'; 
include 'footer.html'; 
exit(); 
}
$sql = mysql_query(SELECT * FROM users WHERE username='$username'
AND password='$password');
$login_check = mysql_num_rows($sql); 
if($login_check  0){
session_register('user_id'); 
$_SESSION['user_id'] = $user_id;  
while($row = mysql_fetch_array($sql)){ 
foreach( $row AS $key = $val ){ 
$$key = stripslashes( $val ); 
} 
session_register('username'); 
$_SESSION['username'] = $username; 
header(Location: login_success.php); 
 }
}else{
include 'header.html';
echo font color=\#99\bYou could not be logged in! 
Either
the username and password do not match!/b/fontbr /
font color=\#99\bPlease try again!/b/fontbr /; 
include 'login_form.html'; 
include 'footer.html'; 
}
?

-- 
Ahmed Abdel-Aliem
Web Developer
www.ApexScript.com
0101108551

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



Re: [PHP] Wierd PHP Problem

2005-02-23 Thread Matthew Fonda
$HTTP_*_VARS is deprecated in PHP5, so if the server is running PHP5,
this code won't work. Instead, you should use $_POST

 $username = $HTTP_POST_VARS['username']; 
 $password = $HTTP_POST_VARS['password']; 

change to:
$username = $_POST['username']; 
$password = $_POST['password']; 

-- 
Regards,
Matthew Fonda
http://mfonda.info

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



Re: [PHP] Wierd PHP Problem

2005-02-23 Thread Will Beers
Matthew Fonda wrote:
$HTTP_*_VARS is deprecated in PHP5, so if the server is running PHP5,
this code won't work. Instead, you should use $_POST
On this subject, is there anything 'wrong' with using $_REQUEST instead of 
specifying between $_POST and $_GET?

Will Beers


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PHP] Wierd PHP Problem

2005-02-23 Thread Leif Gregory
Hello Will,

Wednesday, February 23, 2005, 2:39:27 PM, you wrote:
W On this subject, is there anything 'wrong' with using $_REQUEST
W instead of specifying between $_POST and $_GET?


$_REQUEST includes POST, GET, and cookies. It basically boils down to
knowing where the information is coming from.

If they should *only* be able to log in from a login screen and the
form method is POST, then you should only be checking POST variables
for a match.




-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

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



Re: [PHP] Wierd PHP Problem

2005-02-23 Thread Robby Russell
On Wed, 2005-02-23 at 16:39 -0500, Will Beers wrote:
 Matthew Fonda wrote:
  $HTTP_*_VARS is deprecated in PHP5, so if the server is running PHP5,
  this code won't work. Instead, you should use $_POST
 
 On this subject, is there anything 'wrong' with using $_REQUEST instead of 
 specifying between $_POST and $_GET?
 
 Will Beers

It really depends on the circumstance. Typically, do not use it unless
you are totally okay with the data coming from $_GET or $_POST. For
security-minded people, it's best to not use this unless you really need
to.

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting  Development
* --- Now hosting Ruby on Rails Apps ---
/

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



[PHP] Apache2 + PHP problem

2004-10-22 Thread Marco Stranieri








Hi,

Ive a problem when I start apaci on my server:



[EMAIL PROTECTED] bin]$ ./apachectl start

Syntax error on line 232 of
/usr/local/apache2/conf/httpd.conf:

Cannot load /usr/lib/apache/libphp4.so into server:
/usr/lib/apache/libphp4.so: undefined symbol: ap_block_alarms



The config param are following:



cd /usr/local/httpd

./configure --prefix=/usr/local/apache2
--enable-module=so --enable-cache --enable-disk-cache --enable-mem-cache
--enable-mime-magic --enable-expires --enable-headers --enable-usertrack
--enable-unique-id --enable-ssl --enable-http --enable-info --disable-cgi
--enable-vhost-alias --enable-shared=max --enable-rule=SHARED_CORE; make; make
install

cd /usr/local/php

./configure --prefix=/usr/local/php
--with-apache2=/usr/local/httpd --without-mysql --with-xml --with-pgsql
--with-zlib-dir=/usr/lib/ --enable-sysvshm=yes --enable-sysvsem=yes
--enable-track-vars --enable-force-cgi-redirect --enable-safe-mode
--enable-magic-quotes --disable-ipv6 --enable-libgcc --enable-bcmath
--enable-calendar --enable-ftp --enable-sockets --with-pgsql --with-pear;
make; make install

cp php.ini-dist /usr/local/lib/php.ini



If I make --with-apxs2=/usr/local/apache2/bin/apxs
the PHP config it gives back an error.



How I can do it?



Best redgards.








smime.p7s
Description: S/MIME cryptographic signature


[PHP] Apache2 + PHP problem

2004-10-22 Thread Marco Stranieri















Marco Stranieri
Net.Software Division


NETHOUSE S.p.A.
C.so Re Umberto I, 57 - 10128 Torino - Italy
Tel. +39-011-227.227 - Fax +39-011-227.228
http://www.nethouse.it - mailto:[EMAIL PROTECTED]

Il presente
messaggio non costituisce un impegno contrattuale tra NETHOUSE S.p.A. ed il
destinatario. Le opinioni ivi espresse sono quelle dell'autore. NETHOUSE S.p.A.
non assume alcuna responsabilit riguardo al contenuto del presente
messaggio. Ai sensi dellart. 13 del D.Lgs 30/06/2003 n 196 si precisa che le informazioni contenute nel
presente messaggio sono riservate ad uso esclusivo del destinatario. Il
contenuto e gli allegati sono da considerarsi di natura confidenziale. Nel caso
abbiate ricevuto il presente messaggio per errore, chiediamo cortesemente di
telefonare immediatamente al numero 011.227.227.













Da: Marco Stranieri 
Inviato: venerd 22 ottobre
2004 9.39
A: '[EMAIL PROTECTED]'
Oggetto: Apache2 + PHP problem





Hi,

Ive a problem when I start apaci on my server:



[EMAIL PROTECTED] bin]$ ./apachectl start

Syntax error on line 232 of
/usr/local/apache2/conf/httpd.conf:

Cannot load /usr/lib/apache/libphp4.so into server: /usr/lib/apache/libphp4.so:
undefined symbol: ap_block_alarms



The config param are following:



cd /usr/local/httpd

./configure --prefix=/usr/local/apache2
--enable-module=so --enable-cache --enable-disk-cache --enable-mem-cache
--enable-mime-magic --enable-expires --enable-headers --enable-usertrack
--enable-unique-id --enable-ssl --enable-http --enable-info --disable-cgi
--enable-vhost-alias --enable-shared=max --enable-rule=SHARED_CORE; make; make
install

cd /usr/local/php

./configure --prefix=/usr/local/php
--with-apache2=/usr/local/httpd --without-mysql --with-xml --with-pgsql
--with-zlib-dir=/usr/lib/ --enable-sysvshm=yes --enable-sysvsem=yes
--enable-track-vars --enable-force-cgi-redirect --enable-safe-mode
--enable-magic-quotes --disable-ipv6 --enable-libgcc --enable-bcmath
--enable-calendar --enable-ftp --enable-sockets --with-pgsql --with-pear;
make; make install

cp php.ini-dist /usr/local/lib/php.ini



If I make --with-apxs2=/usr/local/apache2/bin/apxs
the PHP config it gives back an error.



How I can do it?



Best redgards.








smime.p7s
Description: S/MIME cryptographic signature


[PHP] Re: : [PHP] Problem with MSSQL

2004-10-15 Thread Yusuf Tikupadang
 I don't know if this can running on mssql.
 select  limit m,n
No, mssql can't do that. the only solution that i have is using
cursor, but I can't use codecharge to do that (and need much more time
to develop).
Thanks for your idea.

Best Regards,
Yusuf Tikupadang

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



[PHP] Re: : [PHP] Problem with MSSQL

2004-10-15 Thread Yusuf Tikupadang
 I don't know if this can running on mssql.
 select  limit m,n
No, mssql can't do that. the only solution that i have is using
cursor, but I can't use codecharge to do that (and need much more time
to develop).
Thanks for your idea.

Best Regards,
Yusuf Tikupadang

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



[PHP] Procmail + PHP Problem

2004-10-05 Thread Hidayet Dogan
Hi,

I wrote a small PHP script that reads input from php://stdin. And, i'm
using it in .procmailrc (with using pipe) to get e-mail content and parse.
The problem is PHP script does not read body part of e-mails.
Reading process stops before the body part of e-mail (i can get
all other header parts).

I've tested it with sending e-mail via firefox, pine, outlook. But i got
same result.

Here is the reading part of the script:
...
...
$fp = fopen(php://stdin, r);
while (!feof($fp))
  $email .= fgets($fp, 8192);
fclose($fp);
...
...

I also tried it with using fread function instead of fgets, got same
result, used STDIN constant and /dev/stdin instead of php://stdin,
got same result.

.procmailrc part is:
...
...
| /home/hdogan/test.php
...
...

My server is running with Postfix 2.x and PHP 4.3.0 (CLI).

I think there is a EOF character before starting body part of e-mail
content. But it was running well when i tried months ago on different
server (MTA server was same - postfix).

Do you have any idea or solition for this issue?

Thanks,

 Hidayet Dogan
  [EMAIL PROTECTED]

Pleksus Bilisim Teknolojileri D.T.O. A.S.
--
caldiran sok. 14/6 06420 kolej ankara * www.pleksus.com.tr
tel : +90 312 4355343 * faks: +90 312 4354006

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



[PHP] antique PHP problem

2004-09-11 Thread Lowell Allen
I'm doing a project on a server with an old version of PHP -- 4.0.6 on 
Apache 1.3.22 on FreeBSD and I'm having a problem with session 
variables. From code in a script that receives a post:

-
session_start();
$HTTP_SESSION_VARS[m_name] = get_magic_quotes_gpc() ? 
stripslashes($HTTP_POST_VARS[m_name]) : $HTTP_POST_VARS[m_name];
-
Then later I can successfully echo the posted value with:
-
htmlentities($HTTP_SESSION_VARS[m_name])
-
The posted value is shown as expected, which means the session variable 
is set, right? At the end of the receiving script page I have a link 
back to the form where the values were posted from, and in the original 
form I check for session variables in order to re-populate the form 
with them if they're present:
-
session_start();
$m_name = isset($HTTP_SESSION_VARS[m_name]) ? 
$HTTP_SESSION_VARS[m_name] : ;
-
Then in the original HTML form field:
-
?php echo($m_name); ?
-
But $m_name ==  and the field is blank.

The same code works as expected on a different server running PHP 4.3.8 
on Apache 1.3.31 on Linux. I think I'm stuck with 4.0.6 for this 
project. I'd appreciate any suggestions on what I should check/advice 
on using $HTTP_SESSION_VARS.

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


Re: [PHP] Strange PHP problem with mod_perl and MySQL

2004-08-06 Thread Justin Hannus
Make sure that your php and DBD::MySQL were compiled against the *same
exact* library. Apache loads in mod_php and mod_perl on startup and if they
in turn both load two separate libmysqlclient libs then you will get
multiple defined symbols--which Apache cannot resolve.

-Justin Hannus


Phil Stracchino [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Fri, Aug 06, 2004 at 12:32:19AM -0400, Phil Stracchino wrote:
  Note that the only change is the addition of --with-gd.  After
  installing php-4.3.8 and restarting Apache, all of the mod_perl registry
  CGIs are dying at various points with SEGVs.  Each one dies in a
  consistent way at a consistent point every time, but I can find nothing
  in common with how or where they die.  If I disable mod_php4 and restart
  Apache, they work perfectly again.  None of the affected CGIs uses any
  PHP code.


 Oh, one minor addition to this: There is one registry CGI that does not
 crash with mod_php4 enabled.  It is much simpler than the others, and
 unlike the others, does not use DBD::MySQL.  Another standalone CGI that
 I have not yet converted to a mod_perl registry object, which *does* use
 DBD::MySQL and which is much more complex than any of the other CGIs,
 works just fine.


 --
   == Fight Back!  It may not be just YOUR life at risk. ==
   [EMAIL PROTECTED] : [EMAIL PROTECTED] : [EMAIL PROTECTED]
phil stracchino : unix ronin : renaissance man : mystic zen biker geek
  2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold)
Linux Now!  ...Friends don't let friends use Microsoft.

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



[PHP] SOLVED Re: [PHP] Strange PHP problem with mod_perl and MySQL

2004-08-06 Thread Phil Stracchino
On Fri, Aug 06, 2004 at 02:33:28PM -0400, Justin Hannus wrote:
 Please include the list when replying to posts...

Sorry.  You replied to me off-list, so I did the same.

Reinstalling DBD::mysql did indeed solve the problem.  I now know that
whenever I update MySQL, I need to also reinstall both PHP and
DBD::mysql.

Thanks for the pointer.

 
 -Justin
 
 - Original Message -
 From: Phil Stracchino [EMAIL PROTECTED]
 To: Justin Hannus [EMAIL PROTECTED]
 Sent: Friday, August 06, 2004 2:23 PM
 Subject: Re: [PHP] Strange PHP problem with mod_perl and MySQL
 
 
  On Fri, Aug 06, 2004 at 10:06:31AM -0400, Justin Hannus wrote:
   Make sure that your php and DBD::MySQL were compiled against the *same
   exact* library. Apache loads in mod_php and mod_perl on startup and if
 they
   in turn both load two separate libmysqlclient libs then you will get
   multiple defined symbols--which Apache cannot resolve.
 
  Hmm.  DBD::MySQL was updated recently enough that they SHOULD have been
  compiled against the same version.  Just in case, I will try
  re-installing DBD::MySQL right now and see if that has an effect.
 
 
  --
== Fight Back!  It may not be just YOUR life at risk. ==
[EMAIL PROTECTED] : [EMAIL PROTECTED] : [EMAIL PROTECTED]
 phil stracchino : unix ronin : renaissance man : mystic zen biker geek
   2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold)
 Linux Now!  ...Friends don't let friends use Microsoft.
 
 

-- 
  == Fight Back!  It may not be just YOUR life at risk. ==
  [EMAIL PROTECTED] : [EMAIL PROTECTED] : [EMAIL PROTECTED]
   phil stracchino : unix ronin : renaissance man : mystic zen biker geek
 2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold)
   Linux Now!  ...Friends don't let friends use Microsoft.

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



[PHP] Strange PHP problem with mod_perl and MySQL

2004-08-05 Thread Phil Stracchino
I have a strange PHP problem.


I'm running Apache-1.3.28, with mod_perl-1.29, mod_ssl-2.8.15, and PHP4,
on a Slackware-based custom Linux installation.  Up until today, I was
running php-4.3.3, configured as follows:

./configure --with-mysql=/opt/mysql
--with-db4=/usr/local/BerkeleyDB.4.1/ --with-apxs=/usr/sbin/apxs
--with-gnu-ld --with-bz2 --with-zlib --with-readline
--with-jpeg-dir=/usr --with-png-dir=/usr --with-tiff=/usr
--with-xpm-dir=/usr/X11R6 --enable-sockets --enable-bcmath

I also have a number of mod_perl registry-object CGIs which use
DBD::MySQL to access a number of different local databases.  Up until
today, these CGIs were all working perfectly.


Today, I installed a PHP application which requires GD support.  I
therefore needed to recompile and reinstall PHP adding --with-gd to the
above.  So long as I was recompiling PHP anyway, I figured I should
update to the latest version, so I downloaded php-4.3.8 and configured
it as follows:

./configure --with-mysql=/opt/mysql
--with-db4=/usr/local/BerkeleyDB.4.1/ --with-apxs=/usr/sbin/apxs
--with-gnu-ld --with-bz2 --with-zlib --with-readline --with-gd
--with-jpeg-dir=/usr --with-png-dir=/usr --with-tiff=/usr
--with-xpm-dir=/usr/X11R6 --enable-sockets --enable-bcmath

Note that the only change is the addition of --with-gd.  After
installing php-4.3.8 and restarting Apache, all of the mod_perl registry
CGIs are dying at various points with SEGVs.  Each one dies in a
consistent way at a consistent point every time, but I can find nothing
in common with how or where they die.  If I disable mod_php4 and restart
Apache, they work perfectly again.  None of the affected CGIs uses any
PHP code.

I have tried recompiling 4.3.8 without GD support to see if the problem
is related to that, but has no effect.  I have also tried reinstalling
4.3.3, both with and without GD support.  The behavior does not change
in the slightest.  However PHP4 is compiled, if mod_php4 is not loaded,
the registry CGIs all work; if it is loaded, they all die.



Can anyone shed any light on this, and ideally tell me how I can make
mod_perl and mod_php4 work together again, as they were up until today?



-- 
  == Fight Back!  It may not be just YOUR life at risk. ==
  [EMAIL PROTECTED] : [EMAIL PROTECTED] : [EMAIL PROTECTED]
   phil stracchino : unix ronin : renaissance man : mystic zen biker geek
 2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold)
   Linux Now!  ...Friends don't let friends use Microsoft.

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



Re: [PHP] Strange PHP problem with mod_perl and MySQL

2004-08-05 Thread Phil Stracchino
On Fri, Aug 06, 2004 at 12:32:19AM -0400, Phil Stracchino wrote:
 Note that the only change is the addition of --with-gd.  After
 installing php-4.3.8 and restarting Apache, all of the mod_perl registry
 CGIs are dying at various points with SEGVs.  Each one dies in a
 consistent way at a consistent point every time, but I can find nothing
 in common with how or where they die.  If I disable mod_php4 and restart
 Apache, they work perfectly again.  None of the affected CGIs uses any
 PHP code.


Oh, one minor addition to this: There is one registry CGI that does not
crash with mod_php4 enabled.  It is much simpler than the others, and
unlike the others, does not use DBD::MySQL.  Another standalone CGI that
I have not yet converted to a mod_perl registry object, which *does* use
DBD::MySQL and which is much more complex than any of the other CGIs,
works just fine.


-- 
  == Fight Back!  It may not be just YOUR life at risk. ==
  [EMAIL PROTECTED] : [EMAIL PROTECTED] : [EMAIL PROTECTED]
   phil stracchino : unix ronin : renaissance man : mystic zen biker geek
 2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold)
   Linux Now!  ...Friends don't let friends use Microsoft.

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



RE: [PHP] The PHP Problem

2004-02-02 Thread chris . neale
I was in the same shoes a few years ago and used this.

http://www.net-language.com/workshops/Default.asp?workshop=21

It's a good guide, shows you how to set up a web server, php and mysql on
your own PC (win32). As it's for a slightly older version of PHP some parts
of the guide don't no longer hold true, but for the most part you shouldn't
have any problems; you should have it all up and running in a few hours.
You'll have an ideal test system to start trying out your code, and should
learn a bit about how to administrate MySQL databases and Apache web servers
in the process.

Hope that helps.

Chris

ps. Recommend you write notes for yourself as you install and setup. eg.
you'll probably only have to do one or two MySQL grant statements to get it
running, which if your like me you'll forget as soon as it works. Every time
I install it I waste 2 hours trawling through manuals trying to get the
syntax right, promising myself Next Time I'll Take Notes. I never do.

-Original Message-
From: Ash [mailto:[EMAIL PROTECTED]
Sent: 30 January 2004 18:52
To: [EMAIL PROTECTED]
Subject: [PHP] The PHP Problem


Hi,
I am totally new to PHP and dont know a thing. I tried looking through the
articles but they were of no use. My Question is:
How can I just write php in a text editor, save it as a .php, and view it in
internet explorer, offline? I have tried everything and it just wont work.
I tried the code:

?php
echo Hi, I'm a PHP script!;
?

in a .php file and nothing happened. Nothing will work, help!

I dont have a website, I just want to write and use the code.

Tnaks   from Ashley Williams

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



[PHP] The PHP Problem

2004-01-30 Thread Ash
Hi,
I am totally new to PHP and dont know a thing. I tried looking through the
articles but they were of no use. My Question is:
How can I just write php in a text editor, save it as a .php, and view it in
internet explorer, offline? I have tried everything and it just wont work.
I tried the code:

?php
echo Hi, I'm a PHP script!;
?

in a .php file and nothing happened. Nothing will work, help!

I dont have a website, I just want to write and use the code.

Tnaks   from Ashley Williams

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



Re: [PHP] The PHP Problem

2004-01-30 Thread Gabriel Guzman
On Friday 30 January 2004 10:51 am, Ash wrote:

 How can I just write php in a text editor, save it as a .php, and view it
 in internet explorer, offline?

you have to install php.

http://www.php.net/manual/en/installation.php

gabe. 

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



Re: [PHP] The PHP Problem

2004-01-30 Thread Pushpinder Singh
You need to test this page on a webserver. I assume you are on a Win 
system .configure IIS to understand php and then place all your scripts 
in C:/Inetwin/ folder and u shud be set.

hth
ps
On Friday, January 30, 2004, at 01:51 PM, Ash wrote:

Hi,
I am totally new to PHP and dont know a thing. I tried looking through 
the
articles but they were of no use. My Question is:
How can I just write php in a text editor, save it as a .php, and view 
it in
internet explorer, offline? I have tried everything and it just wont 
work.
I tried the code:

?php
echo Hi, I'm a PHP script!;
?
in a .php file and nothing happened. Nothing will work, help!

I dont have a website, I just want to write and use the code.

Tnaks   from Ashley Williams

--
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] The PHP Problem

2004-01-30 Thread John Nichel
Ash wrote:

Hi,
I am totally new to PHP and dont know a thing. I tried looking through the
articles but they were of no use. My Question is:
How can I just write php in a text editor, save it as a .php, and view it in
internet explorer, offline? I have tried everything and it just wont work.
I tried the code:
?php
echo Hi, I'm a PHP script!;
?
in a .php file and nothing happened. Nothing will work, help!

I dont have a website, I just want to write and use the code.

Tnaks   from Ashley Williams

At the bare minimum, you need to install php (if you just want to run it 
from the command line).  If you want to view it through a browser, it 
has to be parsed by php via a webserver.  You can install one of those 
on your machine pretty easy (Apache), or you can use someone else's 
(search Google for 'free php hosting').

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] The PHP Problem

2004-01-30 Thread memoimyself
Hello Ashley,

On 30 Jan 2004 at 18:51, Ash wrote:

 Hi,
 I am totally new to PHP and dont know a thing. I tried looking through the
 articles but they were of no use. My Question is:
 How can I just write php in a text editor, save it as a .php, and view it in
 internet explorer, offline? I have tried everything and it just wont work.
 I tried the code:
 
 ?php
 echo Hi, I'm a PHP script!;
 ?
 
 in a .php file and nothing happened. Nothing will work, help!
 
 I dont have a website, I just want to write and use the code.

I'm afraid things are not quite that simple. A PHP script requires a processor to 
interpret 
the code and do whatever needs to be done, so you'll need to have the processor on 
your computer. If you don't really know what you're going to be doing with PHP and 
just 
want to play around with a scripting language without having to install a web server 
and 
a PHP interpreter, try JavaScript.

One of a million sources of introductory info on JavaScript:

http://www.w3schools.com/js/js_intro.asp


More info on obtaining and installing PHP here:

http://www.php.net/manual/en/installation.php

Good luck,

Erik

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



Re: [PHP] The PHP Problem

2004-01-30 Thread Chris Edwards
I have several web sites that I use PHP/mySQL with. I pay approximately $9
per month for a gigabyte of space and unlimited data transfer.

I use CodeWright from Starbase as my editor. It detects PHP code and
colorizes the code as you type i.e. reserved words are blue, comments are
green, literals are red, etc.. This helps with the initial syntax checking.

It does this with just about every language.


- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 30, 2004 2:09 PM
Subject: Re: [PHP] The PHP Problem


 Hello Ashley,

 On 30 Jan 2004 at 18:51, Ash wrote:

  Hi,
  I am totally new to PHP and dont know a thing. I tried looking through
the
  articles but they were of no use. My Question is:
  How can I just write php in a text editor, save it as a .php, and view
it in
  internet explorer, offline? I have tried everything and it just wont
work.
  I tried the code:
 
  ?php
  echo Hi, I'm a PHP script!;
  ?
 
  in a .php file and nothing happened. Nothing will work, help!
 
  I dont have a website, I just want to write and use the code.

 I'm afraid things are not quite that simple. A PHP script requires a
processor to interpret
 the code and do whatever needs to be done, so you'll need to have the
processor on
 your computer. If you don't really know what you're going to be doing with
PHP and just
 want to play around with a scripting language without having to install a
web server and
 a PHP interpreter, try JavaScript.

 One of a million sources of introductory info on JavaScript:

 http://www.w3schools.com/js/js_intro.asp


 More info on obtaining and installing PHP here:

 http://www.php.net/manual/en/installation.php

 Good luck,

 Erik

 -- 
 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] *SOLVED* [PHP] problem transferring a variable using POST

2003-11-07 Thread Erik Osterman
I recommend using this function when inserting data directly from a form
post into the database.

This function automatically escapes the values you input.

function Query()
{
$values = func_get_args ();
$statement = array_shift($values);
if( sizeof($values) != substr_count($statement, '?') )
warn(Statement parts don't match number of values, true);
$query =
preg_replace(/(\?)/e,\'\[EMAIL PROTECTED](@array_shift(\$values)).\
'\, $statement);

#   print [$query];
return mysql_query($query);
}


Usage:

$result = Query(INSERT INTO foo (var1, var2) VALUES( ?, ? ), $_POST[var1],
$_POST[var2]);




Regards,
Erik Osterman
http://osterman.com/



-Original Message-
From: Davy Campano [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 09, 2003 9:14 AM
To: [EMAIL PROTECTED]
Subject: [PHP] *SOLVED* [PHP] problem transferring a variable using POST

It worked.  Thank you very much everyone for the quick responses.  I am
just learning PHP and mySQL so I appreciate the suggestions.  I only
wish that I would have written this email an hour ago!

-Original Message-
From: Chris W. Parker [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 09, 2003 12:08 PM
To: Davy Campano; [EMAIL PROTECTED]
Subject: RE: [PHP] problem transferring a variable using POST

Davy Campano mailto:[EMAIL PROTECTED]
on Thursday, October 09, 2003 8:57 AM said:

 This statement works:
 $sql = 'UPDATE wo SET status = 1 WHERE ticket = 1'
 
 This statement does not:
 $sql = 'UPDATE wo SET status = 1 WHERE ticket =
 $HTTP_POST_VARS[ticketed]'
 
 Any suggestions...
 
 If I do echo $HTTP_POST_VARS[ticketed];
 It returns a 1

First of all you should be using $_POST and not $HTTP_POST_VARS (that is
of course if your version of php supports it).

Secondly, it's not working because (1) you are wrapping the sql
statement in single quotes which does not evaluate variables, it's a
string literal. You should change all those ' to , and (2) arrays are
treated differently than regular variables inside a string. They MUST be
wrapped with { } to be evaluated.

Third, it's a bad practice to not properly quote your array references.
In other words, the word ticketed should have single quotes around it.

Applying all these things your line should look like this:

$sql = UPDATE wo SET status = 1 WHERE ticket = {$_POST['ticketed']};


hth.
chris.

p.s. it's a Very Bad Idea(tm) to grab data directly from $_GET or $_POST
and put it to work before doing any validation on it.

p.p.s. I'm not positive about this but I'd be willing to bet that every
value gathered from $_GET or $_POST is considered a string and not
numeric. Think about it, how would $_POST know that ticketed is meant
to be an integer or a string?


-- 
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/

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



[PHP] *SOLVED* [PHP] problem transferring a variable using POST

2003-10-09 Thread Davy Campano
It worked.  Thank you very much everyone for the quick responses.  I am
just learning PHP and mySQL so I appreciate the suggestions.  I only
wish that I would have written this email an hour ago!

-Original Message-
From: Chris W. Parker [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 09, 2003 12:08 PM
To: Davy Campano; [EMAIL PROTECTED]
Subject: RE: [PHP] problem transferring a variable using POST

Davy Campano mailto:[EMAIL PROTECTED]
on Thursday, October 09, 2003 8:57 AM said:

 This statement works:
 $sql = 'UPDATE wo SET status = 1 WHERE ticket = 1'
 
 This statement does not:
 $sql = 'UPDATE wo SET status = 1 WHERE ticket =
 $HTTP_POST_VARS[ticketed]'
 
 Any suggestions...
 
 If I do echo $HTTP_POST_VARS[ticketed];
 It returns a 1

First of all you should be using $_POST and not $HTTP_POST_VARS (that is
of course if your version of php supports it).

Secondly, it's not working because (1) you are wrapping the sql
statement in single quotes which does not evaluate variables, it's a
string literal. You should change all those ' to , and (2) arrays are
treated differently than regular variables inside a string. They MUST be
wrapped with { } to be evaluated.

Third, it's a bad practice to not properly quote your array references.
In other words, the word ticketed should have single quotes around it.

Applying all these things your line should look like this:

$sql = UPDATE wo SET status = 1 WHERE ticket = {$_POST['ticketed']};


hth.
chris.

p.s. it's a Very Bad Idea(tm) to grab data directly from $_GET or $_POST
and put it to work before doing any validation on it.

p.p.s. I'm not positive about this but I'd be willing to bet that every
value gathered from $_GET or $_POST is considered a string and not
numeric. Think about it, how would $_POST know that ticketed is meant
to be an integer or a string?


-- 
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/

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



[PHP] Re:RE: [PHP] problem with fsockopen ............

2003-08-18 Thread fongming
No,thanks.I still got the cookies , and
could not block cookies, how comes that ?

the following is my  scripts:
--- 
 $fp = fopen(http://XXX.XXX.XXX,r;);
   
   while(!feof($fp))
{
echo fgets($fp,128);
}
   fclose($fp);


If you want to block the http headers sent back by the web server,use
fopen() instead.
 -Original Message-
 From: fongming [mailto:[EMAIL PROTECTED] 
 Sent: Monday, August 18, 2003 11:29 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] problem with fsockopen 
 
 
 Hi,Sir:
 
 Can I  block cookies  when I ftput headers ?
 following is my fsockopen() scripts,
 but it always send back cookies.
 Is there any way to prevent from it ? 
 thanks
 -
 
  $fp = fsockopen (XXX.XXX.XXX.XXX, 80, $errno, $errstr, 30);
if (!$fp) {   echo $errstr ($errno)br\n;}
else
{
fputs ($fp, GET /index.php HTTP/1.0\r\);
fputs($fp,Host: XXX.XXX.XXX.XXX\r\n);
fputs($fp,Pragma: no-cache\r\n);
fputs($fp,Connection: close\r\n\r\n);
   }
 
fclose ($fp);
 
 ---
 Fongming from Taiwan.
 
 
 --
 ¡»From: ¦¹«H¬O¥Ñ®ç¤p¹q¤l¶l¥ó1.5ª©©Òµo¥X...
 http://fonn.fongming.idv.tw
 [EMAIL PROTECTED]
 
 -- 
 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




---
Fongming from Taiwan.


--
¡»From: ¦¹«H¬O¥Ñ®ç¤p¹q¤l¶l¥ó1.5ª©©Òµo¥X...
http://fonn.fongming.idv.tw
[EMAIL PROTECTED]

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



RE: [PHP] learning php - problem already

2003-08-01 Thread Ford, Mike [LSS]
 -Original Message-
 From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
 Sent: 31 July 2003 15:54
 
 you basically
 have this:
 
 list($k,$v,$key,$value) = array(1='abc', 'value'='abc', 0='a',
 'key'='a');
 
 So, how this works is that list starts with $value. $value is 
 at position
 number four, so since arrays start at zero, it's going to 
 look in the array
 that was passed for an element at [3]. Since there is no [3] 
 in the passed
 array, you get a NOTICE about undefined offset.
 
 Next it moves on to $key and looks for element [2]. Again you 
 get a warning
 since there is no element [2] in the passed array.
 
 Next is $v and list is looking for [1]. Since [1] does exist 
 and has a value
 of 'abc', now $v = 'abc'
 
 Last is $k and [0] and you get $k = 'a'.
 
 That's how it works. :)
 
 That's why this code:
 
 list($a, $b, $c, $d) = array(4='four', 3='three', 2='two', 
 1='one',
 0='zero');
 echo $a, $b, $c, $d;
 
 gives:
 
 zero, one, two, three

Ho, thanks for that -- I must admit I hardly ever use each() or list(), and
taking a quick look at the current manual page for list() does seem to have
changed quite a bit since I originally read it -- so I guess my
understanding of it was faulty.  I still think it's quite confusing -- your
explanation here is much better -- so I might see if I can't put together
something even better for incorporation in the manual!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP] learning php - problem already

2003-07-31 Thread Ford, Mike [LSS]
 -Original Message-
 From: John W. Holmes [mailto:[EMAIL PROTECTED]
 Sent: 29 July 2003 23:05
 
 Curt Zirzow wrote:
  Ok... I'm getting the red pen out now :)
 [snip]
  the each() function  returns a one element array that the current
  (internal) array pointer is pointing to and will return false if at
  the end of the array.
 
 It actually returns a four element array (as per the manual).
 
  the list() function (not really a function) takes an array on the
  right side of the = operator and assigns each variable its value in
  order returned from the array. 
 
 Right
 
  so with the example array(0 = 'one', 1 = 'two'), the 
 initial internal
  pointer is looking at the first item so when the while statement
  evaluates the the statement the each() function returns: 
0 = 'one'
 
 The four element array will be
 1 = 'one'
 value = 'one'
 0 = 0
 key = 0

OK, some more red pen coming along

The four-element array would actually be:

  0=0
  1='one'
  'key'=0
  'value'='one'

in that order.  So...

 
  This array gets returned to the list statement
list($k, $v)

the list takes the first 2 elements (0=0, 1='one') and assigns their values to $k 
and $v respectively, giving $k==0, $v=='one' -- the remaining 2 elements are dropped 
because there's nothing to assign them to.  If you cared to put 4 variables in the 
list() structure, thus:

   list($k, $v, $key, $value) = each($a);

you would, in this case, now have $k==0, $v=='one', $key==0, $value=='one'.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



Re: [PHP] learning php - problem already

2003-07-31 Thread CPT John W. Holmes
From: Ford, Mike [LSS] [EMAIL PROTECTED]
 From: John W. Holmes [mailto:[EMAIL PROTECTED]
  The four element array will be
  1 = 'one'
  value = 'one'
  0 = 0
  key = 0

 OK, some more red pen coming along

Since we're whipping them out (red pens that is)

 The four-element array would actually be:

   0=0
   1='one'
   'key'=0
   'value'='one'

Nope. Try this example from the manual and you'll see that you get the order
I gave

$foo = array (bob, fred, jussi, jouni, egon, marliese);
$bar = each ($foo);
print_r($bar);

The order is pretty irrelevant, though.

list($k, $v, $key, $value) = each($a);

 you would, in this case, now have $k==0, $v=='one', $key==0,
$value=='one'.

Nope.. try that and you'll get two notices about undefined offsets at 3 and
2. $key and $value will not have any value at all.

Not that this really matters, but since this is fun to argue about...

$a = array('a' = 'abc');

Since we know that each($a) will return what I gave above, you basically
have this:

list($k,$v,$key,$value) = array(1='abc', 'value'='abc', 0='a',
'key'='a');

So, how this works is that list starts with $value. $value is at position
number four, so since arrays start at zero, it's going to look in the array
that was passed for an element at [3]. Since there is no [3] in the passed
array, you get a NOTICE about undefined offset.

Next it moves on to $key and looks for element [2]. Again you get a warning
since there is no element [2] in the passed array.

Next is $v and list is looking for [1]. Since [1] does exist and has a value
of 'abc', now $v = 'abc'

Last is $k and [0] and you get $k = 'a'.

That's how it works. :)

That's why this code:

list($a, $b, $c, $d) = array(4='four', 3='three', 2='two', 1='one',
0='zero');
echo $a, $b, $c, $d;

gives:

zero, one, two, three

as the result, even though you passed a five element array in reverse order.

---John Holmes...


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



Re: [PHP] learning php - problem already

2003-07-30 Thread Ivo Fokkema
Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 * Thus wrote John W. Holmes ([EMAIL PROTECTED]):
 

[snip]

 don't but all that matters to most is: it works..  and foreach has
 taken over its job anyway.
Just a small comment... foreach() is not equal to a while/each loop. Foreach
uses a copy of the array, and not the array itself. This might not sound
important, but it was for me when I tried to add new elements to the array
in the middle of a foreach() loop. They didn't show up until after the loop,
which was a bit confusing for me at first. So occasionally when I need to
add elements during a loop, I still use while(list(..) = each(...)).

--
Ivo



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



[PHP] learning php - problem already

2003-07-29 Thread karin

Hello everyone,
Am new to php and have run into a problem while reading my book... can anybody tell me 
what does this mean:

foreach($invoice as $number = $pppno)

and also this:

while(list($k,$v,) = each($a))

I do understand for loops and while loops but this is a bit confusing...do you haev 
any links I can read up on these?

Thanks in advance,
-Karin Cooke.

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



Re: [PHP] learning php - problem already

2003-07-29 Thread Matt Matijevich
snip
I do understand for loops and while loops but this is a bit
confusing...do you haev any links I can read up on these?
/snip

http://www.php.net/manual/en/ has all the info you need




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



RE: [PHP] learning php - problem already

2003-07-29 Thread Van Andel, Robbert
I can't help you with the while loop, but foreach loops are very nice to
work with.  It took me a while to figure it out as well.


You can use the foreach to loop through all the instances of an array.  This
works best when you have an associative array ($state['CA'] = Sacremento,
$state['OR'] = Salem, etc.)

foreach ($state as $abbreviation = $capital)

The above foreach statement takes the index of state and assigns it to
$abbreviation, while it takes the actual value and assigns it to $capital.
The process is repeated for each instance of $state.

Hope this helps.

Robbert van Andel 


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 29, 2003 1:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP] learning php - problem already



Hello everyone,
Am new to php and have run into a problem while reading my book... can
anybody tell me what does this mean:

foreach($invoice as $number = $pppno)

and also this:

while(list($k,$v,) = each($a))

I do understand for loops and while loops but this is a bit confusing...do
you haev any links I can read up on these?

Thanks in advance,
-Karin Cooke.

-- 
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] learning php - problem already

2003-07-29 Thread Curt Zirzow
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]):
 
 Hello everyone,
 Am new to php and have run into a problem while reading my book... can anybody tell 
 me what does this mean:
 
 foreach($invoice as $number = $pppno)

this rather straight forward:
  foreach([array] as [key] = [val] )

 
 and also this:
 
 while(list($k,$v,) = each($a))

This one is a little more involved but it really does the same
thing as the foreach loop (above) but is backward compatible to php 3.0.

 
 I do understand for loops and while loops but this is a bit confusing...do you haev 
 any links I can read up on these?

The php manual is an excellent resource for learning the
information
http://www.php.net/

And a little trick for those who don't like clicking around alot
and know the function name your looking for:

If you type 'php.net/foreach' in your browser, the php site will
direct you to the proper page.  If you typed it wrong or no
statement/function is found it sends you to a google search with
that term, yeilding excelent results (usually is a lucky match that
you wanted).

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

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



Re: [PHP] learning php - problem already

2003-07-29 Thread CPT John W. Holmes
 Hello everyone,
 Am new to php and have run into a problem while reading my book... can
anybody tell me what does this mean:

Hi... let's see who gets this one first... :)

 foreach($invoice as $number = $pppno)

$invoice is an array. foreach() is going to loop through that array one
element at a time. For each element, it'll take the key and place it into
$number. It will take the value of the element and place it in $pppno. So,
if you had array('one','two'), the first element is one with a key of zero
(default). So, the first time through the loop, $number will be zero and
$pppno will be one. The next time through the loop, $number will be one
and $pppno will be two.

 and also this:

 while(list($k,$v,) = each($a))

Same kind of thing here, just a different method. each() loops through an
array. For each element, it'll return an array consisting of the key and
value. list() takes that array and assigns the first element of the array to
$k and the second to $v. The final while() just loops through everything
until all of the elements of $a have been run through. So, if we have our
array('one','two); again, each() will take the first element, one, and
pass an array consisting of the key, zero, and the value, one to list().
list() will assign zero to $k and one to $v.

 I do understand for loops and while loops but this is a bit confusing...do
you haev any links I can read up on these?

Hope that helps. That was as much of a test for me in seeing if I could
explain it, so tell me how I did! :)

---John Holmes...


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



Re: [PHP] learning php - problem already

2003-07-29 Thread Curt Zirzow

Ok... I'm getting the red pen out now :)

* Thus wrote CPT John W. Holmes ([EMAIL PROTECTED]):
  Hello everyone,
  Am new to php and have run into a problem while reading my book... can
 anybody tell me what does this mean:
 
 Hi... let's see who gets this one first... :)
 
  foreach($invoice as $number = $pppno)
 
 $invoice is an array. foreach() is going to loop through that array one
 element at a time. For each element, it'll take the key and place it into
 $number. It will take the value of the element and place it in $pppno. So,
 if you had array('one','two'), the first element is one with a key of zero
 (default). So, the first time through the loop, $number will be zero and
 $pppno will be one. The next time through the loop, $number will be one
 and $pppno will be two.

passed :)

 
  and also this:
 
  while(list($k,$v,) = each($a))
 
 Same kind of thing here, just a different method. each() loops through an
 array. For each element, it'll return an array consisting of the key and
 value. list() takes that array and assigns the first element of the array to
 $k and the second to $v. The final while() just loops through everything
 until all of the elements of $a have been run through. So, if we have our
 array('one','two); again, each() will take the first element, one, and
 pass an array consisting of the key, zero, and the value, one to list().
 list() will assign zero to $k and one to $v.

This one is rather confusing, and is sort of the reason why i
didn't go in depth  and will only give a brief summery here:

the each() function  returns a one element array that the current
(internal) array pointer is pointing to and will return false if at
the end of the array.

the list() function (not really a function) takes an array on the
right side of the = operator and assigns each variable its value in
order returned from the array. 

so with the example array(0 = 'one', 1 = 'two'), the initial internal
pointer is looking at the first item so when the while statement
evaluates the the statement the each() function returns: 
  0 = 'one'
 
This array gets returned to the list statement
  list($k, $v)

Thus $k gets the value 0 and $v gets 'one'. Now the pointer is
moved to:
  1 = 'two'

the loop comes back to the while and repeats the steps until the
internal pointer is at the end of the array.


With that being said it is almost always common to see this statement
before this kind of loop because we want to make sure the pointer is
at the beginning.
  reset($a);

The foreach statement doesn't need this.

 
 Hope that helps. That was as much of a test for me in seeing if I could
 explain it, so tell me how I did! :)

I'll still give you an A :-)

cheers! 

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

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



Re: [PHP] learning php - problem already

2003-07-29 Thread John W. Holmes
Curt Zirzow wrote:
Ok... I'm getting the red pen out now :)
[snip]
the each() function  returns a one element array that the current
(internal) array pointer is pointing to and will return false if at
the end of the array.
It actually returns a four element array (as per the manual).

the list() function (not really a function) takes an array on the
right side of the = operator and assigns each variable its value in
order returned from the array. 
Right

so with the example array(0 = 'one', 1 = 'two'), the initial internal
pointer is looking at the first item so when the while statement
evaluates the the statement the each() function returns: 
  0 = 'one'
The four element array will be
1 = 'one'
value = 'one'
0 = 0
key = 0
This array gets returned to the list statement
  list($k, $v)
and apparently list() will ignore the keys that do not have numerical 
indexes. The manual says numerical indexes are required, but not what 
happens when they are encounted. It looks like they are just ignored.

list($k,$v) = array('foo'='one','two','three');

for example will give $k = 'two', and $v = 'three'. 'one' is completely 
ignored because it does not have a numerical key.

Kind of a wierd operation that works without you knowing all of the 
details, I guess. I had to come home and actually test some things out 
before I realized these last bits. :)

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals  www.phparch.com





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


Re: [PHP] learning php - problem already

2003-07-29 Thread Curt Zirzow
* Thus wrote John W. Holmes ([EMAIL PROTECTED]):
 
 and apparently list() will ignore the keys that do not have numerical 
 indexes. The manual says numerical indexes are required, but not what 
 happens when they are encounted. It looks like they are just ignored.
 
 list($k,$v) = array('foo'='one','two','three');
 
 for example will give $k = 'two', and $v = 'three'. 'one' is completely 
 ignored because it does not have a numerical key.
 
 Kind of a wierd operation that works without you knowing all of the 
 details, I guess. I had to come home and actually test some things out 
 before I realized these last bits. :)

I vaguely remember a discussion about this on the dev list.  I
think it was made to be  intentionally confusing.  For what reason, I
don't but all that matters to most is: it works..  and foreach has
taken over its job anyway.

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

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



Re: [PHP] learning php - problem already

2003-07-29 Thread Curt Zirzow
* Thus wrote Curt Zirzow ([EMAIL PROTECTED]):
 
 think it was made to be  intentionally confusing.  For what reason, I
 don't but all that matters to most is: it works..  and foreach has

I cant type nor proof read today... at least before hitting send.


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

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



Re: [PHP] learning php - problem already

2003-07-29 Thread John W. Holmes
Curt Zirzow wrote:

* Thus wrote Curt Zirzow ([EMAIL PROTECTED]):
 

think it was made to be  intentionally confusing.  For what reason, I
don't but all that matters to most is: it works..  and foreach has


I cant type nor proof read today... at least before hitting send.
I think I understood you. ;) I agree.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals  www.phparch.com





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


Re: [PHP] MySQL/PHP problem.

2003-07-22 Thread Curt Zirzow
* Thus wrote Phillip Blancher ([EMAIL PROTECTED]):
 I am trying to count in mySQL the number of entries in the field day where day=2 
 or 3. 
 
 Then I want to check just to see if that returned a value greater than 0 or not.
 
 I am using the code below, but having a problem, I keep getting 0 as the total
 
 What am i doing wrong.   
 
 
$dbqueryshipping1 = select *, COUNT(day) from tempuserpurchase where day=\2\ 
 and day=\3\ GROUP BY itemname;
 $resultshipping1 = mysql_db_query($dbname,$dbqueryshipping1); 
 if(mysql_error()!=){echo mysql_error();}
$shipping1 = mysql_fetch_array($resultshipping1);

try a print_r($shipping1); I'll bet your value is in there just you
arn't accessing it.

It would help if you supplied your code for trying to access your total.

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

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



Re: [PHP] MySQL/PHP problem.

2003-07-22 Thread Phillip Blancher
I tried using the print_r for $shipping. - All i want this to do is to check
to see what days in the grouping is there, and if there is anything for a
grouping, charge $5 for the delivery. If there are items in two of the
groupings, charge $10 and if there is in all three groupings, charge $15.

This is what print_r has returned.

Array ( [0] = 4 [day] = 4 [1] = 4 [COUNT(*)] = 4 ) 11Array ( [0] = 1
[day] = 1 [1] = 9 [COUNT(*)] = 9 ) 1amount from DB query10


This is the code I have done, showing the print_r's for Shipping 1, 2 and 3.
?
  $dbqueryshipping1 = select day, COUNT(*) from tempuserpurchase where
day=\2\ or day=\3\ GROUP BY day;
$resultshipping1 = mysql_db_query($dbname,$dbqueryshipping1);
if(mysql_error()!=){echo mysql_error();}
   $shipping1 = mysql_fetch_array($resultshipping1);

  $dbqueryshipping2 = select day, COUNT(*) from tempuserpurchase where
day=\4\ or day=\5\ GROUP BY day;
$resultshipping2 = mysql_db_query($dbname,$dbqueryshipping2);
if(mysql_error()!=){echo mysql_error();}
   $shipping1 = mysql_fetch_array($resultshipping2);

   $dbqueryshipping3 = select day, COUNT(*) from tempuserpurchase where
day=\6\ or day=\7\ or day=\1\ GROUP BY day;
$resultshipping3 = mysql_db_query($dbname,$dbqueryshipping3);
if(mysql_error()!=){echo mysql_error();}
   $shipping3 = mysql_fetch_array($resultshipping3);

   if(($shipping1  ) and ($shipping2  ) and ($shipping3  ))
{ $shipping=15;}
   elseif((($shipping1  ) and ($shipping2  )) or (($shipping2 
) and ($shipping3  )) or (($shipping1  ) and ($shipping3  )))
{ $shipping=10;}
   elseif(($shipping1  ) or ($shipping2  ) or ($shipping3  ))
{ $shipping=5;}
   else{ $shipping=0;}
   echo print_r($shipping1); echo print_r($shipping2);  echo
print_r($shipping3);
   echo amount from DB query; echo $shipping;
?





- Original Message -
From: Curt Zirzow [EMAIL PROTECTED]
To: PHP List [EMAIL PROTECTED]
Sent: Tuesday, July 22, 2003 5:23 PM
Subject: Re: [PHP] MySQL/PHP problem.


 * Thus wrote Phillip Blancher ([EMAIL PROTECTED]):
  I am trying to count in mySQL the number of entries in the field day
where day=2 or 3.
 
  Then I want to check just to see if that returned a value greater than 0
or not.
 
  I am using the code below, but having a problem, I keep getting 0 as the
total
 
  What am i doing wrong.
 
 



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003


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



Re: [PHP] MySQL/PHP problem.

2003-07-22 Thread David Otton
On Tue, 22 Jul 2003 17:08:50 -0400, you wrote:

I am trying to count in mySQL the number of entries in the field day where day=2 or 
3. 

Then I want to check just to see if that returned a value greater than 0 or not.

I am using the code below, but having a problem, I keep getting 0 as the total

What am i doing wrong.   


   $dbqueryshipping1 = select *, COUNT(day) from tempuserpurchase where day=\2\ 
 and day=\3\ GROUP BY itemname;
$resultshipping1 = mysql_db_query($dbname,$dbqueryshipping1); 
 if(mysql_error()!=){echo mysql_error();}
   $shipping1 = mysql_fetch_array($resultshipping1);

You essentially are looking for TRUE or FALSE, right? Nothing else?

a) What's the * for?
b) day can never be 2 AND 3 at the same time. Boolean and/or usage is more
strict than English and/or usage.

Try this

function x() {
$query = SELECT COUNT(*) FROM tempuserpurchase WHERE day=2 OR day=3;

[...]

$a = mysql_fetch_row($r);

if ($a[0]) {
return (TRUE);
}
return (FALSE);
}

That should give you the core of a function that returns TRUE if there are
rows in the db where day = 2 or day = 3. Expand as you wish (eg moving the
magic numbers out of the sql query).


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



RE: [PHP] MySQL/PHP problem.

2003-07-22 Thread Jennifer Goodie
Off the top of my head, try using OR in your query rather than AND

 day=\2\ or day=\3\

day probably won't equal both 2 and 3, which is why you are getting 0.
Also, if you group by item name, you are going to get the total for each
itemname, is that what you want, or just the overall total?

 -Original Message-
 From: Phillip Blancher [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 22, 2003 2:09 PM
 To: PHP List
 Subject: [PHP] MySQL/PHP problem.


 I am trying to count in mySQL the number of entries in the field
 day where day=2 or 3.

 Then I want to check just to see if that returned a value greater
 than 0 or not.

 I am using the code below, but having a problem, I keep getting 0
 as the total

 What am i doing wrong.


$dbqueryshipping1 = select *, COUNT(day) from
 tempuserpurchase where day=\2\ and day=\3\ GROUP BY itemname;
 $resultshipping1 =
 mysql_db_query($dbname,$dbqueryshipping1);
 if(mysql_error()!=){echo mysql_error();}
$shipping1 = mysql_fetch_array($resultshipping1);



 Thanks in advance,

 Phil



 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003



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



[PHP] MySQL/PHP problem.

2003-07-22 Thread Phillip Blancher
I am trying to count in mySQL the number of entries in the field day where day=2 or 
3. 

Then I want to check just to see if that returned a value greater than 0 or not.

I am using the code below, but having a problem, I keep getting 0 as the total

What am i doing wrong.   


   $dbqueryshipping1 = select *, COUNT(day) from tempuserpurchase where day=\2\ and 
day=\3\ GROUP BY itemname;
$resultshipping1 = mysql_db_query($dbname,$dbqueryshipping1); 
if(mysql_error()!=){echo mysql_error();}
   $shipping1 = mysql_fetch_array($resultshipping1);



Thanks in advance,

Phil



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003


[PHP] Re: PHP Problem regarding updating through text boxes

2003-06-20 Thread Esteban Fernandez
Put the code in a Form tag, modified thevalues, and put a submit button in
the Form, so, in the php page you get it the values by name, you can
modified with 'update' mysql sentence.


Matt Hedges [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 Please take a look at http://hedges.org/code/wine.php  - You'll see what I
 can't figure out how to do.


 thanks,
 Matt






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



[PHP] Re: PHP Problem regarding updating through text boxes

2003-06-20 Thread Esteban Fernandez
Hum,, i don't see the database conecction :P. It's necesary modified the
fileds on the fly ?, one by one it's more easy to do...





Esteban Fernandez [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 Put the code in a Form tag, modified thevalues, and put a submit button in
 the Form, so, in the php page you get it the values by name, you can
 modified with 'update' mysql sentence.


 Matt Hedges [EMAIL PROTECTED] escribió en el mensaje
 news:[EMAIL PROTECTED]
  Please take a look at http://hedges.org/code/wine.php  - You'll see what
I
  can't figure out how to do.
 
 
  thanks,
  Matt
 
 
 





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



RE: [PHP] Re: PHP Problem regarding updating through text boxes

2003-06-20 Thread electroteque
hmm name the text fields the field of the database then put a [] in front of
them to make them an array then

then try maybe

foreach ($_POST['id'] as $key=$value) {
//sql statement
update table set us=$_POST['us'][$key] where id=$_POST['id'][$key];

}

-Original Message-
From: Esteban Fernandez [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 21, 2003 6:24 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: PHP Problem regarding updating through text boxes


Hum,, i don't see the database conecction :P. It's necesary modified the
fileds on the fly ?, one by one it's more easy to do...





Esteban Fernandez [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 Put the code in a Form tag, modified thevalues, and put a submit button in
 the Form, so, in the php page you get it the values by name, you can
 modified with 'update' mysql sentence.


 Matt Hedges [EMAIL PROTECTED] escribió en el mensaje
 news:[EMAIL PROTECTED]
  Please take a look at http://hedges.org/code/wine.php  - You'll see what
I
  can't figure out how to do.
 
 
  thanks,
  Matt
 
 
 





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



[PHP] MSSQL/PHP Problem

2003-03-31 Thread Poon, Kelvin (Infomart)
Hi, 

I have this problem retrieving data from a mssql table with PHP.

I have this in my mssql table column:

Globe and Mail data are retrieved and processed for CustomSearch.

On the R30, the crontab entry:
0 4 * * 1-6  /usr1/applic/ntgm/ntgm_get.pl
will run the Perl script at 4 a.m. everyday to retrieve the data from Globe
and Mail.  It will look for the file, retry if not found, until 6 a.m.

Most common problem is caused by the data file not available after 6 a.m.
for retrieval.  The system will send an error message to the support team to
alert the problem.

To retry downloading manually, simply sign on to the R30 and run the script
/usr1/applic/ntgm/ntgm_get.pl.

The data file can be found in the done directory and two log files in the
log directory.

WHen I retrieve this data from php to display on my webpage I get this:

Globe and Mail data are retrieved and processed for CustomSearch. 
On the R30, the crontab entry: 
0 4 * * 1-6 /usr1/applic/ntgm/ntgm_get.pl 
will run the Perl script at 4 a.m. everyday to retrieve the data from Globe
and Mail. It will look for the fi

The code I have in my php to display this text is:

$query = SELECT * FROM knowledgeBase WHERE Title = '$title';
$result = mssql_query($query);
$line = mssql_fetch_row($result);
echo $line[2];

$line[2] because this data is in the second column of the mssql table of the
row '$title'

P.S. I have set the limit of the mssql table to have 8000 character, so it
should exceed the limit, but I just don't know why it takes only 6 lines of
the total 11 lines of what I had in the mssql table.

Please advise! THANKS!

Kelvin

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



[PHP] Re: php problem

2002-05-10 Thread George Nicolae

I have the same problem long time ago

--


Best regards,
George Nicolae
IT Manager
___
PaginiWeb.com  - Professional Web Design
www.PaginiWeb.com


Johnny1b1g [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 ?





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




[PHP] Weird PHP problem...Example code...

2001-09-11 Thread Dana Holt


Ok, this code is used on the index page of on of my sites. It prints out a
list of links from a database.

I am using PHP sessions. When I open a new browser and go the site for the
first time the HTML that is output by my code is not correct. This is only
on SOME of the lines, but it is always on the SAME lines. After a reload or
even going to another web site and back it works fine every time. I noticed
that PHP is automatically adding a PHPSESSID to the links. I think this is
causing the problem. PHP seems to be adding more than just that.

Anyone seen this before? Anyone know how I can fix it?

Thanks in advance for any help!

WEIRD HTML START (first view of page in new browser window)

a href='/viewstory.php?story=20PHPSESSID=61bf547309e9bce7c1e333fb1958cd89'
target='_self'tr
Test 1.../abr

a href='/viewstory.php?story=28PHPSESSID=61bf547309e9bce7c1e333fb1958cd89'
target='_self'tr
  Test 2.../abr

a href='/viewstory.php?story=21PHPSESSID=61bf547309e9bce7c1e333fb1958cd89'
target='_self'tr
  Test 3.../abr

a href='/viewstory.php?story=27PHPSESSID=61bf547309e9bce7c1e333fb1958cd89'
target='_self'tr
  Test 4.../abr

WEIRD HTML END

CORRECT HTML START (after the first page view I get this)

a href='/viewstory.php?story=20' target='_self'Test 1.../abr

a href='/viewstory.php?story=28' target='_self'Test 2.../abr

a href='/viewstory.php?story=21' target='_self'Test 3.../abr

a href='/viewstory.php?story=27' target='_self'Test 4.../abr

CORRECT HTML END

PHP CODE START

while($row = mysql_fetch_assoc($result)) {

echo a href='/viewstory.php?story=;
echo $row[RECORD_ID];
echo ' target='_self';

if (strlen($row[HEADLINE])  20) {
echo substr($row[HEADLINE], 0, 20);
echo '...';
} else {
echo $row[HEADLINE];
}   }

echo '/a';
echo 'br';
}

PHP CODE END

--
Dana Holt / [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] making php problem

2001-08-04 Thread Spear

In file included from libmysql.c:10:
global.h:240: warning: redefinition of `uint'
/usr/include/sys/types.h:146: warning: `uint' previously declared here
global.h:241: warning: redefinition of `ushort'
/usr/include/sys/types.h:145: warning: `ushort' previously declared here
In file included from libmysql.c:13:
m_string.h:180: parse error before `__extension__'
m_string.h:180: parse error before `'
make[4]: *** [libmysql.lo] Error 1
make[4]: Leaving directory `/usr/local/php-4.0.6/ext/mysql/libmysql'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/usr/local/php-4.0.6/ext/mysql/libmysql'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/usr/local/php-4.0.6/ext/mysql'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/usr/local/php-4.0.6/ext'.
anyone can help?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]