Re: [PHP] Need help to understand a code

2012-09-22 Thread Stefan Wixfort

On 22.09.2012 12:34, Ashickur Rahman Noor wrote:

Hi all

I need some help to understand a code. The code is like this

$result = mysql_query($sSQL) or die(err:  . mysql_error().$sSQL);

 if($row = mysql_fetch_array($result))
 {
   foreach($row as $key =$value){ $$key=$value;}
 }



I don't get the code from the foreach loop.


I assume that you mean the meaning of $$key = $value.
This is a variable variable[1]
This means if you have a key in your array named dino then you assign 
$dino the value of $value for the current row.


so: $key = 'dino', $value = 'saur'
= $$key = $value = $$key = 'saur' = $dino = 'saur'

Hope this was somewhat helpful and understandable.

[1] http://php.net/manual/en/language.variables.variable.php


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



Re: [PHP] Need help on increment date

2012-05-24 Thread Stuart Dallas
On 24 May 2012, at 08:18, Md Ashickur Rahman Noor wrote:

 I need help to increment date in php. I found this code helpful
 
 $date = strtotime(+1 day, strtotime(2007-02-28));
 
 echo date(Y-m-d, $date);
 
 
 But when My date is 2008-02-28 this code give output 2012-03-01. But it
 should  be  2008-02-29. Where I am getting wrong.

Works fine for me: http://dev.stut.net/php/increment_date.php

Have you extracted the above from other code, or are you seeing this behaviour 
with just those two lines?

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Need help on increment date

2012-05-24 Thread Md Ashickur Rahman Noor
Get this from 
herehttp://stackoverflow.com/questions/660501/simplest-way-to-increment-a-date-in-php
--
Dedicated Linux Forum in Bangladesh http://goo.gl/238Ck
2048R/89C932E1 http://goo.gl/TkP5U
Volunteer, FOSS Bangladesh http://fossbd.org/  Mozilla
Repshttp://reps.mozilla.org
01199151550


 Have you extracted the above from other code, or are you seeing this
 behaviour with just those two lines?

 -Stuart

 --
 Stuart Dallas
 3ft9 Ltd
 http://3ft9.com/


Re: [PHP] Need help on increment date

2012-05-24 Thread shiplu
It works for me too.

I tell you two things,
a) make sure there is a space after +1 day. So it should look like +1 day
. This ensures that the unix time is not concatenated with day.
b) calling strtotime 2 times is not a great solution. You can all it once
only.  Like this,

$date = strtotime http://www.php.net/strtotime(+1 day 2008-02-28);

// better to call this, as the order is quite logical

$date = strtotime http://www.php.net/strtotime(2008-02-28 +1 day);

-- 
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader


Re: [PHP] Need help on increment date

2012-05-24 Thread Md Ashickur Rahman Noor
It works. Thanks you two. Thanks Shiplu bro for the advice.
--
Dedicated Linux Forum in Bangladesh http://goo.gl/238Ck
2048R/89C932E1 http://goo.gl/TkP5U
Volunteer, FOSS Bangladesh http://fossbd.org/  Mozilla
Repshttp://reps.mozilla.org
01199151550

On 24 May 2012 15:08, shiplu shiplu@gmail.com wrote:

 $date = strtotime http://www.php.net/strtotime(2008-02-28 +1 day);





Re: [PHP] Need help Wth PHP

2011-10-10 Thread Lester Caine

Rod Lindgren wrote:

Thanks for the link. I am now wondering if Wordpress is available on my
server.
If it's not, you can add it yourself in much the same way you uploaded the 
'profile' for the wordpress site ... http://wordpress.org/download/
Essentially it is just another PHP application, but you do need the database 
that goes with the original site.


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

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



RE: [PHP] Need help Wth PHP

2011-10-10 Thread Rod Lindgren
I was able to install Wordpress, but how do I identify the database from the
original site? Do I need to change some settings in it somewhere with the
authorizations from the new install on the new server? Right now, if you go
to the website, a generic page created by the install comes up. I seem to
have lost the original page. 

Thanks,
Rod

-Original Message-
From: Lester Caine [mailto:les...@lsces.co.uk] 
Sent: Sunday, October 09, 2011 11:31 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Need help Wth PHP

Rod Lindgren wrote:
 Thanks for the link. I am now wondering if Wordpress is available on my
 server.
If it's not, you can add it yourself in much the same way you uploaded the 
'profile' for the wordpress site ... http://wordpress.org/download/
Essentially it is just another PHP application, but you do need the database

that goes with the original site.

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

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

-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11


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



Re: [PHP] Need help Wth PHP

2011-10-10 Thread Lester Caine

Rod Lindgren wrote:

I was able to install Wordpress, but how do I identify the database from the
original site? Do I need to change some settings in it somewhere with the
authorizations from the new install on the new server? Right now, if you go
to the website, a generic page created by the install comes up. I seem to
have lost the original page.


On the original host, there would be a mysql database in addition to the 
'website' and it is that which you need to copy over. This is where it gets fun 
as there is no one way of doing it and it depends on the hosts way of providing 
mysql databases :(


( I don't use mysql at all myself, but someone should be able to direct you to 
the right way of doing it )


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

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



Re: [PHP] Need help Wth PHP

2011-10-10 Thread Jeffrin Jose
there is a file called wp-config.h  in wordpress files mostly located 
in the source parent there you can see the database name , username
and password. that file also may contain the site url. This way you may
be able to identify the database from the original site. 

If you do not have wordpress in your new server you may be able
to install it using cpanel application..


 
software engineer
department of computer science
Rajagiri school of engineering and technology.



From: Rod Lindgren r...@okinawa-te.info
To: 'Lester Caine' les...@lsces.co.uk; php-general@lists.php.net
Sent: Monday, 10 October 2011 1:37 PM
Subject: RE: [PHP] Need help Wth PHP

I was able to install Wordpress, but how do I identify the database from the
original site? Do I need to change some settings in it somewhere with the
authorizations from the new install on the new server? Right now, if you go
to the website, a generic page created by the install comes up. I seem to
have lost the original page. 

Thanks,
Rod

-Original Message-
From: Lester Caine [mailto:les...@lsces.co.uk] 
Sent: Sunday, October 09, 2011 11:31 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Need help Wth PHP

Rod Lindgren wrote:
 Thanks for the link. I am now wondering if Wordpress is available on my
 server.
If it's not, you can add it yourself in much the same way you uploaded the 
'profile' for the wordpress site ... http://wordpress.org/download/
Essentially it is just another PHP application, but you do need the database

that goes with the original site.

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

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

-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11


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





RE: [PHP] Need help Wth PHP

2011-10-10 Thread Jen Rasmussen
If I remember this correctly ... 

The database information can be setup/modified only with the
install/reinstall. 
If the DB's are moving to a new server, You have to copy out the databases
directly from the DB manager and then do a fresh install of WP. 
You should also copy out any custom theme css .. 

When you go through the installation process, you can specify your new DB
access info and then once installed and theme selected, 
copy in the archived CSS from the old install. It's a bit tricky. 

I'm trying to direct you to the correct process based on memory from when
I've had to do in the past,
so apologies if it's a bit spotty but it is definitely more of a manual than
automated process.

1. Backup DB's directly from old DB manager (i.e. MySQL or other)
2. Archive custom theme css if applied
3. Export posts from old WP install admin as a safety measure 
4. New install of WP at new URL 
4. Specify new server DB access info and new WP and site URL's during new
install
5. Apply appropriate theme and update any custom css with archived css from
old install.

I hope that helps... not saying this is the only way if there is other
advice to be offered, but this is what has worked for me. 

Jen


-Original Message-
From: Rod Lindgren [mailto:r...@okinawa-te.info] 
Sent: Monday, October 10, 2011 3:08 AM
To: 'Lester Caine'; php-general@lists.php.net
Subject: RE: [PHP] Need help Wth PHP

I was able to install Wordpress, but how do I identify the database from the
original site? Do I need to change some settings in it somewhere with the
authorizations from the new install on the new server? Right now, if you go
to the website, a generic page created by the install comes up. I seem to
have lost the original page. 

Thanks,
Rod

-Original Message-
From: Lester Caine [mailto:les...@lsces.co.uk] 
Sent: Sunday, October 09, 2011 11:31 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Need help Wth PHP

Rod Lindgren wrote:
 Thanks for the link. I am now wondering if Wordpress is available on my
 server.
If it's not, you can add it yourself in much the same way you uploaded the 
'profile' for the wordpress site ... http://wordpress.org/download/
Essentially it is just another PHP application, but you do need the database

that goes with the original site.

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

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

-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11


-- 
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] Need help Wth PHP

2011-10-10 Thread Jen Rasmussen
Ok, scratch the db info can only be setup/modified with
install/reinstall..
Forgot about wp-config.php ...doh!

Otherwise, you still need to backup the DBs from old server manually and
move them
to the new DB manager. I believe I did a fresh install because you also have
to update the URL settings in WP admin and I think I just found it easier
and less confusing
to do it the way I recommended.

Whoops ..good luck! 
Jen


-Original Message-
From: Jen Rasmussen [mailto:j...@cetaceasound.com] 
Sent: Monday, October 10, 2011 8:32 AM
To: r...@okinawa-te.info; php-general@lists.php.net
Subject: RE: [PHP] Need help Wth PHP

If I remember this correctly ... 

The database information can be setup/modified only with the
install/reinstall. 
If the DB's are moving to a new server, You have to copy out the databases
directly from the DB manager and then do a fresh install of WP. 
You should also copy out any custom theme css .. 

When you go through the installation process, you can specify your new DB
access info and then once installed and theme selected, 
copy in the archived CSS from the old install. It's a bit tricky. 

I'm trying to direct you to the correct process based on memory from when
I've had to do in the past,
so apologies if it's a bit spotty but it is definitely more of a manual than
automated process.

1. Backup DB's directly from old DB manager (i.e. MySQL or other)
2. Archive custom theme css if applied
3. Export posts from old WP install admin as a safety measure 
4. New install of WP at new URL 
4. Specify new server DB access info and new WP and site URL's during new
install
5. Apply appropriate theme and update any custom css with archived css from
old install.

I hope that helps... not saying this is the only way if there is other
advice to be offered, but this is what has worked for me. 

Jen


-Original Message-
From: Rod Lindgren [mailto:r...@okinawa-te.info] 
Sent: Monday, October 10, 2011 3:08 AM
To: 'Lester Caine'; php-general@lists.php.net
Subject: RE: [PHP] Need help Wth PHP

I was able to install Wordpress, but how do I identify the database from the
original site? Do I need to change some settings in it somewhere with the
authorizations from the new install on the new server? Right now, if you go
to the website, a generic page created by the install comes up. I seem to
have lost the original page. 

Thanks,
Rod

-Original Message-
From: Lester Caine [mailto:les...@lsces.co.uk] 
Sent: Sunday, October 09, 2011 11:31 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Need help Wth PHP

Rod Lindgren wrote:
 Thanks for the link. I am now wondering if Wordpress is available on my
 server.
If it's not, you can add it yourself in much the same way you uploaded the 
'profile' for the wordpress site ... http://wordpress.org/download/
Essentially it is just another PHP application, but you do need the database

that goes with the original site.

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

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

-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11


-- 
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Need help Wth PHP

2011-10-10 Thread Rod Lindgren
Thanks for the info. Very helpful. I am working on it. 

What is it that makes Wordpress valuable? The website in question is really
pretty basic. I am trying to figure out the reason Wordpress was used. 

Rod

-Original Message-
From: Jen Rasmussen [mailto:j...@cetaceasound.com] 
Sent: Monday, October 10, 2011 6:37 AM
To: r...@okinawa-te.info; php-general@lists.php.net
Subject: RE: [PHP] Need help Wth PHP

Ok, scratch the db info can only be setup/modified with
install/reinstall..
Forgot about wp-config.php ...doh!

Otherwise, you still need to backup the DBs from old server manually and
move them
to the new DB manager. I believe I did a fresh install because you also have
to update the URL settings in WP admin and I think I just found it easier
and less confusing
to do it the way I recommended.

Whoops ..good luck! 
Jen


-Original Message-
From: Jen Rasmussen [mailto:j...@cetaceasound.com] 
Sent: Monday, October 10, 2011 8:32 AM
To: r...@okinawa-te.info; php-general@lists.php.net
Subject: RE: [PHP] Need help Wth PHP

If I remember this correctly ... 

The database information can be setup/modified only with the
install/reinstall. 
If the DB's are moving to a new server, You have to copy out the databases
directly from the DB manager and then do a fresh install of WP. 
You should also copy out any custom theme css .. 

When you go through the installation process, you can specify your new DB
access info and then once installed and theme selected, 
copy in the archived CSS from the old install. It's a bit tricky. 

I'm trying to direct you to the correct process based on memory from when
I've had to do in the past,
so apologies if it's a bit spotty but it is definitely more of a manual than
automated process.

1. Backup DB's directly from old DB manager (i.e. MySQL or other)
2. Archive custom theme css if applied
3. Export posts from old WP install admin as a safety measure 
4. New install of WP at new URL 
4. Specify new server DB access info and new WP and site URL's during new
install
5. Apply appropriate theme and update any custom css with archived css from
old install.

I hope that helps... not saying this is the only way if there is other
advice to be offered, but this is what has worked for me. 

Jen


-Original Message-
From: Rod Lindgren [mailto:r...@okinawa-te.info] 
Sent: Monday, October 10, 2011 3:08 AM
To: 'Lester Caine'; php-general@lists.php.net
Subject: RE: [PHP] Need help Wth PHP

I was able to install Wordpress, but how do I identify the database from the
original site? Do I need to change some settings in it somewhere with the
authorizations from the new install on the new server? Right now, if you go
to the website, a generic page created by the install comes up. I seem to
have lost the original page. 

Thanks,
Rod

-Original Message-
From: Lester Caine [mailto:les...@lsces.co.uk] 
Sent: Sunday, October 09, 2011 11:31 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Need help Wth PHP

Rod Lindgren wrote:
 Thanks for the link. I am now wondering if Wordpress is available on my
 server.
If it's not, you can add it yourself in much the same way you uploaded the 
'profile' for the wordpress site ... http://wordpress.org/download/
Essentially it is just another PHP application, but you do need the database

that goes with the original site.

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

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

-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11


-- 
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11


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

Re: [PHP] Need help Wth PHP

2011-10-10 Thread Paul M Foster
On Mon, Oct 10, 2011 at 03:58:31PM -0700, Rod Lindgren wrote:

 Thanks for the info. Very helpful. I am working on it. 
 
 What is it that makes Wordpress valuable? The website in question is really
 pretty basic. I am trying to figure out the reason Wordpress was used. 

It allows the site owner to directly modify the site, without having to
call a programmer or web developer.

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

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



RE: [PHP] Need help Wth PHP

2011-10-10 Thread Rod Lindgren
I see. There are other ways to do this. If I knew how it works, maybe I
could get this site working. I am missing some essential concept here.

-Original Message-
From: Paul M Foster [mailto:pa...@quillandmouse.com] 
Sent: Monday, October 10, 2011 7:00 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Need help Wth PHP

On Mon, Oct 10, 2011 at 03:58:31PM -0700, Rod Lindgren wrote:

 Thanks for the info. Very helpful. I am working on it. 
 
 What is it that makes Wordpress valuable? The website in question is
really
 pretty basic. I am trying to figure out the reason Wordpress was used. 

It allows the site owner to directly modify the site, without having to
call a programmer or web developer.

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

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

-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11


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



Re: [PHP] Need help Wth PHP

2011-10-10 Thread Govinda
 I see. There are other ways to do this. If I knew how it works, maybe I
 could get this site working. I am missing some essential concept here.

Rod, 

this list is about/using PHP especially.  There are better lists/forums for 
getting help with frameworks built from PHP, like e.g. wordpress.
I think you are just going to have to start from the beginning and learn 
wordpress as if from scratch, if you choose to stay in that environment.  As 
you study, you'll breeze through where you already know.. and discover (more 
slowly) where are the holes in your understanding, that you need.

Besides finding a suitable forum/list, just doing searches on Google will 
undoubtedly yield the answers you want, too.

-Govinda


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



Re: [PHP] Need help Wth PHP

2011-10-09 Thread James Yerge
On 10/09/2011 08:41 PM, Rod Lindgren wrote:
 I have a hosting account and am trying to get a friend's website up and
 running. We downloaded his existing site from his current host and uploaded
 it to my host. It is currently under a subdomain, www.egypt.aragren.com
 http://www.egypt.aragren.com/ . When I go there, I get an error message
 that says, Error establishing a database connection. What causes this and
 how can I fix it? 


  

 Sensei Rod Lindgren

  

 Sent from my Gateway computer

  

  


This issue isn't related to PHP but the cause of the error is due to the
scripts' inability to make a connection to the database. The error looks
like it's coming from WordPress, I could be wrong but if that's the case
then you need to update the wp-config.php file to reflect the proper
credentials to log into the database.

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



RE: [PHP] Need help Wth PHP

2011-10-09 Thread Rod Lindgren
Interesting. The wp-config.php file only contains the following:

html
head

meta http-equiv=content-type content=text/html; charset=ISO-8859-1
/head
body
br
/body
/html

Not sure where to go from here. Thanks for the input. Any more input is
appreciated.

Rod

-Original Message-
From: James Yerge [mailto:ja...@nixsecurity.org] 
Sent: Sunday, October 09, 2011 5:46 PM
To: r...@okinawa-te.info
Cc: php-general@lists.php.net
Subject: Re: [PHP] Need help Wth PHP

On 10/09/2011 08:41 PM, Rod Lindgren wrote:
 I have a hosting account and am trying to get a friend's website up and
 running. We downloaded his existing site from his current host and
uploaded
 it to my host. It is currently under a subdomain, www.egypt.aragren.com
 http://www.egypt.aragren.com/ . When I go there, I get an error message
 that says, Error establishing a database connection. What causes this
and
 how can I fix it? 


  

 Sensei Rod Lindgren

  

 Sent from my Gateway computer

  

  


This issue isn't related to PHP but the cause of the error is due to the
scripts' inability to make a connection to the database. The error looks
like it's coming from WordPress, I could be wrong but if that's the case
then you need to update the wp-config.php file to reflect the proper
credentials to log into the database.
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1410 / Virus Database: 1520/3943 - Release Date: 10/07/11


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



Re: [PHP] Need help calling multiple functions with if_is

2010-07-31 Thread Jason Pruim

Hi Vince,


On Jul 31, 2010, at 3:15 PM, Vince Leibowitz wrote:


?php if (is_home(?php wpads('728leaderboard'); ?)
(is_page(42)(?php wpads('leaderboard1'); ? (is_page(10)(php?
wpads('leaderboard5);?) ?


Try:



?php



if (is_home(wpads('728leaderboard');)



(is_page(42)( wpads('leaderboard1')



(is_page(10)(wpads('leaderboard5))


?

All I did was pull out all the jumps into PHP since the whole thing is  
a php if statement I didn't see the need to keep opening and closing  
php... Unless I'm not understanding why you are :)




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



Re: [PHP] Need help calling multiple functions with if_is

2010-07-31 Thread Vince Leibowitz
That looks like it should work, but it doesn't. There isn't a reason
to close the embedded php statements, but I suspect wpads isn't
recognizing the call when it is embedded like this. It just brings up
a blank page in all instances, which is the same issue I was having
with the original code string.

On Sat, Jul 31, 2010 at 2:25 PM, Jason Pruim li...@pruimphotography.com wrote:
 Hi Vince,


 On Jul 31, 2010, at 3:15 PM, Vince Leibowitz wrote:

 ?php if (is_home(?php wpads('728leaderboard'); ?)
 (is_page(42)(?php wpads('leaderboard1'); ? (is_page(10)(php?
 wpads('leaderboard5);?) ?

 Try:


 ?php

 if (is_home(wpads('728leaderboard');)

 (is_page(42)( wpads('leaderboard1')

 (is_page(10)(wpads('leaderboard5))

 ?

 All I did was pull out all the jumps into PHP since the whole thing is a php
 if statement I didn't see the need to keep opening and closing php... Unless
 I'm not understanding why you are :)






-- 
~~
Vince Leibowitz
CapitolAnnex.com
twitter.com/CapitolAnnex
myspace.com/capitolannex facebook.com/profile.php?id=501233189
vince.leibow...@gmail.com
AOL, MSN, Yahoo: vpltz || ICQ: 118433437

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



Re: [PHP] Need help calling multiple functions with if_is

2010-07-31 Thread Jason Pruim


On Jul 31, 2010, at 3:34 PM, Vince Leibowitz wrote:


That looks like it should work, but it doesn't. There isn't a reason
to close the embedded php statements, but I suspect wpads isn't
recognizing the call when it is embedded like this. It just brings up
a blank page in all instances, which is the same issue I was having
with the original code string.

On Sat, Jul 31, 2010 at 2:25 PM, Jason Pruim li...@pruimphotography.com 
 wrote:

Hi Vince,


On Jul 31, 2010, at 3:15 PM, Vince Leibowitz wrote:


?php if (is_home(?php wpads('728leaderboard'); ?)
(is_page(42)(?php wpads('leaderboard1'); ? (is_page(10)(php?
wpads('leaderboard5);?) ?


Try:



?php



if (is_home(wpads('728leaderboard');)



(is_page(42)( wpads('leaderboard1')


I just noticed right here... You're missing a '  which would cause  
problems... Very possibly what would fix it in fact



(is_page(10)(wpads('leaderboard5))


?

All I did was pull out all the jumps into PHP since the whole thing  
is a php
if statement I didn't see the need to keep opening and closing  
php... Unless

I'm not understanding why you are :)







--
~~
Vince Leibowitz
CapitolAnnex.com
twitter.com/CapitolAnnex
myspace.com/capitolannex facebook.com/profile.php?id=501233189
vince.leibow...@gmail.com
AOL, MSN, Yahoo: vpltz || ICQ: 118433437



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



Re: [PHP] Need help calling multiple functions with if_is

2010-07-31 Thread Peter Lind
On 31 July 2010 21:34, Vince Leibowitz vince.leibow...@gmail.com wrote:
 That looks like it should work, but it doesn't. There isn't a reason
 to close the embedded php statements, but I suspect wpads isn't
 recognizing the call when it is embedded like this. It just brings up
 a blank page in all instances, which is the same issue I was having
 with the original code string.

 On Sat, Jul 31, 2010 at 2:25 PM, Jason Pruim li...@pruimphotography.com 
 wrote:
 Hi Vince,


 On Jul 31, 2010, at 3:15 PM, Vince Leibowitz wrote:

 ?php if (is_home(?php wpads('728leaderboard'); ?)
 (is_page(42)(?php wpads('leaderboard1'); ? (is_page(10)(php?
 wpads('leaderboard5);?) ?

 Try:


 ?php

 if (is_home(wpads('728leaderboard');)

 (is_page(42)( wpads('leaderboard1')

 (is_page(10)(wpads('leaderboard5))

 ?

 All I did was pull out all the jumps into PHP since the whole thing is a php
 if statement I didn't see the need to keep opening and closing php... Unless
 I'm not understanding why you are :)





?php
if (is_home) wpads('728leaderboard');
elseif (is_page(42)) wpads('leaderboard1');
elseif (is_page(10)) wpads('leaderboard5);
?

That's assuming you just want to call wpads. If you want to output the
return of wpads, stick echos in there.

And might I kindly ask of you to please read
http://dk2.php.net/manual/en/control-structures.if.php and
http://dk2.php.net/manual/en/language.basic-syntax.phpmode.php

Regards
Peter

-- 
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
/hype

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



Re: [PHP] Need help calling multiple functions with if_is

2010-07-31 Thread Vince Leibowitz
Peter,

That works like a dream! Thanks very much for your help and pointing
me to those pages. I've already noticed something over there that will
fix another problem I've been having.

You folks are great for offering the assistance. Have a good weekend.

Vince

On Sat, Jul 31, 2010 at 2:50 PM, Peter Lind peter.e.l...@gmail.com wrote:
 On 31 July 2010 21:34, Vince Leibowitz vince.leibow...@gmail.com wrote:
 That looks like it should work, but it doesn't. There isn't a reason
 to close the embedded php statements, but I suspect wpads isn't
 recognizing the call when it is embedded like this. It just brings up
 a blank page in all instances, which is the same issue I was having
 with the original code string.

 On Sat, Jul 31, 2010 at 2:25 PM, Jason Pruim li...@pruimphotography.com 
 wrote:
 Hi Vince,


 On Jul 31, 2010, at 3:15 PM, Vince Leibowitz wrote:

 ?php if (is_home(?php wpads('728leaderboard'); ?)
 (is_page(42)(?php wpads('leaderboard1'); ? (is_page(10)(php?
 wpads('leaderboard5);?) ?

 Try:


 ?php

 if (is_home(wpads('728leaderboard');)

 (is_page(42)( wpads('leaderboard1')

 (is_page(10)(wpads('leaderboard5))

 ?

 All I did was pull out all the jumps into PHP since the whole thing is a php
 if statement I didn't see the need to keep opening and closing php... Unless
 I'm not understanding why you are :)





 ?php
    if (is_home) wpads('728leaderboard');
    elseif (is_page(42)) wpads('leaderboard1');
    elseif (is_page(10)) wpads('leaderboard5);
 ?

 That's assuming you just want to call wpads. If you want to output the
 return of wpads, stick echos in there.

 And might I kindly ask of you to please read
 http://dk2.php.net/manual/en/control-structures.if.php and
 http://dk2.php.net/manual/en/language.basic-syntax.phpmode.php

 Regards
 Peter

 --
 hype
 WWW: http://plphp.dk / http://plind.dk
 LinkedIn: http://www.linkedin.com/in/plind
 BeWelcome/Couchsurfing: Fake51
 Twitter: http://twitter.com/kafe15
 /hype




-- 
~~
Vince Leibowitz
CapitolAnnex.com
twitter.com/CapitolAnnex
myspace.com/capitolannex facebook.com/profile.php?id=501233189
vince.leibow...@gmail.com
AOL, MSN, Yahoo: vpltz || ICQ: 118433437

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



Re: [PHP] need help w/ unfamiliar syntax

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

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

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

    $this-{$spec}

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

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

 tia

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

It works for function and class names as well.

-- 
Daniel Egeberg

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



Re: [PHP] need help w/ unfamiliar syntax

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

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



Re: [PHP] need help w/ unfamiliar syntax

2010-04-11 Thread Robert Cummings



Daniel Egeberg wrote:

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

Hi all,

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

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

   $this-{$spec}

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

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

tia


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

It works for function and class names as well.


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


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

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



Re: [PHP] Need Help.

2009-07-14 Thread Ashley Sheridan
On Tue, 2009-07-14 at 11:59 +0530, Girish Padia wrote:
 Dear Sir,
 
 I am facing two problem while developing my site in php.
 1) I want to delete browser history whenever i migrate from one page to
 another. so that user can never press Back button.
 2) I have 20 users who have access to my site. Right now I am checking this
 using cookies. I want to know which is better to track user login : Cookies
 or Session ?
 
 Please do reply.
 
 With regards,
 
 Girish

You can't delete the users browser history, but what you can do is use
an entirely AJAX based website, so that there is no back/forward option.
However, this may be a little complex for you unless you have at least a
fair understanding of HTML Dom, and Javascript.

To understand which is betterm you need to understand how they work.
Cookies are persistent text files left on the users computer. They are
limited in the amount of data you can store in them, but they can store
information across physical browsing sessions. For example, you could
use them to remember a users preferred layout for your site, etc.

Sessions variables are all stored on your server, and generally last
only for the time that a visitor is on your site. They are referenced
automatically by PHP through a session ID, which is usually stored in a
cookie, but you can force it to be sent only in the URL if you wish.

The advantage that sessions have over cookies is the ability to store
more data, and as it is server-side, you can store things without
worrying too much about that data being accessed by someone other than
your user. Cookies have the advantage of persistence over time
(depending on how long you prefer to store them). You should not that
some users see cookies as invasive, and may have them turned off in the
browser. I'd say if you can do something server or client-side, you're
better off doing it where you have the greatest control, a la
server-side.

Thanks
Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Need Help.

2009-07-14 Thread Carlos Medina

Hi Girish,
You can save the SEssion id in a Cookie to make it available over 
requests and over days too. If you use Sessions stored on DB, you can 
get more security, when the SEssion Cookie is stored Encrypted. Other 
Option is to send the Session id, most know as PHPSESSIONID, as GET 
Variable.


REgards

Carlos

Ashley Sheridan schrieb:

On Tue, 2009-07-14 at 11:59 +0530, Girish Padia wrote:

Dear Sir,

I am facing two problem while developing my site in php.
1) I want to delete browser history whenever i migrate from one page to
another. so that user can never press Back button.
2) I have 20 users who have access to my site. Right now I am checking this
using cookies. I want to know which is better to track user login : Cookies
or Session ?

Please do reply.

With regards,

Girish


You can't delete the users browser history, but what you can do is use
an entirely AJAX based website, so that there is no back/forward option.
However, this may be a little complex for you unless you have at least a
fair understanding of HTML Dom, and Javascript.

To understand which is betterm you need to understand how they work.
Cookies are persistent text files left on the users computer. They are
limited in the amount of data you can store in them, but they can store
information across physical browsing sessions. For example, you could
use them to remember a users preferred layout for your site, etc.

Sessions variables are all stored on your server, and generally last
only for the time that a visitor is on your site. They are referenced
automatically by PHP through a session ID, which is usually stored in a
cookie, but you can force it to be sent only in the URL if you wish.

The advantage that sessions have over cookies is the ability to store
more data, and as it is server-side, you can store things without
worrying too much about that data being accessed by someone other than
your user. Cookies have the advantage of persistence over time
(depending on how long you prefer to store them). You should not that
some users see cookies as invasive, and may have them turned off in the
browser. I'd say if you can do something server or client-side, you're
better off doing it where you have the greatest control, a la
server-side.

Thanks
Ash
www.ashleysheridan.co.uk



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



Re: [PHP] Need Help.

2009-07-14 Thread kranthi
Hi Girish,

1. You cannot modify the browser Back button (any thing on the
client's computer for that matter).
2. I strongly oppose the use of Cookies for tracking the user login,
due to security reasons. Cookies are saved on the client's computer
and he/she can easily modify the information present. But that is
impossible with sessions.

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



Re: [PHP] Need Help.

2009-07-14 Thread Martin Scotta
hahahahahaha

How are you to delete my history?
The fact that you develop a website does not allow you to take the
control of my browser.

But you can avoid the history to be populated by using javascript

a href=lalalal.html onclick=document.location.replace(this.href)
 Click to lalalal
/a

The replace() method loads a new page, specified by URL, in the
current browser window.
The new page replaces the previous page's position in the history list.

On Tue, Jul 14, 2009 at 5:51 AM, kranthikranthi...@gmail.com wrote:
 Hi Girish,

 1. You cannot modify the browser Back button (any thing on the
 client's computer for that matter).
 2. I strongly oppose the use of Cookies for tracking the user login,
 due to security reasons. Cookies are saved on the client's computer
 and he/she can easily modify the information present. But that is
 impossible with sessions.

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





-- 
Martin Scotta

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



RE: [PHP] Need Help.

2009-07-14 Thread Bob McConnell
From: Martin Scotta
 
 hahahahahaha
 
 How are you to delete my history?
 The fact that you develop a website does not allow you to take the
 control of my browser.
 
 But you can avoid the history to be populated by using javascript
 
 a href=lalalal.html onclick=document.location.replace(this.href)
  Click to lalalal
 /a

That would prevent me from navigating the site since I won't enable
JavaScript in my browser until I have trust in your website not to allow
any installation of malware on my computer. That trust must be earned by
you, since trust is not associative. Yes, there are a lot of sites that
I can't visit because of that. Right now I won't even enable JS for
either my bank or credit card issuer since neither has demonstrated the
knowledge, desire or ability to protect their servers or my browser.

Bob McConnell

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



Re: [PHP] Need Help.

2009-07-14 Thread Martin Scotta
I know... this is not for a php thread... but...

If you look at the HTML the a tag is made completely unobtrusive.
The link will still working without javascript.

This is the original tag (with javascript)
 a href=lalalal.html onclick=document.location.replace(this.href)
 Click to lalalal
 /a

This is how the browser looks it without javascript
 a href=lalalal.html
 Click to lalalal
 /a

I've said it is not for a php thread

On Tue, Jul 14, 2009 at 10:29 AM, Bob McConnellr...@cbord.com wrote:
 From: Martin Scotta

 hahahahahaha

 How are you to delete my history?
 The fact that you develop a website does not allow you to take the
 control of my browser.

 But you can avoid the history to be populated by using javascript

 a href=lalalal.html onclick=document.location.replace(this.href)
      Click to lalalal
 /a

 That would prevent me from navigating the site since I won't enable
 JavaScript in my browser until I have trust in your website not to allow
 any installation of malware on my computer. That trust must be earned by
 you, since trust is not associative. Yes, there are a lot of sites that
 I can't visit because of that. Right now I won't even enable JS for
 either my bank or credit card issuer since neither has demonstrated the
 knowledge, desire or ability to protect their servers or my browser.

 Bob McConnell




-- 
Martin Scotta

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



Re: [PHP] need help with code

2009-03-22 Thread VamVan
Code without proper indentation and is very hard to comprehend. You have
unnecessary spacing and line breaks that makes it difficult to debug.

I suggest you few things as a good practice:

1) Until you learn perfectly to code use some nice GUI editors that have
syntax highlighting (aptana, eclipse, zend etc).
2) Don't try to mix up markup (html) and api calls(PHP Code). Believe it
become a horrible mess to maintain after some point.

Anyways Here is your code with parse error removed:

?php
require_once('twitterlib.php');

$consumerKey=yVVRd1QCJYBtT8tT7ocg;

$consumerSecret=DHzhJYOP2hBWfHpHawGxRQEFf98nF4TBTfabel2ukE;
$accessToken = $_COOKIE['accessToken'];
$reqToken = $_COOKIE['reqToken'];

if($accessToken===NULL){
  if ($reqToken === NULL){
//get a req token
$to = new TwitterOAuth($consumerKey, $consumerSecret);
$tok = $to-getRequestToken();
$reqToken = $tok['oauth_token'];
$reqTokenSecret = $tok['oauth_token_secret'];
$request_link = $to-getAuthorizeURL($toc);
$content = 'Click on the link to go to twitter to authorize your
account.';
$content .= 'br /a href='.$request_link.''.$request_link.'/a';
setCookie('reqToken',$reqToken,time()+(24*30*60*60),'/');
setCookie('reqTokenSecret',$reqTokenSecret,time()+(24*30*60*60),'/');

?
htmlheadtitleauthorize/title/headbody
?php echo $content;?
/body/html
?php
   }else{
/* If the access tokens are already set skip to the API call */
if ($_COOKIE['accessToken']===NULL){
  /* Create TwitterOAuth object with app key/secret and token key/secret
from default phase */
  $to = new
TwitterOAuth($consumerKey,$consumerSecret,$_COOKIE['reqToken'],$_COOKIE['reqTokenSecret']);

  /* Request access tokens from twitter */
  $tok = $to-getAccessToken();
  /* Save the access tokens. Normally these would be saved in a database
for future use.*/

setCookie('accessToken',$tok['oauth_token'],time()*24*60*60*30+3600,'/');

setCookie('accessTokenSecret',$tok['oauth_token_secret'],time()*24*60*60*30,'/');
  header(location http://www.chriswestbrook.com/twitter/twitter.php;);

}
  }
}
?

Thanks,
V


Re: [PHP] need help with code

2009-03-21 Thread Daniel Brown
On Sat, Mar 21, 2009 at 10:42, Chris Westbrook westbch...@gmail.com wrote:
 I hate asking for help with simple code like this because I can usually 
 figure it out, but I'm stumped on this one.  I'm getting a parser error on 
 line 13, whether I comment out the require_once line or not.   Can you help?

Probably, but we'll need the error message and the code on the
offending line.  My guess from what you've shown in the code below is
that line 13:

$to = new TwitterOAuth($consumerKey, $consumerSecret);

 is telling you that it doesn't know TwitterOAuth().  And if
that's the case, are you sure that it's properly defined and being
included as appropriate from twitterlib.php?


 ?php
 require_once('twitterlib.php');

 $consumerKey=yVVRd1QCJYBtT8tT7ocg;

 $consumerSecret=DHzhJYOP2hBWfHpHawGxRQEFf98nF4TBTfabel2ukE;
 $accessToken = $_COOKIE['accessToken'];
 $reqToken = $_COOKIE['reqToken'];
 if ($accessToken===NULL)
 {
 if ($reqToken === NULL)
 {
 //get a req token
 $to = new TwitterOAuth($consumerKey, $consumerSecret);
 $tok = $to-getRequestToken();


 $reqToken = $tok['oauth_token'];

 $reqTokenSecret = $tok['oauth_token_secret'];



 $request_link = $to-getAuthorizeURL($toc);


 $content = 'Click on the link to go to twitter to authorize your account.';

 $content .= 'br /a href='.$request_link.''.$request_link.'/a';
 setCookie('reqToken',$reqToken,time()+(24*30*60*60),'/');
 setCookie('reqTokenSecret',$reqTokenSecret,time()+(24*30*60*60),'/');

 ?
 htmlheadtitleauthorize/title/headbody
 ?php echo $content;?
 /body/html
 ?php
 }
 else
 {
 /* If the access tokens are already set skip to the API call */

 if ($_COOKIE['accessToken']===NULL)
 {
 /* Create TwitterOAuth object with app key/secret and token key/secret from 
 default phase */

 $to = new 
 TwitterOAuth($consumerKey,$consumerSecret,$_COOKIE['reqToken'],$_COOKIE['reqTokenSecret']);

 /* Request access tokens from twitter */

 $tok = $to-getAccessToken();

 /* Save the access tokens. Normally these would be saved in a database for 
 future use. */

 setCookie('accessToken',tok['oauth_token'],time()*24*60*60*30,'/')
 setCookie('accessTokenSecret',tok['oauth_token_secret'],time()*24*60*60*30,'/')
 header(location http://www.chriswestbrook.com/twitter/twitter.php;);

 }


 }
 ?



-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] need help with code

2009-03-21 Thread Virgilio Quilario
 I hate asking for help with simple code like this because I can usually 
 figure it out, but I'm stumped on this one.  I'm getting a parser error on 
 line 13, whether I comment out the require_once line or not.   Can you help?

 ?php
 require_once('twitterlib.php');

 $consumerKey=yVVRd1QCJYBtT8tT7ocg;

 $consumerSecret=DHzhJYOP2hBWfHpHawGxRQEFf98nF4TBTfabel2ukE;
 $accessToken = $_COOKIE['accessToken'];
 $reqToken = $_COOKIE['reqToken'];
 if ($accessToken===NULL)
 {
 if ($reqToken === NULL)
 {
 //get a req token
 $to = new TwitterOAuth($consumerKey, $consumerSecret);
 $tok = $to-getRequestToken();


 $reqToken = $tok['oauth_token'];

 $reqTokenSecret = $tok['oauth_token_secret'];



 $request_link = $to-getAuthorizeURL($toc);


 $content = 'Click on the link to go to twitter to authorize your account.';

 $content .= 'br /a href='.$request_link.''.$request_link.'/a';
 setCookie('reqToken',$reqToken,time()+(24*30*60*60),'/');
 setCookie('reqTokenSecret',$reqTokenSecret,time()+(24*30*60*60),'/');

 ?
 htmlheadtitleauthorize/title/headbody
 ?php echo $content;?
 /body/html
 ?php
 }
 else
 {
 /* If the access tokens are already set skip to the API call */

 if ($_COOKIE['accessToken']===NULL)
 {
 /* Create TwitterOAuth object with app key/secret and token key/secret from 
 default phase */

 $to = new 
 TwitterOAuth($consumerKey,$consumerSecret,$_COOKIE['reqToken'],$_COOKIE['reqTokenSecret']);

 /* Request access tokens from twitter */

 $tok = $to-getAccessToken();

 /* Save the access tokens. Normally these would be saved in a database for 
 future use. */

 setCookie('accessToken',tok['oauth_token'],time()*24*60*60*30,'/')
 setCookie('accessTokenSecret',tok['oauth_token_secret'],time()*24*60*60*30,'/')
 header(location http://www.chriswestbrook.com/twitter/twitter.php;);

 }


 }
 ?

hi Chris,

basing on the code you posted, you're missing the closing brace for
if ($accessToken===NULL)
{

there should be 3 closing braces before the last ?

cheers,
Virgil
http://www.jampmark.com

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



Re: [PHP] need help with code

2009-03-21 Thread Daniel Brown
On Sat, Mar 21, 2009 at 10:54, Virgilio Quilario
virgilio.quila...@gmail.com wrote:

 hi Chris,

 basing on the code you posted, you're missing the closing brace for
 if ($accessToken===NULL)
 {

 there should be 3 closing braces before the last ?

That'll be the next error, but that error would print unexpected
$end on line xxx.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] need help with code

2009-03-21 Thread Virgilio Quilario
 hi Chris,

 basing on the code you posted, you're missing the closing brace for
 if ($accessToken===NULL)
 {

 there should be 3 closing braces before the last ?

    That'll be the next error, but that error would print unexpected
 $end on line xxx.

well, if you're getting the parse error without additional description
then it must be the php versions because the lib might be throwing
exceptions and you are running php4.

cheers,
Virgil
http://www.jampmark.com
Free tips, tutorials, innovative tools and techniques useful for
building and improving web sites.

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



Re: [PHP] Need Help resolving the undefined variable and getting property of non-object errors

2009-01-27 Thread Stuart
2009/1/27 Terion Miller webdev.ter...@gmail.com:
 I am having problems resolving errors with some images causing the Undefined
 variable and getting property of non-object errors, I am trying to make a
 copy function so that an order can be viewed then resubmitted as a new order
 with minimal changes if needed.
 Here's my code: --could it be out of order as in the select should be above
 the insert?  I bolded where the errors are happening.

Holy crap on a cracker, I'm not gonna read all that.

An undefined variable notice basically means you're trying to use a
variable before it's been given a value, so look for that on and
around the line it complains about and either display the variables or
trace them back to confirm they contain what you think they do.

The other error indicates that you're trying to use object notation
(-) on a scalar (number, string or array). Again, look at the line it
points you to and confirm the variables it contains have the values
you think they should.

This is basic debugging. Spending time resolving these errors yourself
is time well spent, and the more you do it the easier it becomes.

-Stuart

-- 
http://stut.net/

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



Re: [PHP] Need Help

2008-12-29 Thread Eric Butera
On Mon, Dec 29, 2008 at 2:39 PM, dlinden dlin...@springtidepartners.com wrote:
 I am getting this error and can't resolve;

 Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result,
 boolean given in /home5/camfulco/public_html/CompanyHome.php on line 132


I'm not going to read all 500 lines of that, but I'm seeing your error
says boolean given.  Maybe your query failed and is false instead of a
resource.

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



Re: [PHP] Need Help

2008-12-29 Thread John Corry
1. It's generally considered poor etiquette to send that much code to a
mailing list. How about snipping the relevant section next time?

2. the error says: mysqli_fetch_assoc() expects parameter 1 to be
mysqli_result. There's your clue. Is the query good? Is the connection good?

I'm getting a little dismayed here lately at how many people are posting
to this list who don't have a clue and aren't willing to even TRY to get
a clue before asking for help from someone else.

Tracking down errors like this, function by function, is how you LEARN
this stuff.

Please do yourself (and everyone else on the list) a favor and do at
least just even a MODEST amount of research before sending your hundreds
of lines of crappy code out to the ether asking someone to fix it for you!

John

PS - sorry if that's not soft and sensitive enough. Where I come from
(vintage late 90s self-educated programmer), you didn't DARE ask for
help until you could demonstrate to everyone you were asking that you
had done your homework on the problem, researched the relevant
functions/error messages, tried some tests doing something similar, run
the query to make sure it's good...basically everything you COULD do to
debug your own mess.


dlinden wrote:
 I am getting this error and can't resolve;
 
 Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result,
 boolean given in /home5/camfulco/public_html/CompanyHome.php on line 132
 
 code listing follows;

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



Re: [PHP] Need Help - apology

2008-12-29 Thread John Corry

That was too heavy handed.

I'm sorry. Please forgive my harshness.

John

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



Re: [PHP] Need Help - apology

2008-12-29 Thread Eric Butera
On Mon, Dec 29, 2008 at 3:18 PM, John Corry jco...@gmail.com wrote:

 That was too heavy handed.

 I'm sorry. Please forgive my harshness.

 John

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



Having a bad day at work? ;)

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



Re: [PHP] Need help on MySQL query

2008-12-10 Thread German Geek
On Thu, Dec 11, 2008 at 4:52 PM, Rahat Bashir [EMAIL PROTECTED]wrote:

 Hi Experts,

 EID Mubarak to all.

 I need your help on writing a MySQL query.

 Scenario:

 CREATE TABLE transaction
 (
 `id` int NOT NULL ATUTO INCREMENT,
 `date` datetime  NOT NULL,
 `withdrawn` double (12,2) NULL,
 `deposit` double (12,2) NULL
 );

 SELECT * FROM transaction;


SELECT *,  deposit-withdrawn AS balance FROM transaction

Although i would suggest a transaction table to only have positive and
negative balances. Then you can do all sorts of things with it like get the
sum of all transactions a lot easier etc.

e.g.

SELECT SUM(balance) AS user_balance FROM transaction WHERE user_id=1

if you have a user id e.g. Are you working for a bank? :-)



 id  date
 withdrawn  deposit
 --
 --- --
 1   2008-12-01 00:00:00
 NULL1.00
 2   2008-12-02 00:00:00 4000.00
NULL
 3   2008-12-04 00:00:00 2000.00
NULL
 4   2008-12-05 00:00:00
 NULL4500.00
 5   2008-12-06 00:00:00 500.00
 1500.00

 The above is all I have. I want to make query which should output an extra
 calculated column named balance, something like following:

 Expected output from query:
 id  date
 withdrawn  depositbalance
 --
 --- -- -
 1   2008-12-01 00:00:00
 NULL1.00 1.00
 2   2008-12-02 00:00:00 4000.00
NULL  6000.00
 3   2008-12-04 00:00:00 2000.00
NULL  4000.00
 4   2008-12-05 00:00:00
 NULL4500.00   8500.00
 5   2008-12-06 00:00:00 500.00
 1500.00   9500.00

 Thanks in advance


 --
 Rahat Bashir
 Dhaka, Bangladesh



Re: [PHP] Need help on MySQL query

2008-12-10 Thread Andrew Ballard
On Wed, Dec 10, 2008 at 10:52 PM, Rahat Bashir [EMAIL PROTECTED] wrote:
 Hi Experts,

 EID Mubarak to all.

 I need your help on writing a MySQL query.

 Scenario:

 CREATE TABLE transaction
 (
 `id` int NOT NULL ATUTO INCREMENT,
 `date` datetime  NOT NULL,
 `withdrawn` double (12,2) NULL,
 `deposit` double (12,2) NULL
 );

 SELECT * FROM transaction;

 id  date
 withdrawn  deposit
 --
 --- --
 1   2008-12-01 00:00:00
 NULL1.00
 2   2008-12-02 00:00:00 4000.00
NULL
 3   2008-12-04 00:00:00 2000.00
NULL
 4   2008-12-05 00:00:00
 NULL4500.00
 5   2008-12-06 00:00:00 500.00
 1500.00

 The above is all I have. I want to make query which should output an extra
 calculated column named balance, something like following:

 Expected output from query:
 id  date
 withdrawn  depositbalance
 --
 --- -- -
 1   2008-12-01 00:00:00
 NULL1.00 1.00
 2   2008-12-02 00:00:00 4000.00
NULL  6000.00
 3   2008-12-04 00:00:00 2000.00
NULL  4000.00
 4   2008-12-05 00:00:00
 NULL4500.00   8500.00
 5   2008-12-06 00:00:00 500.00
 1500.00   9500.00

 Thanks in advance


 --
 Rahat Bashir
 Dhaka, Bangladesh


I would do the running sum in PHP rather than SQL. If your database
doesn't have an operator to perform running totals, it is possible but
the result usually involves correlated subqueries that usually result
in expensive triangular joins. (I think MySQL might have something
that will work, but I haven't tried it. STW for MySQL and running sum
and you'll find some discussion that should get you going.)

If you decide to do the calculation in SQL, you should modify your
table definition slightly:

CREATE TABLE transaction
(
`id` int NOT NULL AUTO INCREMENT,
`date` datetime  NOT NULL,
`withdrawn` double (12,2) NOT NULL DEFAULT 0.0,
`deposit` double (12,2) NOT NULL DEFAULT 0.0
);

The value of `withdrawn` and `deposit` should never be NULL. The value
of NULL in SQL is essentially an UNKNOWN/MISSING value. That's why SQL
calculations that involve NULL yield a NULL value. With the example
you posted, it would be like saying When I went to the bank December
1, I deposited 1.00 but I don't know how much I withdrew. What
would you say the net value of such a transaction would be? In your
database, neither `withdrawn` nor `deposit` should be UNKNOWN/MISSING.
(At least I would hope not!)

Andrew

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



Re: [PHP] Need help on MySQL query

2008-12-10 Thread clive

Rahat Bashir wrote:

I need your help on writing a MySQL query.

  

I see nothing php related in your question, try a mysql list.


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



Re: [PHP] Need help with regular expression

2008-07-10 Thread Maxim Antonov

Hello.

But I need no td and tr inside regular expression
It is a part of my templater.


In real code it looks like:
  if(strlen($item[$key])1){
return 
preg_replace('#\{%%%.*?\{%'.$key.'%\}.*?%%%\}#is','',$tpl);

}

if one of $key inside  {%%%  %%%} points to empty array item - all 
section between {%%% %%%} must be deleted.




Daniel Brown :

On Wed, Jul 9, 2008 at 5:21 AM, Maxim Antonov [EMAIL PROTECTED] wrote:

Hi, all!

I try to use folowing regular expression:
$out =
preg_replace('#\{%%%.*?\{%bigfoto%\}.*?%%%\}#is','==REPLACEMENT==',$str);


[snip!]

I need result as:

trtdNAME:/tdtdinput type=text name=name value=
size=80//td/tr
 trtdFoto:/tdtdinput type=file name=foto value={%foto%} /
 {%%%br/img alt={%name%} src={%foto%}/%%%}
 /td/tr
==REPLACEMENT==

[snip!]

To get it *exactly* as you've mentioned here, use this instead:

?php
$out = 
preg_replace('/trtdBig.*\{%%%.*\{%bigfoto%\}.*%%%\}.*\/tr/Uis','==REPLACEMENT==',$str);
?



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



RE: [PHP] Need help with regular expression

2008-07-10 Thread Boyd, Todd M.
 -Original Message-
 From: Maxim Antonov [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 10, 2008 4:24 AM
 To: php-general@lists.php.net; Daniel Brown
 Subject: Re: [PHP] Need help with regular expression
 
 Hello.
 
 But I need no td and tr inside regular expression
 It is a part of my templater.
 
 
 In real code it looks like:
if(strlen($item[$key])1){
  return
 preg_replace('#\{%%%.*?\{%'.$key.'%\}.*?%%%\}#is','',$tpl);
  }
 
 if one of $key inside  {%%%  %%%} points to empty array item - all
 section between {%%% %%%} must be deleted.

---8--- snip

Maxim,

You could try using a capture group, and re-assemble the match with
the match group inbetween your {%%% %%%} omitted. Just an idea.


Todd Boyd
Web Programmer




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



Re: [PHP] Need help with regular expression

2008-07-10 Thread Al

Your description of the problem is confusing.

Do you simply want to delete a table row if it contains a variable, e.g., $var='bigfoto' and append 
==REPLACEMENT== ? Where $var can be anything you assign.



Maxim Antonov wrote:

Hello.

But I need no td and tr inside regular expression
It is a part of my templater.


In real code it looks like:
  if(strlen($item[$key])1){
return 
preg_replace('#\{%%%.*?\{%'.$key.'%\}.*?%%%\}#is','',$tpl);

}

if one of $key inside  {%%%  %%%} points to empty array item - all 
section between {%%% %%%} must be deleted.




Daniel Brown :
On Wed, Jul 9, 2008 at 5:21 AM, Maxim Antonov [EMAIL PROTECTED] 
wrote:

Hi, all!

I try to use folowing regular expression:
$out =
preg_replace('#\{%%%.*?\{%bigfoto%\}.*?%%%\}#is','==REPLACEMENT==',$str); 




[snip!]

I need result as:

trtdNAME:/tdtdinput type=text name=name value=
size=80//td/tr
 trtdFoto:/tdtdinput type=file name=foto 
value={%foto%} /

 {%%%br/img alt={%name%} src={%foto%}/%%%}
 /td/tr
==REPLACEMENT==

[snip!]

To get it *exactly* as you've mentioned here, use this instead:

?php
$out = 
preg_replace('/trtdBig.*\{%%%.*\{%bigfoto%\}.*%%%\}.*\/tr/Uis','==REPLACEMENT==',$str); 


?



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



Re: [PHP] Need help with regular expression

2008-07-10 Thread Eric Butera
On Wed, Jul 9, 2008 at 5:21 AM, Maxim Antonov [EMAIL PROTECTED] wrote:
 Hi, all!

 I try to use folowing regular expression:
 $out =
 preg_replace('#\{%%%.*?\{%bigfoto%\}.*?%%%\}#is','==REPLACEMENT==',$str);

 It not work as I need. Please tell me - what I do wrong?

 I have string:


   trtdNAME:/tdtdinput type=text name=name value=
 size=80//td/tr
  trtdFoto:/tdtdinput type=file name=foto value={%foto%} /
  {%%%br/img alt={%name%} src={%foto%}/%%%}
  /td/tr
  trtdBig foto:/tdtdinput type=file name=bigfoto value= /
  {%%%br/img alt={%name%} src={%bigfoto%}/%%%}
  /td/tr



 I need result as:


 trtdNAME:/tdtdinput type=text name=name value=
 size=80//td/tr
  trtdFoto:/tdtdinput type=file name=foto value={%foto%} /
  {%%%br/img alt={%name%} src={%foto%}/%%%}
  /td/tr
 ==REPLACEMENT==


 And I have this result:

   trtdNAME:/tdtdinput type=text name=name value=
 size=80//td/tr
  trtdFoto:/tdtdinput type=file name=foto value={%foto%} /
 ==REPLACEMENT==
  /td/tr


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



I'm sure it won't be this easy because of who knows what (like
inheriting code, etc), but why not just use something easier like:


$replace = array(
'{%key1%}' = 'value1',
'{%key2%}' = 'value2'
);

$html = str_replace(
array_keys($replace),
array_values($replace),
file_get_contents('tpl.html')
);


Or the easiest is to just use raw php code seeing as php is a
templating language. :)

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



Re: [PHP] Need help with regular expression

2008-07-09 Thread Daniel Brown
On Wed, Jul 9, 2008 at 5:21 AM, Maxim Antonov [EMAIL PROTECTED] wrote:
 Hi, all!

 I try to use folowing regular expression:
 $out =
 preg_replace('#\{%%%.*?\{%bigfoto%\}.*?%%%\}#is','==REPLACEMENT==',$str);

[snip!]

 I need result as:

 trtdNAME:/tdtdinput type=text name=name value=
 size=80//td/tr
  trtdFoto:/tdtdinput type=file name=foto value={%foto%} /
  {%%%br/img alt={%name%} src={%foto%}/%%%}
  /td/tr
 ==REPLACEMENT==
[snip!]

To get it *exactly* as you've mentioned here, use this instead:

?php
$out = 
preg_replace('/trtdBig.*\{%%%.*\{%bigfoto%\}.*%%%\}.*\/tr/Uis','==REPLACEMENT==',$str);
?

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Need help adding dBase support to PHP

2007-10-12 Thread Jon Westcot
Hi Nathan:

The page you referenced in the PHP documentation is exactly what I saw that 
indicated that the dBase functions needed to be compiled in with the 
--enable-dbase directive.  What I need to know is HOW to do this, even in 
general terms.  GoDaddy is being very little help (no big surprise there).  
Their last message indicated updating values in the php.ini file would let this 
work, but, as you pointed out, this isn't an option with the php.ini.  I looked 
in the phpinfo data and couldn't find anything that matched dbase anywhere; 
certainly, no section in the output indicated any dBase settings whatsoever.

I'm fearing that I'm going to have to find some other way to handle the 
extraction of data from DBF files if I can't get this to work.

Thanks again for your help.

Jon



- Original Message - 
From: Nathan Nobbe 
To: Jon Westcot 
Cc: PHP General 
Sent: Thursday, October 11, 2007 6:06 PM
Subject: Re: [PHP] Need help adding dBase support to PHP


On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote:
  Hi again:

  Thanks for the info.  From what I can see, GoDaddy does NOT provide 
access to ssh.  Any other thoughts?  Or is there some way to tell me, in 
general terms, how to configure PHP to allow the dbase functions to be used? 


if  godaddy is recommending that you place values in a .htaccess file they 
probly mean you should upload a .htaccess
file via ftp.  im assuming thats how the give you access to the system (since 
there is no ssh access). 
im a bit unsure of the .htaccess setting, though i recently posted a small 
how-to on using .htaccess files to override
settings in php.ini; this is common in shared hosting environments.
http://gentoo-wiki.com/HOWTO_php.ini_overrides_w/_.htaccess

basically, to have dbase support, php must be compiled w/ --enable-dbase, per 
the documentation.
http://www.php.net/manual/en/rlef.dbase.php

perhaps, it is compiled in and the php.ini settings are preventing you from 
using the functions (though that sounds hard to believe).
you might try tossing a phpinfo script on the box and looking for dbase in the 
output; particularly look for --enable-dbase, or --disable-dbase. 
you should see a dbase section also, if its compiled in.  if it is there we can 
get a better idea of what sort of values could be placed in the
.htaccess file that would influence the behavior of the dbase component on that 
system. 

-nathan





Re: [PHP] Need help adding dBase support to PHP

2007-10-12 Thread Nathan Nobbe
On 10/12/07, Jon Westcot [EMAIL PROTECTED] wrote:

 Hi Nathan:

 The page you referenced in the PHP documentation is exactly what I saw
 that indicated that the dBase functions needed to be compiled in with the
 --enable-dbase directive.  What I need to know is HOW to do this, even in
 general terms.


basically you run about 3 commands.
configure
make
make install
and configure is the command you would pass --enable-dbase to.
windows systems typically have binary installs available; but i really have
never setup php on a windows box.

anyway, the reason i asked about the distribution to begin with is many
distributions handle php configuration / installation so its quite simple.
on gentoo you just add or remove a use flag and emerge it again if you want
to make a change.  on debian there are modules so i believe you can just
apt-get a new module if it isnt already installed.
seems nice, but ill tell you, on gentoo you spend time compiling; on debian
you spend time saying where is that package i want and how do i trick
apt-get to install it correctly.  but i digress... :)

GoDaddy is being very little help (no big surprise there).  Their last
 message indicated updating values in the php.ini file would let this work,
 but, as you pointed out, this isn't an option with the php.ini.  I looked
 in the phpinfo data and couldn't find anything that matched dbase
 anywhere; certainly, no section in the output indicated any dBase settings
 whatsoever.


if you havent done so i would just use the search feature of your browser
and type in dbase on that page.  you should see something in the configure
directive; either --enable-dbase or --disable-dbase most likely.

I'm fearing that I'm going to have to find some other way to handle the
 extraction of data from DBF files if I can't get this to work.


are you really committed to godaddy at this point ?

-nathan


Re: [PHP] Need help adding dBase support to PHP

2007-10-12 Thread Jon Westcot
Hi Nathan:

Thanks for the info.  Unfortunately, it's not my call which host to use.
I'm just being asked to help write some code, and I know that there are DBFs
in the process that need to be examined and brought into MySQL on a daily
basis, if not more often.

From what I've been told, the GoDaddy server is a shared server, which I
guess means that we, the underlings using it, can't really get in and make
whatever changes we'd like to make.

I did use the browser search to look for any occurence of dbase in the
phpinfo-returned data, but nothing showed up.

I appreciate the help you've given.  I'll just have to wait and see if
the person who owns the site is able to get anywhere with the GoDaddy tech
support.

Thanks again,

Jon

- Original Message -
From: Nathan Nobbe [EMAIL PROTECTED]
To: Jon Westcot [EMAIL PROTECTED]
Cc: PHP General php-general@lists.php.net
Sent: Friday, October 12, 2007 12:27 AM
Subject: Re: [PHP] Need help adding dBase support to PHP


 On 10/12/07, Jon Westcot [EMAIL PROTECTED] wrote:
 
  Hi Nathan:
 
  The page you referenced in the PHP documentation is exactly what I
saw
  that indicated that the dBase functions needed to be compiled in with
the
  --enable-dbase directive.  What I need to know is HOW to do this, even
in
  general terms.


 basically you run about 3 commands.
 configure
 make
 make install
 and configure is the command you would pass --enable-dbase to.
 windows systems typically have binary installs available; but i really
have
 never setup php on a windows box.

 anyway, the reason i asked about the distribution to begin with is many
 distributions handle php configuration / installation so its quite simple.
 on gentoo you just add or remove a use flag and emerge it again if you
want
 to make a change.  on debian there are modules so i believe you can just
 apt-get a new module if it isnt already installed.
 seems nice, but ill tell you, on gentoo you spend time compiling; on
debian
 you spend time saying where is that package i want and how do i trick
 apt-get to install it correctly.  but i digress... :)

 GoDaddy is being very little help (no big surprise there).  Their last
  message indicated updating values in the php.ini file would let this
work,
  but, as you pointed out, this isn't an option with the php.ini.  I
looked
  in the phpinfo data and couldn't find anything that matched dbase
  anywhere; certainly, no section in the output indicated any dBase
settings
  whatsoever.


 if you havent done so i would just use the search feature of your browser
 and type in dbase on that page.  you should see something in the configure
 directive; either --enable-dbase or --disable-dbase most likely.

 I'm fearing that I'm going to have to find some other way to handle
the
  extraction of data from DBF files if I can't get this to work.
 

 are you really committed to godaddy at this point ?

 -nathan


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



Re: [PHP] Need help adding dBase support to PHP

2007-10-11 Thread Nathan Nobbe
On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote:

 Hi all:

 I'm not versed at all with Linux, and I need some help in configuring
 PHP to allow me to use the dBase-related functions.  From what I read in the
 help files, it seems that I need to recompile PHP with the --enable-dbase
 command, but I don't know how to do this.

 Can someone out there help me out?  All help will be greatly
 appreciated!


what linux distribution are you using?

-nathan


Re: [PHP] Need help adding dBase support to PHP

2007-10-11 Thread Jon Westcot
Hi Nathan:

I have no idea.  Where would I look to find this out?  Will phpinfo() give 
me this?  And, if so, where would I find it?

Jon

- Original Message - 
From: Nathan Nobbe 
To: Jon Westcot 
Cc: PHP General 
Sent: Thursday, October 11, 2007 5:00 PM
Subject: Re: [PHP] Need help adding dBase support to PHP


On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote:
  Hi all:

  I'm not versed at all with Linux, and I need some help in configuring PHP 
to allow me to use the dBase-related functions.  From what I read in the help 
files, it seems that I need to recompile PHP with the --enable-dbase command, 
but I don't know how to do this. 

  Can someone out there help me out?  All help will be greatly appreciated!

what linux distribution are you using?

-nathan




Re: [PHP] Need help adding dBase support to PHP

2007-10-11 Thread Nathan Nobbe
On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote:

 Hi Nathan:

 I have no idea.  Where would I look to find this out?  Will phpinfo()
 give me this?  And, if so, where would I find it?


you might try

uname -a

from the command line; but theres no guarantee it will show the
distribution.  it will show the kernel, and sometime kernels
are named after the distro since they are often modified by the
distribution.

-nathan


Re: [PHP] Need help adding dBase support to PHP

2007-10-11 Thread Jon Westcot
Hi again, Nathan:

I'm not certain how to get to a command line.  The server is a shared 
server provided by GoDaddy, if that's any help.  They told me that I needed to 
change something in the .htaccess file, but that didn't sound right at all.

Thanks again for your help.

Jon

- Original Message - 
From: Nathan Nobbe 
To: Jon Westcot 
Cc: PHP General 
Sent: Thursday, October 11, 2007 5:08 PM
Subject: Re: [PHP] Need help adding dBase support to PHP


On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote:
  Hi Nathan:

  I have no idea.  Where would I look to find this out?  Will phpinfo() 
give me this?  And, if so, where would I find it?

you might try

uname -a

from the command line; but theres no guarantee it will show the distribution.  
it will show the kernel, and sometime kernels 
are named after the distro since they are often modified by the distribution.

-nathan





Re: [PHP] Need help adding dBase support to PHP

2007-10-11 Thread Nathan Nobbe
On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote:

 Hi again, Nathan:

 I'm not certain how to get to a command line.  The server is a shared
 server provided by GoDaddy, if that's any help.  They told me that I needed
 to change something in the .htaccess file, but that didn't sound right at
 all.



they may be right.  did they give you some sort of documentation you could
point us to?
also, to determine if you have command line access, look around and see if
they provide ssh
access to the machine.  if so i can tell you how to ssh in, even if you have
windows or mac.
that will give you a command line prompt on the remote machine.

-nathan


Re: [PHP] Need help adding dBase support to PHP

2007-10-11 Thread Jon Westcot
Hi again:

Thanks for the info.  From what I can see, GoDaddy does NOT provide access 
to ssh.  Any other thoughts?  Or is there some way to tell me, in general 
terms, how to configure PHP to allow the dbase functions to be used?

Jon

- Original Message - 
From: Nathan Nobbe 
To: Jon Westcot 
Cc: PHP General 
Sent: Thursday, October 11, 2007 5:34 PM
Subject: Re: [PHP] Need help adding dBase support to PHP


On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote:
  Hi again, Nathan:

  I'm not certain how to get to a command line.  The server is a shared 
server provided by GoDaddy, if that's any help.  They told me that I needed to 
change something in the .htaccess file, but that didn't sound right at all. 


they may be right.  did they give you some sort of documentation you could 
point us to?
also, to determine if you have command line access, look around and see if they 
provide ssh
access to the machine.  if so i can tell you how to ssh in, even if you have 
windows or mac. 
that will give you a command line prompt on the remote machine.

-nathan





Re: [PHP] Need help adding dBase support to PHP

2007-10-11 Thread Nathan Nobbe
On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote:

 Hi again:

 Thanks for the info.  From what I can see, GoDaddy does NOT provide
 access to ssh.  Any other thoughts?  Or is there some way to tell me, in
 general terms, how to configure PHP to allow the dbase functions to be used?



if  godaddy is recommending that you place values in a .htaccess file they
probly mean you should upload a .htaccess
file via ftp.  im assuming thats how the give you access to the system
(since there is no ssh access).
im a bit unsure of the .htaccess setting, though i recently posted a small
how-to on using .htaccess files to override
settings in php.ini; this is common in shared hosting environments.
http://gentoo-wiki.com/HOWTO_php.ini_overrides_w/_.htaccess

basically, to have dbase support, php must be compiled w/ --enable-dbase,
per the documentation.
http://www.php.net/manual/en/rlef.dbase.php

perhaps, it is compiled in and the php.ini settings are preventing you from
using the functions (though that sounds hard to believe).
you might try tossing a phpinfo script on the box and looking for dbase in
the output; particularly look for --enable-dbase, or --disable-dbase.
you should see a dbase section also, if its compiled in.  if it is there we
can get a better idea of what sort of values could be placed in the
.htaccess file that would influence the behavior of the dbase component on
that system.

-nathan


Re: [PHP] Need help adding dBase support to PHP

2007-10-11 Thread Nathan Nobbe
On 10/11/07, Nathan Nobbe [EMAIL PROTECTED] wrote:

 On 10/11/07, Jon Westcot [EMAIL PROTECTED] wrote:
 
  Hi again:
 
  Thanks for the info.  From what I can see, GoDaddy does NOT provide
  access to ssh.  Any other thoughts?  Or is there some way to tell me, in
  general terms, how to configure PHP to allow the dbase functions to be used?
 



 if  godaddy is recommending that you place values in a .htaccess file they
 probly mean you should upload a .htaccess
 file via ftp.  im assuming thats how the give you access to the system
 (since there is no ssh access).
 im a bit unsure of the .htaccess setting, though i recently posted a small
 how-to on using .htaccess files to override
 settings in php.ini; this is common in shared hosting environments.
 http://gentoo-wiki.com/HOWTO_php.ini_overrides_w/_.htaccess

 basically, to have dbase support, php must be compiled w/ --enable-dbase,
 per the documentation.
 http://www.php.net/manual/en/rlef.dbase.php

 perhaps, it is compiled in and the php.ini settings are preventing you
 from using the functions (though that sounds hard to believe).
 you might try tossing a phpinfo script on the box and looking for dbase in
 the output; particularly look for --enable-dbase, or --disable-dbase.
 you should see a dbase section also, if its compiled in.  if it is there
 we can get a better idea of what sort of values could be placed in the
 .htaccess file that would influence the behavior of the dbase component on
 that system.

 -nathan



oh,
i just spent and extra second and discovered:
(from documentation :)

This extension has no configuration directives defined in php.ini.

if dbase does not appear to be installed on the system when you look at
phpifno output i would draft an email to them expressing that it
doesnt appear to be compiled in and ask them if they can add it.

-nathan


Re: [PHP] need help,pls

2007-07-26 Thread Alan Milnes

On 26/07/07, esimaje juan toritseju [EMAIL PROTECTED] wrote:

hi,
  My name is Juan, i need help from you and i will be greatful if you could 
assist me,i have
got an academic project to create a website .Within the page i should create a login 
session  for users ,i will have a database to save designs, i do know how to 
create the database but,  do not know how to create the loggin sessions for users 
and also use flash in


Have a look here for some ideas:-

http://www.intranetjournal.com/php-cms/

Alan

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



Re: [PHP] need help

2007-07-02 Thread Davide Bernard
I've found http://php.net/ to be very helpful. Especially in
troubleshooting.

 Muhammad Hassan Samee [EMAIL PROTECTED] 7/2/2007 8:38 AM

hay
i m a C++ programmer and new to web development with basic knowledge
of
HTML, CSS and j.script now i want to start learning PHP anybody can
direct
me to some good/fast track tutorials \ books  for getting start

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



Re: [PHP] need help

2007-07-02 Thread Mohamed Yusuf

checkout this site http://www.w3schools.com/php/default.asp

On 7/2/07, Davide Bernard [EMAIL PROTECTED] wrote:


I've found http://php.net/ to be very helpful. Especially in
troubleshooting.

 Muhammad Hassan Samee [EMAIL PROTECTED] 7/2/2007 8:38 AM

hay
i m a C++ programmer and new to web development with basic knowledge
of
HTML, CSS and j.script now i want to start learning PHP anybody can
direct
me to some good/fast track tutorials \ books  for getting start

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




Re: [PHP] need help

2007-07-02 Thread Sancar Saran
On Monday 02 July 2007 16:38:10 Muhammad Hassan Samee wrote:
 hay
 i m a C++ programmer and new to web development with basic knowledge of
 HTML, CSS and j.script now i want to start learning PHP anybody can direct
 me to some good/fast track tutorials \ books  for getting start

Hi,

good/fast track tutorials \ books are isn't. Because you haven't got any HTML, 
CSS and Js background. Php was very easy to use (even I can use it) and in 
this situation handling php was minor problem (because of your programming 
background) 

And dealing HTML CSS and JS issues requires knowladge(lots of). Because you 
are going to mix up 3 different language (wich all of them having serious 
problems with different OS,Browsers,Versions etc) with using php glue.

Also having good html design capability is beyond the language knowladge.

www.webmonkey.com, www.sitepoint.com, www.phpbuilder.net are good point to 
start.

Also 

Beatiful web design one of the best webs site design books also this kind of 
books wery hard to find (because most of them try to teach you html tag by 
tag).

You may look some other photoshop books for generating images. 

And of course practice makes perfect

Regards

Sancar

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



RE: [PHP] Need help with RegEx

2006-12-15 Thread Richard Lynch

preg_match_all('|status([^]*)/status|msU', $xml, $matches);
var_dump($matches);

YMMV

Download and play with The Regex Coach

On Mon, December 11, 2006 9:29 am, Brad Fuller wrote:

 The example provided didn't work for me.  It gave me the same string
 without
 anything modified.

 I am also looking for this solution to strip out text from some XML
 response
 I get from posting data to a remote server.  I can do it using
 substring
 functions but I'd like something more compact and portable. (A
 one-liner
 that I could modify for other uses as well)

 Example 1:
 someXMLtags
   status16664 Rejected: Invalid LTV/status
 /someXMLtags

 Example 2:
 someXMLtags
   statusUnable to Post, Invalid Information/status
 /someXMLtags

 I want what is inside the status tags.

 Does anyone have a working solution how we can get the text from
 inside
 these tags using regex?

 Much appreciated,

 B

 -Original Message-
 From: Michael [mailto:[EMAIL PROTECTED]
 Sent: Monday, December 11, 2006 6:59 AM
 To: Anthony Papillion
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Need help with RegEx

 At 01:02 AM 12/11/2006 , Anthony Papillion wrote:
 Hello Everyone,
 
 I am having a bit of problems wrapping my head around regular
 expressions. I
 thought I had a good grip on them but, for some reason, the
 expression
 I've
 created below simply doesn't work! Basically, I need to retreive
 all of
 the
 text between two unique and specific tags but I don't need the tag
 text.
 So
 let's say that the tag is
 
 tag lang='ttt'THIS IS A TEST/tag
 
 I would need to retreive THIS IS A TEST only and nothing else.
 
 Now, a bit more information: I am using cURL to retreive the entire
 contents
 of a webpage into a variable. I am then trying to perform the
 following
 regular expression on the retreived text:
 
 $trans_text = preg_match(\/div id=result_box
 dir=ltr(.+?)\/div/);

 Using the tags you describe here, and assuming the source html is in
 the
 variable $source_html, try this:

 $trans_text = preg_replace(/(.*?)(div id=result_box
 dir=ltr)(.*?)(\/div)(.*?)^/s,$3,$source_html);

 how this breaks down is:

 opening quote for first parameter (your MATCH pattern).

 open regex match pattern= /

 first atom (.*?) = any or no leading text before div id=result_box
 dir=ltr,
 the ? makes it non-greedy so that it stops after finding the first
 match.

 second atom (div id=result_box dir=ltr) = the opening tag you are
 looking for.

 third atom (.*?) = the text you want to strip out, all text even if
 nothing is
 there, between the 2nd and
 4th atoms.

 fourth atom (\/div) = the closing tag of the div tag pair.

 fifth atom (.*?) = all of the rest of the source html after the
 closing
 tag up
 to the end of the line ^,even if there is nothing there.

 close regex match pattern= /s

 in order for this to work on html that may contain newlines, you
 must
 specify
 that the . can represent newline characters, this is done by adding
 the
 letter
 's' after your regex closing /, so the last thing in your regex
 match
 pattern
 would be /s.

 end of string ^ (this matches the end of the string you are
 matching/replacing
 , $source_html)

 closing quote for first parameter.

 The second parameter of the preg_replace is the atom # which
 contains the
 text
 you want to replace the text matched by the regex match pattern in
 the
 first
 parameter, in this case the text we want is in the third atom so
 this
 parameter
 would be $3 (this is the PHP way of back-referencing, if we wanted
 the
 text
 before the tag we would use atom 1, or $1, if we want the tag itself
 we
 use $2,
 etc basically a $ followed by the atom # that holds what we want to
 replace the
 $source_html into $trans_text).

 The third parameter of the preg_replace is the source you wish to
 match
 and
 replace from, in this case your source html in $source_html.

 after this executes, $trans_text should contain the innerText of the
 div
 id=result_box dir=ltr/div tag pair from $source_html, if there is
 nothing
 between the opening and closing tags, $trans_text will == , if
 there is
 only
 a newline between the tags, $trans_text will == \n. IMPORTANT: if
 the
 text
 between the tags contains a newline, $trans_text will also contain
 that
 newline
 character because we told . to match newlines.

 I am no regex expert by far, but this worked for me (assuming I
 copied it
 correctly here heh)
 There are doubtless many other ways to do this, and I am sure others
 on
 the
 list here will correct me if my way is wrong or inefficient.

 I hope this works for you and that I haven't horribly embarassed
 myself
 here.
 Good luck :)

 
 The problem is that when I echo the value of $trans_text variable,
 I end
 up
 with the entire HTML of the page.
 
 Can anyone clue me in to what I am doing wrong?
 
 Thanks,
 Anthony
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

 --
 PHP General Mailing List (http

RE: [PHP] Need help with RegEx

2006-12-12 Thread Ford, Mike
On 11 December 2006 19:43, Michael wrote:

 At 08:29 AM 12/11/2006 , Brad Fuller wrote:
  
  The example provided didn't work for me.  It gave me the same
  string without anything modified.
 
 You are absolutely correct, this is what I get for not
 testing it explicitly :( My most sincere apologies to the OP
 and the list, there is an error in my example (see below for
 correction) 
 
  I have cut and pasted from further down in the quoted
 message, for convenience 
   Using the tags you describe here, and assuming the source html is
   in the variable $source_html, try this:
   
   $trans_text = preg_replace(/(.*?)(div id=result_box
   dir=ltr)(.*?)(\/div)(.*?)^/s,$3,$source_html);
 
 The End of string symbol ^ should not be included.

That's because ^ is not the end-of-string symbol -- it's the START-of-string 
symbol.  $ is the END-of string symbol.  But the OP doesn't need either of 
these symbols as he's not trying to match at the start or end of the string, 
and nor does he need your suggested leading and trailing (.*?) for the same 
reason.  Unless anchored with ^ and/or $, preg is perfectly happy to match in 
the middle of the subject string.

@Anthony: your pattern is fine -- it's what you're doing with it that's wrong.

On 11 December 2006 08:03, Anthony Papillion wrote:

 $trans_text = preg_match(\/div id=result_box
 dir=ltr(.+?)\/div/);
 
 The problem is that when I echo the value of $trans_text variable, I
 end up with the entire HTML of the page.

I don't see how this is possible, since preg_match returns an integer telling 
you how many times the pattern matched -- which will be 0 or 1, since 
preg_match doesn't do multiple matches!  You also clearly haven't given us your 
actual call, since you've only included the pattern and not the subject string.

What you're after is the third argument to preg_match, which returns an array 
of matched text; so for:

preg_match(/div id=result_box dir=ltr(.+?)\\/div/, $orig, $matches);

$matches[0]  will return the entire match (everything from div  to /div
$matches[1]  will return the first parenthesized expression, which is what 
you're looking for.

Note also the doubled backslash, since you need to pass a single backslash 
through to escape the / for preg_match.  As an alternative, I would strongly 
advise using a different delimiter, so that no escaping is needed; for instance:

preg_match(#div id=result_box dir=ltr(.+?)/div#, $orig, $matches);

Cheers!

Mike

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


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP] Need help with RegEx

2006-12-12 Thread Michael
At 04:56 AM 12/12/2006 , Ford, Mike wrote:
On 11 December 2006 19:43, Michael wrote:

 At 08:29 AM 12/11/2006 , Brad Fuller wrote:
  
  The example provided didn't work for me.  It gave me the same
  string without anything modified.
 
 You are absolutely correct, this is what I get for not
 testing it explicitly :( My most sincere apologies to the OP
 and the list, there is an error in my example (see below for
 correction) 
 
  I have cut and pasted from further down in the quoted
 message, for convenience 
   Using the tags you describe here, and assuming the source html is
   in the variable $source_html, try this:
   
   $trans_text = preg_replace(/(.*?)(div id=result_box
   dir=ltr)(.*?)(\/div)(.*?)^/s,$3,$source_html);
 
 The End of string symbol ^ should not be included.

That's because ^ is not the end-of-string symbol -- it's the START-of-string 
symbol.  $ is the END-of string symbol.  But the OP doesn't need either of 
these symbols as he's not trying to match at the start or end of the string, 
and nor does he need your suggested leading and trailing (.*?) for the same 
reason.  Unless anchored with ^ and/or $, preg is perfectly happy to match in 
the middle of the subject string.

Well, DOH, leave it to me to bugger something up like that heh, got the $ and ^ 
reversed. Thanks for correcting me :) 



@Anthony: your pattern is fine -- it's what you're doing with it that's wrong.

On 11 December 2006 08:03, Anthony Papillion wrote:

 $trans_text = preg_match(\/div id=result_box
 dir=ltr(.+?)\/div/);
 
 The problem is that when I echo the value of $trans_text variable, I
 end up with the entire HTML of the page.

I don't see how this is possible, since preg_match returns an integer telling 
you how many times the pattern matched -- which will be 0 or 1, since 
preg_match doesn't do multiple matches!  You also clearly haven't given us 
your actual call, since you've only included the pattern and not the subject 
string.

What you're after is the third argument to preg_match, which returns an array 
of matched text; so for:

preg_match(/div id=result_box dir=ltr(.+?)\\/div/, $orig, $matches);

$matches[0]  will return the entire match (everything from div  to /div
$matches[1]  will return the first parenthesized expression, which is what 
you're looking for.

Note also the doubled backslash, since you need to pass a single backslash 
through to escape the / for preg_match.  As an alternative, I would strongly 
advise using a different delimiter, so that no escaping is needed; for 
instance:

preg_match(#div id=result_box dir=ltr(.+?)/div#, $orig, $matches);

Cheers!

Mike

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


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

-- 
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] Need help with RegEx

2006-12-11 Thread Børge Holen
explode it

I'm having quite the difficulty to comprehend the regexp myself, but as a 
training, go ahead.

On Monday 11 December 2006 09:02, Anthony Papillion wrote:
 Hello Everyone,

 I am having a bit of problems wrapping my head around regular expressions.
 I thought I had a good grip on them but, for some reason, the expression
 I've created below simply doesn't work! Basically, I need to retreive all
 of the text between two unique and specific tags but I don't need the tag
 text. So let's say that the tag is

 tag lang='ttt'THIS IS A TEST/tag

 I would need to retreive THIS IS A TEST only and nothing else.

 Now, a bit more information: I am using cURL to retreive the entire
 contents of a webpage into a variable. I am then trying to perform the
 following regular expression on the retreived text:

 $trans_text = preg_match(\/div id=result_box dir=ltr(.+?)\/div/);

 The problem is that when I echo the value of $trans_text variable, I end up
 with the entire HTML of the page.

 Can anyone clue me in to what I am doing wrong?

 Thanks,
 Anthony

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

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



Re: [PHP] Need help with RegEx

2006-12-11 Thread T . Lensselink
I'm no regex guru but something goes wrong here.

First of you miss the second parameter in preg_match

int preg_match ( string pattern, string subject [, array matches [, int flags 
[, int offset]]] )

If you need the text from two unique tags it should not be to hard:

$test = tag lang='ttt'THIS IS A TEST/tag;
preg_match(/tag lang='ttt'(.+?)\/tag/, $test, $matches);
print_r($matches);

Thijs

On Mon, 11 Dec 2006 02:02:46 -0600, Anthony Papillion [EMAIL PROTECTED] 
wrote:
 Hello Everyone,
 
 I am having a bit of problems wrapping my head around regular expressions.
 I
 thought I had a good grip on them but, for some reason, the expression
 I've
 created below simply doesn't work! Basically, I need to retreive all of
 the
 text between two unique and specific tags but I don't need the tag text.
 So
 let's say that the tag is
 
 tag lang='ttt'THIS IS A TEST/tag
 
 I would need to retreive THIS IS A TEST only and nothing else.
 
 Now, a bit more information: I am using cURL to retreive the entire
 contents
 of a webpage into a variable. I am then trying to perform the following
 regular expression on the retreived text:
 
 $trans_text = preg_match(\/div id=result_box dir=ltr(.+?)\/div/);
 
 The problem is that when I echo the value of $trans_text variable, I end
 up
 with the entire HTML of the page.
 
 Can anyone clue me in to what I am doing wrong?
 
 Thanks,
 Anthony
 
 --
 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] Need help with RegEx

2006-12-11 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2006-12-11 02:02:46 -0600:
 I am having a bit of problems wrapping my head around regular expressions. I 
 thought I had a good grip on them but, for some reason, the expression I've 
 created below simply doesn't work! Basically, I need to retreive all of the 
 text between two unique and specific tags but I don't need the tag text. So 
 let's say that the tag is
 
 tag lang='ttt'THIS IS A TEST/tag
 
 I would need to retreive THIS IS A TEST only and nothing else.
 
 Now, a bit more information: I am using cURL to retreive the entire contents 
 of a webpage into a variable. I am then trying to perform the following 
 regular expression on the retreived text:
 
 $trans_text = preg_match(\/div id=result_box dir=ltr(.+?)\/div/);
 
 The problem is that when I echo the value of $trans_text variable, I end up 
 with the entire HTML of the page.

This is hardly the code you're actually using[1], can you please
provide a piece of real code?

[1] int preg_match ( string pattern, string subject [, array matches [, 
int flags [, int offset]]] )

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Need help with RegEx

2006-12-11 Thread Michael
At 01:02 AM 12/11/2006 , Anthony Papillion wrote:
Hello Everyone,

I am having a bit of problems wrapping my head around regular expressions. I 
thought I had a good grip on them but, for some reason, the expression I've 
created below simply doesn't work! Basically, I need to retreive all of the 
text between two unique and specific tags but I don't need the tag text. So 
let's say that the tag is

tag lang='ttt'THIS IS A TEST/tag

I would need to retreive THIS IS A TEST only and nothing else.

Now, a bit more information: I am using cURL to retreive the entire contents 
of a webpage into a variable. I am then trying to perform the following 
regular expression on the retreived text:

$trans_text = preg_match(\/div id=result_box dir=ltr(.+?)\/div/);

Using the tags you describe here, and assuming the source html is in the
variable $source_html, try this:

$trans_text = preg_replace(/(.*?)(div id=result_box
dir=ltr)(.*?)(\/div)(.*?)^/s,$3,$source_html);

how this breaks down is:
 
opening quote for first parameter (your MATCH pattern).

open regex match pattern= /

first atom (.*?) = any or no leading text before div id=result_box dir=ltr,
the ? makes it non-greedy so that it stops after finding the first match.

second atom (div id=result_box dir=ltr) = the opening tag you are looking for.

third atom (.*?) = the text you want to strip out, all text even if nothing is
there, between the 2nd and
4th atoms.

fourth atom (\/div) = the closing tag of the div tag pair.

fifth atom (.*?) = all of the rest of the source html after the closing tag up
to the end of the line ^,even if there is nothing there.

close regex match pattern= /s

in order for this to work on html that may contain newlines, you must specify
that the . can represent newline characters, this is done by adding the letter
's' after your regex closing /, so the last thing in your regex match pattern
would be /s.

end of string ^ (this matches the end of the string you are matching/replacing
, $source_html)

closing quote for first parameter.

The second parameter of the preg_replace is the atom # which contains the text
you want to replace the text matched by the regex match pattern in the first
parameter, in this case the text we want is in the third atom so this parameter
would be $3 (this is the PHP way of back-referencing, if we wanted the text
before the tag we would use atom 1, or $1, if we want the tag itself we use $2,
etc basically a $ followed by the atom # that holds what we want to replace the
$source_html into $trans_text).

The third parameter of the preg_replace is the source you wish to match and
replace from, in this case your source html in $source_html.

after this executes, $trans_text should contain the innerText of the div
id=result_box dir=ltr/div tag pair from $source_html, if there is nothing
between the opening and closing tags, $trans_text will == , if there is only
a newline between the tags, $trans_text will == \n. IMPORTANT: if the text
between the tags contains a newline, $trans_text will also contain that newline
character because we told . to match newlines.

I am no regex expert by far, but this worked for me (assuming I copied it
correctly here heh)
There are doubtless many other ways to do this, and I am sure others on the
list here will correct me if my way is wrong or inefficient.

I hope this works for you and that I haven't horribly embarassed myself here.
Good luck :)


The problem is that when I echo the value of $trans_text variable, I end up 
with the entire HTML of the page.

Can anyone clue me in to what I am doing wrong?

Thanks,
Anthony 

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

Re: [PHP] Need help with RegEx

2006-12-11 Thread Michael
I just realized I neglected to explain a couple of things here, sorry...

My method will only work for the FIRST occurrence of the div tag pair in 
$source_html.

The reason this method works is that you are telling preg_replace to replace 
everything that matches the match pattern, with just what is contained in the 
third atom of the match pattern. Since we are matching everything between the 
start of $source_html and the end of $source_html (the (.*?) atom at the 
beginning, and the (.*?)^ atom at the end) your return value ends up being $3, 
or the contents of the third atom of the match pattern, which represents the 
text between the opening tag and closing tag of your div element.

hope this makes sense, I'm writing this at 5am heh

Cheers,
Michael

At 04:58 AM 12/11/2006 , Michael wrote:
At 01:02 AM 12/11/2006 , Anthony Papillion wrote:
Hello Everyone,

I am having a bit of problems wrapping my head around regular expressions. I 
thought I had a good grip on them but, for some reason, the expression I've 
created below simply doesn't work! Basically, I need to retreive all of the 
text between two unique and specific tags but I don't need the tag text. So 
let's say that the tag is

tag lang='ttt'THIS IS A TEST/tag

I would need to retreive THIS IS A TEST only and nothing else.

Now, a bit more information: I am using cURL to retreive the entire contents 
of a webpage into a variable. I am then trying to perform the following 
regular expression on the retreived text:

$trans_text = preg_match(\/div id=result_box dir=ltr(.+?)\/div/);

Using the tags you describe here, and assuming the source html is in the
variable $source_html, try this:

$trans_text = preg_replace(/(.*?)(div id=result_box
dir=ltr)(.*?)(\/div)(.*?)^/s,$3,$source_html);

how this breaks down is:
 
opening quote for first parameter (your MATCH pattern).

open regex match pattern= /

first atom (.*?) = any or no leading text before div id=result_box dir=ltr,
the ? makes it non-greedy so that it stops after finding the first match.

second atom (div id=result_box dir=ltr) = the opening tag you are looking 
for.

third atom (.*?) = the text you want to strip out, all text even if nothing is
there, between the 2nd and
4th atoms.

fourth atom (\/div) = the closing tag of the div tag pair.

fifth atom (.*?) = all of the rest of the source html after the closing tag up
to the end of the line ^,even if there is nothing there.

close regex match pattern= /s

in order for this to work on html that may contain newlines, you must specify
that the . can represent newline characters, this is done by adding the letter
's' after your regex closing /, so the last thing in your regex match pattern
would be /s.

end of string ^ (this matches the end of the string you are matching/replacing
, $source_html)

closing quote for first parameter.

The second parameter of the preg_replace is the atom # which contains the text
you want to replace the text matched by the regex match pattern in the first
parameter, in this case the text we want is in the third atom so this parameter
would be $3 (this is the PHP way of back-referencing, if we wanted the text
before the tag we would use atom 1, or $1, if we want the tag itself we use $2,
etc basically a $ followed by the atom # that holds what we want to replace the
$source_html into $trans_text).

The third parameter of the preg_replace is the source you wish to match and
replace from, in this case your source html in $source_html.

after this executes, $trans_text should contain the innerText of the div
id=result_box dir=ltr/div tag pair from $source_html, if there is nothing
between the opening and closing tags, $trans_text will == , if there is only
a newline between the tags, $trans_text will == \n. IMPORTANT: if the text
between the tags contains a newline, $trans_text will also contain that newline
character because we told . to match newlines.

I am no regex expert by far, but this worked for me (assuming I copied it
correctly here heh)
There are doubtless many other ways to do this, and I am sure others on the
list here will correct me if my way is wrong or inefficient.

I hope this works for you and that I haven't horribly embarassed myself here.
Good luck :)


The problem is that when I echo the value of $trans_text variable, I end up 
with the entire HTML of the page.

Can anyone clue me in to what I am doing wrong?

Thanks,
Anthony 

-- 
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] Need help with RegEx

2006-12-11 Thread Brad Fuller

The example provided didn't work for me.  It gave me the same string without
anything modified.

I am also looking for this solution to strip out text from some XML response
I get from posting data to a remote server.  I can do it using substring
functions but I'd like something more compact and portable. (A one-liner
that I could modify for other uses as well)

Example 1:
someXMLtags
status16664 Rejected: Invalid LTV/status
/someXMLtags

Example 2:
someXMLtags
statusUnable to Post, Invalid Information/status
/someXMLtags

I want what is inside the status tags.

Does anyone have a working solution how we can get the text from inside
these tags using regex?

Much appreciated,

B

 -Original Message-
 From: Michael [mailto:[EMAIL PROTECTED]
 Sent: Monday, December 11, 2006 6:59 AM
 To: Anthony Papillion
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Need help with RegEx
 
 At 01:02 AM 12/11/2006 , Anthony Papillion wrote:
 Hello Everyone,
 
 I am having a bit of problems wrapping my head around regular
 expressions. I
 thought I had a good grip on them but, for some reason, the expression
 I've
 created below simply doesn't work! Basically, I need to retreive all of
 the
 text between two unique and specific tags but I don't need the tag text.
 So
 let's say that the tag is
 
 tag lang='ttt'THIS IS A TEST/tag
 
 I would need to retreive THIS IS A TEST only and nothing else.
 
 Now, a bit more information: I am using cURL to retreive the entire
 contents
 of a webpage into a variable. I am then trying to perform the following
 regular expression on the retreived text:
 
 $trans_text = preg_match(\/div id=result_box dir=ltr(.+?)\/div/);
 
 Using the tags you describe here, and assuming the source html is in the
 variable $source_html, try this:
 
 $trans_text = preg_replace(/(.*?)(div id=result_box
 dir=ltr)(.*?)(\/div)(.*?)^/s,$3,$source_html);
 
 how this breaks down is:
 
 opening quote for first parameter (your MATCH pattern).
 
 open regex match pattern= /
 
 first atom (.*?) = any or no leading text before div id=result_box
 dir=ltr,
 the ? makes it non-greedy so that it stops after finding the first match.
 
 second atom (div id=result_box dir=ltr) = the opening tag you are
 looking for.
 
 third atom (.*?) = the text you want to strip out, all text even if
 nothing is
 there, between the 2nd and
 4th atoms.
 
 fourth atom (\/div) = the closing tag of the div tag pair.
 
 fifth atom (.*?) = all of the rest of the source html after the closing
 tag up
 to the end of the line ^,even if there is nothing there.
 
 close regex match pattern= /s
 
 in order for this to work on html that may contain newlines, you must
 specify
 that the . can represent newline characters, this is done by adding the
 letter
 's' after your regex closing /, so the last thing in your regex match
 pattern
 would be /s.
 
 end of string ^ (this matches the end of the string you are
 matching/replacing
 , $source_html)
 
 closing quote for first parameter.
 
 The second parameter of the preg_replace is the atom # which contains the
 text
 you want to replace the text matched by the regex match pattern in the
 first
 parameter, in this case the text we want is in the third atom so this
 parameter
 would be $3 (this is the PHP way of back-referencing, if we wanted the
 text
 before the tag we would use atom 1, or $1, if we want the tag itself we
 use $2,
 etc basically a $ followed by the atom # that holds what we want to
 replace the
 $source_html into $trans_text).
 
 The third parameter of the preg_replace is the source you wish to match
 and
 replace from, in this case your source html in $source_html.
 
 after this executes, $trans_text should contain the innerText of the div
 id=result_box dir=ltr/div tag pair from $source_html, if there is
 nothing
 between the opening and closing tags, $trans_text will == , if there is
 only
 a newline between the tags, $trans_text will == \n. IMPORTANT: if the
 text
 between the tags contains a newline, $trans_text will also contain that
 newline
 character because we told . to match newlines.
 
 I am no regex expert by far, but this worked for me (assuming I copied it
 correctly here heh)
 There are doubtless many other ways to do this, and I am sure others on
 the
 list here will correct me if my way is wrong or inefficient.
 
 I hope this works for you and that I haven't horribly embarassed myself
 here.
 Good luck :)
 
 
 The problem is that when I echo the value of $trans_text variable, I end
 up
 with the entire HTML of the page.
 
 Can anyone clue me in to what I am doing wrong?
 
 Thanks,
 Anthony
 
 --
 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] Need help with RegEx

2006-12-11 Thread tg-php
If you didn't say using regex this is how I'd do it  (untested, forgive typos 
and such..ripped from some code I actively use and stripped down):

?PHP

  $_XML_RESPONSE_PARSER = xml_parser_create();
  xml_set_element_handler($_XML_RESPONSE_PARSER, 
'xml_response_open_element_function', 'xml_response_close_element_function');
  xml_set_character_data_handler($_XML_RESPONSE_PARSER, 
'xml_response_handle_character_data');
  xml_parse($_XML_RESPONSE_PARSER, $_XML_RESPONSE, strlen($_XML_RESPONSE));
  xml_parser_free($_XML_RESPONSE_PARSER);
~
  $FoundStatusTag = false;
~
  function xml_response_open_element_function($p, $element, $attributes) {
global $FoundStatusTag;
~~
if (strtoupper($element) == STATUS) $FoundStatusTag = true;
  }
~
  function xml_response_close_element_function($p, $element){
global $FoundStatusTag;
~  
// do nothing special for now
  }
~
  function xml_response_handle_character_data($p, $cdata){ 
global $FoundStatusTag;
~  
if ($FoundStatusTag) {
  echo $cdata;
  $FoundStatusTag = false;
}
  }

?

= = = Original message = = =

The example provided didn't work for me.  It gave me the same string without
anything modified.

I am also looking for this solution to strip out text from some XML response
I get from posting data to a remote server.  I can do it using substring
functions but I'd like something more compact and portable. (A one-liner
that I could modify for other uses as well)

Example 1:
someXMLtags
~status16664 Rejected: Invalid LTV/status
/someXMLtags

Example 2:
someXMLtags
~statusUnable to Post, Invalid Information/status
/someXMLtags

I want what is inside the status tags.

Does anyone have a working solution how we can get the text from inside
these tags using regex?

Much appreciated,

B


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



RE: [PHP] Need help with RegEx

2006-12-11 Thread Brad Fuller

I got it.

?php
$input = xmlJunkstatusHello, World!/status/xmlJunk;

preg_match(#status(.*?)/status#s, $input, $matches);
echo $matches[1];
?


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Monday, December 11, 2006 10:59 AM
 To: php-general@lists.php.net
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP] Need help with RegEx
 
 If you didn't say using regex this is how I'd do it  (untested, forgive
 typos and such..ripped from some code I actively use and stripped down):
 
 ?PHP
 
   $_XML_RESPONSE_PARSER = xml_parser_create();
   xml_set_element_handler($_XML_RESPONSE_PARSER,
 'xml_response_open_element_function',
 'xml_response_close_element_function');
   xml_set_character_data_handler($_XML_RESPONSE_PARSER,
 'xml_response_handle_character_data');
   xml_parse($_XML_RESPONSE_PARSER, $_XML_RESPONSE,
 strlen($_XML_RESPONSE));
   xml_parser_free($_XML_RESPONSE_PARSER);
 ~
   $FoundStatusTag = false;
 ~
   function xml_response_open_element_function($p, $element, $attributes) {
 global $FoundStatusTag;
 ~~
 if (strtoupper($element) == STATUS) $FoundStatusTag = true;
   }
 ~
   function xml_response_close_element_function($p, $element){
 global $FoundStatusTag;
 ~
 // do nothing special for now
   }
 ~
   function xml_response_handle_character_data($p, $cdata){
 global $FoundStatusTag;
 ~
 if ($FoundStatusTag) {
   echo $cdata;
   $FoundStatusTag = false;
 }
   }
 
 ?
 
 = = = Original message = = =
 
 The example provided didn't work for me.  It gave me the same string
 without
 anything modified.
 
 I am also looking for this solution to strip out text from some XML
 response
 I get from posting data to a remote server.  I can do it using substring
 functions but I'd like something more compact and portable. (A one-liner
 that I could modify for other uses as well)
 
 Example 1:
 someXMLtags
 ~status16664 Rejected: Invalid LTV/status
 /someXMLtags
 
 Example 2:
 someXMLtags
 ~statusUnable to Post, Invalid Information/status
 /someXMLtags
 
 I want what is inside the status tags.
 
 Does anyone have a working solution how we can get the text from inside
 these tags using regex?
 
 Much appreciated,
 
 B
 
 
 ___
 Sent by ePrompter, the premier email notification software.
 Free download at http://www.ePrompter.com.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



RE: [PHP] Need help with RegEx

2006-12-11 Thread Michael


At 08:29 AM 12/11/2006 , Brad Fuller wrote:

The example provided didn't work for me.  It gave me the same string without
anything modified.

You are absolutely correct, this is what I get for not testing it explicitly :( 
My most sincere apologies to the OP and the list, there is an error in my 
example (see below for correction)

 I have cut and pasted from further down in the quoted message, for 
convenience 
 Using the tags you describe here, and assuming the source html is in the
 variable $source_html, try this:
 
 $trans_text = preg_replace(/(.*?)(div id=result_box
 dir=ltr)(.*?)(\/div)(.*?)^/s,$3,$source_html);

The End of string symbol ^ should not be included. I tested the above function 
without the ^ and it worked for me. below is the TESTED version:

$trans_text = preg_replace(/(.*?)(div id=result_box 
dir=ltr)(.*?)(\/div)(.*?)/s,$3,$source_html);
* end of pasted section *



I am also looking for this solution to strip out text from some XML response
I get from posting data to a remote server.  I can do it using substring
functions but I'd like something more compact and portable. (A one-liner
that I could modify for other uses as well)

Example 1:
someXMLtags
   status16664 Rejected: Invalid LTV/status
/someXMLtags

Example 2:
someXMLtags
   statusUnable to Post, Invalid Information/status
/someXMLtags

I want what is inside the status tags.

Does anyone have a working solution how we can get the text from inside
these tags using regex?

Much appreciated,

B

 -Original Message-
 From: Michael [mailto:[EMAIL PROTECTED]
 Sent: Monday, December 11, 2006 6:59 AM
 To: Anthony Papillion
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Need help with RegEx
 
 At 01:02 AM 12/11/2006 , Anthony Papillion wrote:
 Hello Everyone,
 
 I am having a bit of problems wrapping my head around regular
 expressions. I
 thought I had a good grip on them but, for some reason, the expression
 I've
 created below simply doesn't work! Basically, I need to retreive all of
 the
 text between two unique and specific tags but I don't need the tag text.
 So
 let's say that the tag is
 
 tag lang='ttt'THIS IS A TEST/tag
 
 I would need to retreive THIS IS A TEST only and nothing else.
 
 Now, a bit more information: I am using cURL to retreive the entire
 contents
 of a webpage into a variable. I am then trying to perform the following
 regular expression on the retreived text:
 
 $trans_text = preg_match(\/div id=result_box dir=ltr(.+?)\/div/);
 
 Using the tags you describe here, and assuming the source html is in the
 variable $source_html, try this:
 
 $trans_text = preg_replace(/(.*?)(div id=result_box
 dir=ltr)(.*?)(\/div)(.*?)^/s,$3,$source_html);

The End of string symbol ^ should not be included. I tested the above function 
without the ^ and it worked for me. below is the TESTED version:

$trans_text = preg_replace(/(.*?)(div id=result_box 
dir=ltr)(.*?)(\/div)(.*?)/s,$3,$source_html);

 
 how this breaks down is:
 
 opening quote for first parameter (your MATCH pattern).
 
 open regex match pattern= /
 
 first atom (.*?) = any or no leading text before div id=result_box
 dir=ltr,
 the ? makes it non-greedy so that it stops after finding the first match.
 
 second atom (div id=result_box dir=ltr) = the opening tag you are
 looking for.
 
 third atom (.*?) = the text you want to strip out, all text even if
 nothing is
 there, between the 2nd and
 4th atoms.
 
 fourth atom (\/div) = the closing tag of the div tag pair.
 
 fifth atom (.*?) = all of the rest of the source html after the closing
 tag up
 to the end of the line ^,even if there is nothing there.
 
 close regex match pattern= /s
 
 in order for this to work on html that may contain newlines, you must
 specify
 that the . can represent newline characters, this is done by adding the
 letter
 's' after your regex closing /, so the last thing in your regex match
 pattern
 would be /s.
 
 end of string ^ (this matches the end of the string you are
 matching/replacing
 , $source_html)

 ignore this part of the explanation, the ^ is not needed and in fact breaks 
the example given

 
 closing quote for first parameter.
 
 The second parameter of the preg_replace is the atom # which contains the
 text
 you want to replace the text matched by the regex match pattern in the
 first
 parameter, in this case the text we want is in the third atom so this
 parameter
 would be $3 (this is the PHP way of back-referencing, if we wanted the
 text
 before the tag we would use atom 1, or $1, if we want the tag itself we
 use $2,
 etc basically a $ followed by the atom # that holds what we want to
 replace the
 $source_html into $trans_text).
 
 The third parameter of the preg_replace is the source you wish to match
 and
 replace from, in this case your source html in $source_html.
 
 after this executes, $trans_text should contain the innerText of the div
 id=result_box dir=ltr/div tag pair from $source_html, if there is
 nothing

Re: [PHP] need help with foreach

2006-10-31 Thread Dave Hamber

Its not very clear what you want to achieve with that code snippet.

If you are pulling database rows out of your database with 
mysql_fetch_array(), then you do not need a foreach loop.


I think you may want something like this, but without knowing your 
database table structure and the query you have used it is only a guess.


while($row = mysql_fetch_array($result2,MYSQL_ASSOC)){

	echo a href=client.php?art=.$row['pix']. 
border='0'{$row['jobType']}/a\n;

if($row['url']!='')echo html to use with .$row['url'];

}


On 31/10/2006 10:09 [EMAIL PROTECTED] wrote:
I want to tell the server to do 2 things when I click on the jobType 
link.


This is the code that I have now which displays the art when I click 
on jobType


foreach($row as $jobType)
{
$row = mysql_fetch_array($result2,MYSQL_ASSOC);
echo a href=client.php?art=.$row['pix']. 
border='0'{$row['jobType']}/a\n;

}

I now want to, with the same click, also show the url if I have a url 
for that jobType in my database column called url.


Thank you for any help.

--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] need help with foreach

2006-10-31 Thread Richard Lynch
On Tue, October 31, 2006 4:09 am, [EMAIL PROTECTED] wrote:
 I want to tell the server to do 2 things when I click on the
 jobType link.

 This is the code that I have now which displays the art when I
 click on jobType

 foreach($row as $jobType)
   {
   $row = mysql_fetch_array($result2,MYSQL_ASSOC);
   echo a href=client.php?art=.$row['pix']. 
 border='0'{$row
 ['jobType']}/a\n;

echo a href=\$row[url]\$row[url]/a\n;

 I now want to, with the same click, also show the url if I have a url
 for that jobType in my database column called url.

I'm assuming you don't mean that you want the user to see the image
and then be auto-forwarded to the 'url' from the db...

That's a fish of a different color.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] need help to build a query

2006-10-11 Thread Ivo F.A.C. Fokkema
On Tue, 10 Oct 2006 14:22:54 -0500, Richard Lynch wrote:
 On Mon, October 9, 2006 2:58 pm, John Wells wrote:
 On 10/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 but I know there must be much better solution then this one.

 You're right: Simply JOIN your queries...

 SELECT order_id, order_date, order_status, file_name
 FROM orders
 JOIN uploaded_files AS uf ON orders.order_id = uf.order_id
 ORDER BY orders.order_id DESC
 LIMIT 100
 
 This will miss all the orders with no upload at all, unlike the
 original.

As specified elsewhere in this thread, use outer join to prevent losing
orders with no uploads.

 AND it limits you to the 100 uploaded files, not 100 orders.
 
 This is a lot more subtle problem than it seems at first glance, eh?

To fetch all uploaded filenames in one result row, and solving the limit
problem all at once, see group_concat(). Mind you, works only with MySQL
4.1...

Ivo

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



Re: [PHP] need help to build a query

2006-10-10 Thread Richard Lynch
On Mon, October 9, 2006 2:44 pm, [EMAIL PROTECTED] wrote:
 I have table orders with primary key order_id. I have table
 uploaded_files
 with primary key ufid and uploaded files are linked to orders by
 order_id
 column.

 I have to list all orders and uploaded files. this works fine:

 $query = mysql_query(
   select order_id, order_date, order_status
   from orders
   order by order_id desc
   limit 100);
 while($result=mysql_fetch_array($query))
 {
   echo ID: . $result['order_date'].|;
   echo DATE: . $result['order_date'] .|;
   echo STATUS: . $result['order_status'] .|;
   echo UPLOADED FILES: ;
   $query2 = mysql_query(
 select uf.file_name
 from uploaded_files as uf
 where uf.order_id = $result['order_id']
   );
   while($result2=mysql_fetch_array($query2))
   {
 echo $result2['file_name'].|;
   }
   echo hr;
 }

 but I know there must be much better solution then this one.

This is really an SQL question...

But let's take the PHP performance test, to stay on topic.

Yes, you are sending 100 queries to the DB through mysql_query.

Does that negatively impact performance on YOUR server for YOUR web
app at your current or 5-year projected levels of usage?

If not, don't waste time trying to optimize it.  K.I.S.S. and use the
queries that work just fine.

As a bonus, the answer to what you actually asked is:


select orders.order_id, order_date, order_status
from orders
left outer join uploaded_files on uploaded_files.order_id =
orders.order_id
order by orders.order_id desc
limit 100

Unfortunately, this limit now applies to the number of uploaded files
and/or orders with no files at all, rather than the number of orders.

AFAIK, there is no easy way to get the exact same limit of 100 orders
with however many uploaded files.

So if you NEED 100 orders, and who cares how many uploaded files, the
solution you have is CORRECT, no matter how wrong it looks.

Actually, you could *maybe* get some performance gain by running
through the first result, gathering up the IDs into an array, and then
splicing that into a single query like:

//outside the loop:
$order_ids_sql = implode(', ', $order_ids);
$result2 = mysql_query(select order_id, file_name from uploaded_files
where order_id in ($order_ids_sql) order by order_id);

You can then run through $result2 in parallel with $result1 and
compare the $order_id to make sure you print the right thing at the
right time.

Don't be surprised if the LEFT OUTER JOIN above, or the parallel
processing and the extra array to build the query with 100 IDs turns
out to be not any faster/better than your current solution.  SQL
theory often turns out to be not-so-practical, in my experience.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] need help to build a query

2006-10-10 Thread Richard Lynch
On Mon, October 9, 2006 2:58 pm, John Wells wrote:
 On 10/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 but I know there must be much better solution then this one.

 You're right: Simply JOIN your queries...

 SELECT order_id, order_date, order_status, file_name
 FROM orders
 JOIN uploaded_files AS uf ON orders.order_id = uf.order_id
 ORDER BY orders.order_id DESC
 LIMIT 100

This will miss all the orders with no upload at all, unlike the
original.

AND it limits you to the 100 uploaded files, not 100 orders.

This is a lot more subtle problem than it seems at first glance, eh?

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] need help to build a query

2006-10-10 Thread Richard Lynch




On Mon, October 9, 2006 3:09 pm, [EMAIL PROTECTED] wrote:
 But, in this case I will have repeating order_date and order_status
 info?

 idorder_datestatusfile_name
 122006-10-09live  file1.jpg
 122006-10-09live  file2.jpg
 122006-10-09live  file3.jpg
 132006-10-09live  file1.jpg
 142006-10-09live  test.gif

Yes.

But what you print out and what you have in each result row need not
be exactly one-to-one.

$last_order_id = '';
while (... mysql_fetch_row($result)){
  if ($last_order_id != $order_id){
echo $order_id $order_date $statusbr /\n;
$last_order_id = $order_id;
  }
  echo   $file_namebr /\n;
}

Here we only print out the order_id etc when the order_id changes, not
for every uploaded file.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] need help to build a query

2006-10-10 Thread afan
sure it is!
;)

 On Mon, October 9, 2006 2:58 pm, John Wells wrote:
 On 10/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 but I know there must be much better solution then this one.

 You're right: Simply JOIN your queries...

 SELECT order_id, order_date, order_status, file_name
 FROM orders
 JOIN uploaded_files AS uf ON orders.order_id = uf.order_id
 ORDER BY orders.order_id DESC
 LIMIT 100

 This will miss all the orders with no upload at all, unlike the
 original.

 AND it limits you to the 100 uploaded files, not 100 orders.

 This is a lot more subtle problem than it seems at first glance, eh?

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some starving artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So?

 --
 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] need help to build a query

2006-10-10 Thread afan
ok. got the point.




 On Mon, October 9, 2006 3:09 pm, [EMAIL PROTECTED] wrote:
 But, in this case I will have repeating order_date and order_status
 info?

 idorder_datestatusfile_name
 122006-10-09live  file1.jpg
 122006-10-09live  file2.jpg
 122006-10-09live  file3.jpg
 132006-10-09live  file1.jpg
 142006-10-09live  test.gif

 Yes.

 But what you print out and what you have in each result row need not
 be exactly one-to-one.

 $last_order_id = '';
 while (... mysql_fetch_row($result)){
   if ($last_order_id != $order_id){
 echo $order_id $order_date $statusbr /\n;
 $last_order_id = $order_id;
   }
   echo   $file_namebr /\n;
 }

 Here we only print out the order_id etc when the order_id changes, not
 for every uploaded file.

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some starving artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So?



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



Re: [PHP] need help to build a query

2006-10-10 Thread Richard Lynch
In MySQL, you can do explain $query to see what MySQL estimates will
be the workload.

Interpreting that output is more art than science, but with practice,
you can at least avoid SOME querie that will drive your server to its
knees.

I did work on a PostgreSQL search engine once where we did a similar
thing in the program and just bailed out if the search was clearly
going to take far too long.  Kind of nifty, really...

On Mon, October 9, 2006 3:50 pm, [EMAIL PROTECTED] wrote:
 while I was trying again I did something wrong (?) and my server is
 now
 busy and looks like it went down?!?

 The qestion is how can I check first query before I apply it to be
 sure
 I'm not goig to read every record in my DB or get into loop?

 thanks.

 -afan

 On 10/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 but I know there must be much better solution then this one.

 You're right: Simply JOIN your queries...

 SELECT order_id, order_date, order_status, file_name
 FROM orders
 JOIN uploaded_files AS uf ON orders.order_id = uf.order_id
 ORDER BY orders.order_id DESC
 LIMIT 100

 HTH,
 John W



 thanks for any help.

 -afan

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] need help to build a query

2006-10-10 Thread John Wells

On 10/10/06, Richard Lynch [EMAIL PROTECTED] wrote:


This is a lot more subtle problem than it seems at first glance, eh?


Yup, sure is.  Thanks for the detailed response, so helpful as always.

-John W



--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




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



Re: [PHP] need help to build a query

2006-10-09 Thread John Wells

On 10/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

but I know there must be much better solution then this one.


You're right: Simply JOIN your queries...

SELECT order_id, order_date, order_status, file_name
   FROM orders
   JOIN uploaded_files AS uf ON orders.order_id = uf.order_id
   ORDER BY orders.order_id DESC
   LIMIT 100

HTH,
John W




thanks for any help.

-afan

--
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] need help to build a query

2006-10-09 Thread Brad Bonkoski

[EMAIL PROTECTED] wrote:

hi to all,

I have table orders with primary key order_id. I have table uploaded_files
with primary key ufid and uploaded files are linked to orders by order_id
column.

I have to list all orders and uploaded files. this works fine:

$query = mysql_query(
  select order_id, order_date, order_status
  from orders
  order by order_id desc
  limit 100);
while($result=mysql_fetch_array($query))
{
  echo ID: . $result['order_date'].|;
  echo DATE: . $result['order_date'] .|;
  echo STATUS: . $result['order_status'] .|;
  echo UPLOADED FILES: ;
  $query2 = mysql_query(
select uf.file_name
from uploaded_files as uf
where uf.order_id = $result['order_id']
  );
  while($result2=mysql_fetch_array($query2))
  {
echo $result2['file_name'].|;
  }
  echo hr;
}

but I know there must be much better solution then this one.

thanks for any help.

-afan

  


Perhaps something like this: (not sure how this would play with the 
limit key word, but you could play around with it...)
If you can guarantee that a record (order_id) will appear in both 
tables, a simple join will work...
but if a record in table A exists but not in table B, a join will not 
return that record, which is why there is a left outer join.


select o.order_id, o.order_date, o.order_status, uf.file_name
 from orders o left outer join uploaded_files uf on uf.order_id = o.order_id
 order by o.order_id desc

Not sure if mysql supports this..??

select * from (select o.order_id, o.order_date, o.order_status, uf.file_name
 from orders o left outer join uploaded_files uf on uf.oerder_id = o.order_id
 order by o.order_id desc ) LIMIT 100

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



Re: [PHP] need help to build a query

2006-10-09 Thread afan
But, in this case I will have repeating order_date and order_status info?

idorder_datestatusfile_name
122006-10-09live  file1.jpg
122006-10-09live  file2.jpg
122006-10-09live  file3.jpg
132006-10-09live  file1.jpg
142006-10-09live  test.gif


right?


 On 10/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 but I know there must be much better solution then this one.

 You're right: Simply JOIN your queries...

 SELECT order_id, order_date, order_status, file_name
 FROM orders
 JOIN uploaded_files AS uf ON orders.order_id = uf.order_id
 ORDER BY orders.order_id DESC
 LIMIT 100

 HTH,
 John W



 thanks for any help.

 -afan

 --
 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] need help to build a query

2006-10-09 Thread afan
while I was trying again I did something wrong (?) and my server is now
busy and looks like it went down?!?

The qestion is how can I check first query before I apply it to be sure
I'm not goig to read every record in my DB or get into loop?

thanks.

-afan

 On 10/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 but I know there must be much better solution then this one.

 You're right: Simply JOIN your queries...

 SELECT order_id, order_date, order_status, file_name
 FROM orders
 JOIN uploaded_files AS uf ON orders.order_id = uf.order_id
 ORDER BY orders.order_id DESC
 LIMIT 100

 HTH,
 John W



 thanks for any help.

 -afan

 --
 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] need help to build a query

2006-10-09 Thread John Wells

Yes you are right, but I guess you can decide which is worse: sending
extra data in one query or send extra queries.  I guess it depends on
how many records we're talking about...

Brad also brings up a good point I hadn't considered.  I do think an
OUTER join is possible, perhaps depending on your mysql version...

Which brings up something I had meant to say before, which is that
this isn't actually a PHP question... :)

John W

On 10/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

But, in this case I will have repeating order_date and order_status info?

idorder_datestatusfile_name
122006-10-09live  file1.jpg
122006-10-09live  file2.jpg
122006-10-09live  file3.jpg
132006-10-09live  file1.jpg
142006-10-09live  test.gif


right?


 On 10/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 but I know there must be much better solution then this one.

 You're right: Simply JOIN your queries...

 SELECT order_id, order_date, order_status, file_name
 FROM orders
 JOIN uploaded_files AS uf ON orders.order_id = uf.order_id
 ORDER BY orders.order_id DESC
 LIMIT 100

 HTH,
 John W



 thanks for any help.

 -afan

 --
 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] need help to build a query

2006-10-09 Thread Larry Garfield
On Monday 09 October 2006 16:50, John Wells wrote:
 Yes you are right, but I guess you can decide which is worse: sending
 extra data in one query or send extra queries.  I guess it depends on
 how many records we're talking about...

It will vary with your problem, but in general, fewer queries == A Good Thing.  
If you can do with a join or subselect what would take n queries otherwise, 
do so.  

Also, JOIN is faster than sub-queries.  Be aware, though, that MySQL doesn't 
support sub-queries until version 4.1.

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



RE: [PHP] Need help with PEAR Quickform

2006-06-22 Thread Chris Boget
 I am busy working on a form using QuickForm.
 I would like to make use of a confirmation page 
 where the user must eitheir select to change the 
 details or continue.  Does anyone know how to 
 achieve this?

On POST, you could redisplay the form in a Frozen
state.  If the form is frozen, you display a separate 
set of submit buttons and in checking to see if those
new buttons were clicked do you actually process the
form normally (access data store, etc).

This is just one of the many ways you can go about
achieving the same results.

thnx,
Chris

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



RE: [PHP] Need Help Please

2006-05-23 Thread Jay Blanchard
[snip]
While tabindex is a neat thing to use it does not necessarily give focus
to the first element of the form, it merely dictates the order in which
form elements will be given focus when the tab key is pressed. The 
action may vary from browser to browser. Likely, when going to a form
with tabindex defined, none of the elements will have focus until the
tab key is pressed once, at which time the element with tabindex=1 
will get focus.

If you want to give focus to the first input element of a form you must
still use a JavaScript widget to place the focus there after the entire
page has loaded, tabindex will make sure that the cursor goes in the 
order you wish to go in after that.[/snip]

[snip]
Try to use Firefox to debug your javascript.
I guess, there are some javascript error.
[/snip]

I confirmed before I sent the above e-mail that tabindex did not work in
Firefox or Opera either.

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



RE: [PHP] Need Help Please

2006-05-22 Thread Jay Blanchard
[snip]
Although someone else has suggested you use JavaScript to set the 
focus on a particular form field, I urge you instead to use HTML 
tabindex property:

pUser Name: input tabindex=1 type=text name=username /p br
pPassword: input tabindex=2 type=password name=password /p
br
pinput tabindex=3 type=submit value=Login /p

HTML 4.01 Specification
17 Forms
17.11 Giving focus to an element
17.11.1 Tabbing navigation
http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1

Simplistic JavaScript solutions place focus on an input field after 
the page has completely loaded, often after the user has begun 
interacting with the form, causing irritating focus jumps in mid-input.
[/snip]

While tabindex is a neat thing to use it does not necessarily give focus
to the first element of the form, it merely dictates the order in which
form elements will be given focus when the tab key is pressed. The
action may vary from browser to browser. Likely, when going to a form
with tabindex defined, none of the elements will have focus until the
tab key is pressed once, at which time the element with tabindex=1
will get focus.

If you want to give focus to the first input element of a form you must
still use a JavaScript widget to place the focus there after the entire
page has loaded, tabindex will make sure that the cursor goes in the
order you wish to go in after that.

YMMV

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



Re: [PHP] Need Help Please

2006-05-21 Thread Wolf
Sure we can...  Go back and read your manual.  Then surf Google.

Then tell us where you are getting the certificate from since some of us
might be wasting our time taking a class some place that teaches you so
poorly.

Wolf

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



Re: [PHP] Need Help Please

2006-05-21 Thread Chris

marvin hunkin wrote:

Hi.
doing an assignment, for my Certificate Four In Website Administration.


Wow someone doing an assignment has written some code :) Good stuff!


$_POST['username'];
$_POST['password'];
if ('username'='username')  ('password'='password')


This little bit of code is your problem.

Firstly you want to assign the username and password to some variables:

$posted_username = $_POST['username'];
$posted_password = $_POST['password'];

http://www.php.net/manual/en/language.variables.php#language.variables.basics

Then you want to check them:

if ($posted_username == 'username'  $posted_password == 'password')
{


in php, one = means assignment

http://www.php.net/manual/en/language.operators.assignment.php

to check a variable, use two - ==.

http://www.php.net/manual/en/language.operators.comparison.php


Lastly for some extra credit, you should read http://phpsec.org/projects/.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Need Help Please

2006-05-21 Thread Chris

Wolf wrote:

Sure we can...  Go back and read your manual.  Then surf Google.

Then tell us where you are getting the certificate from since some of us
might be wasting our time taking a class some place that teaches you so
poorly.


At least there were attempts at code which makes a nice change.. ;)

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Need Help Please

2006-05-21 Thread John Nichel

marvin hunkin wrote:

Hi.
doing an assignment, for my Certificate Four In Website Administration.


The tutor list is down the hall.


now got a couple of problems.
will explain what i have to do.
create a html form, which i have done.
in textpad.
now, when i open the form, it does not set focus to the first form field 
which is the user name.

goes to the login button.
why is this?
can any one help me?


Yes.  Buy a book on Javascript.


okay, will explain.
and to create a script for a login page, on a network.
and using php, and now got the user to enter their username and 
password, and then to display a message, saying the person logged in, 
and to display the date.
if the user, types in the wrong user name and password, then a error 
message is displayed, and a link back to the form, is displayed.
now got the problem of a error, when checking to see if the error 
happened or not, and whether to let them in or not.

so will paste the html form, and the php code below.
if any one can help me how to fix these problems, then let me know asap.
cheers Marvin.


Html Form:


Code Starts Here:

html
head
script language=text/javascript
function SetFocus
{
document.forms[0].username.focus();
}
/script
titleUser Login Form/title
/head
body onload=SetFocus();
form action=UserDetails.php method=post
pUser Name: input type=text name=username /p br
pPassword: input type=password name=password /p br
pinput type=submit value=Login /p
/form
/body
/html


Php Code:


Code Starts Here:

?php
$_POST['username'];
$_POST['password'];
if ('username'='username')  ('password'='password')
{
echo Letting you login into the tafe network. br\n;
echo Marvin Hunkin has successfully logged into the Tafe network. br\n;
echo Please Wait ... Loading Your Personal Settings ... br\n;
gmdate('d-m-Y', time()+(10*60*60));
}
else
{
echo Not letting you login into the tafe network. br\n;
echo Error! You did not type in a correct username! Please try again... 
br\n;
echo Click on the link below to return back to the login form and enter 
your correct user name and password. br\n;

echo'a href=UserDetails.htmlReturn To Login Form/a';
}
?

Code Error:

Code Starts Here:

Parse error: parse error in c:\program 
files\easyphp1-8\www\userdetails.php on line 4


I am Using Easy Php 1-8, and using http://localhost in the browser, and 
sending my files to the www folder of easy php.

Have A Great Day.
Marvin.



Instead of cutting and pasting, RTFM and understand what your code is 
(not) doing.


If this is level four, Most of us here would be a Grand Poobah.

--
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] Need Help Please

2006-05-21 Thread Paul Novitski

At 07:38 PM 5/21/2006, marvin hunkin wrote:
now, when i open the form, it does not set focus to the first form 
field which is the user name.

goes to the login button.
why is this?



Marvin,

Although someone else has suggested you use JavaScript to set the 
focus on a particular form field, I urge you instead to use HTML 
tabindex property:


pUser Name: input tabindex=1 type=text name=username /p br
pPassword: input tabindex=2 type=password name=password /p br
pinput tabindex=3 type=submit value=Login /p

HTML 4.01 Specification
17 Forms
17.11 Giving focus to an element
17.11.1 Tabbing navigation
http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1

Simplistic JavaScript solutions place focus on an input field after 
the page has completely loaded, often after the user has begun 
interacting with the form, causing irritating focus jumps in mid-input.


Regards,
Paul 


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



  1   2   3   4   >