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



[PHP] Need help to understand a code

2012-09-22 Thread Ashickur Rahman Noor
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.
--
Dedicated Linux Forum in Bangladesh 
2048R/89C932E1 
Coordinator - Public Relation Cell, FOSS Bangladesh
 && Mozilla
Reps 
01199151550, 01551151550


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 
2048R/89C932E1 
Volunteer, FOSS Bangladesh  && Mozilla
Reps
01199151550

On 24 May 2012 15:08, shiplu  wrote:

> $date = strtotime ("2008-02-28 +1 day");
>
>
>


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 ("+1 day 2008-02-28");

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

$date = 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
Get this from 
here
--
Dedicated Linux Forum in Bangladesh 
2048R/89C932E1 
Volunteer, FOSS Bangladesh  && Mozilla
Reps
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 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



[PHP] Need help on increment date

2012-05-24 Thread Md Ashickur Rahman Noor
HI all

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.

--
Dedicated Linux Forum in Bangladesh 
2048R/89C932E1 
Volunteer, FOSS Bangladesh  && Mozilla
Reps
01199151550


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


--

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 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 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 
>To: 'Lester Caine' ; 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 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 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-09 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-09 Thread Rod Lindgren
Interesting. The wp-config.php file only contains the following:











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



[PHP] Need help Wth PHP

2011-10-09 Thread Rod Lindgren

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

 

 



[PHP] Need help debugging random httpd segfault

2011-03-09 Thread Phil
Hello list,

We've been experiencing random crashes on httpd, error_log shows a
bunch of [notice] child pid 12984 exit signal Segmentation fault (11)

PHP 5.2.17:

./configure --with-apxs2=/var/www/bin/apxs --with-gd
--with-jpeg-dir=/usr/local --with-pgsql --with-pdo-pgsql
--with-png-dir=/usr/local --with-zlib-dir=/usr/local --with-mssql
--enable-wddx --with-mysqli --with-freetype-dir=/usr/local
--enable-zend-multibyte --with-mcrypt --with-mysql --with-pdo-mysql
--enable-mbstring --with-pdo-dblib --with-sybase=/usr/local/freetds
--enable-soap --with-openssl --with-curl --with-imap --with-kerberos
--with-imap-ssl --enable-ftp --enable-debug

I've been looking at coredumps; here's what I got:

(gdb) bt
#0  zend_mm_remove_from_free_list (heap=0x85043f0, mm_block=0x8512420)
at /root/download/php/php-5.2.17/Zend/zend_alloc.c:837
#1  0x01042561 in _zend_mm_free_int (heap=0x85043f0, p=) at
/root/download/php/php-5.2.17/Zend/zend_alloc.c:1979
#2  0x0104f9c0 in _zval_dtor () at
/root/download/php/php-5.2.17/Zend/zend_variables.h:35
#3  _zval_ptr_dtor (zval_ptr=0x887af7c) at
/root/download/php/php-5.2.17/Zend/zend_execute_API.c:414
#4  0x0106682e in zend_hash_destroy (ht=0x86b43c8) at
/root/download/php/php-5.2.17/Zend/zend_hash.c:526
#5  0x01053a5d in destroy_zend_class (pce=0x8736aec) at
/root/download/php/php-5.2.17/Zend/zend_opcode.c:185
#6  0x0106682e in zend_hash_destroy (ht=0x85046b8) at
/root/download/php/php-5.2.17/Zend/zend_hash.c:526
#7  0x0105cc78 in zend_shutdown () at
/root/download/php/php-5.2.17/Zend/zend.c:736
#8  0x01019ba5 in php_module_shutdown () at
/root/download/php/php-5.2.17/main/main.c:1918
#9  0x01019c4b in php_module_shutdown_wrapper (sapi_globals=0x13724a0)
at /root/download/php/php-5.2.17/main/main.c:1889
#10 0x010c89e3 in php_apache_child_shutdown (tmp=0x0) at
/root/download/php/php-5.2.17/sapi/apache2handler/sapi_apache2.c:369
#11 0x009d3b69 in run_cleanups () at memory/unix/apr_pools.c:2306
#12 apr_pool_destroy (pool=0x867a1b0) at memory/unix/apr_pools.c:774
#13 0x080cbd54 in clean_child_exit (code=0) at prefork.c:196
#14 0x080cc49d in just_die (sig=15) at prefork.c:328
#15 
#16 0x0052d424 in __kernel_vsyscall ()
#17 0x0028670b in poll () from /lib/libc.so.6
#18 0x009dda94 in apr_wait_for_io_or_timeout (f=0x0, s=0x867c1f8,
for_read=0) at support/unix/waitio.c:51
#19 0x009d7ada in apr_socket_sendv (sock=0x867c1f8, vec=0xbfe85340,
nvec=1, len=0xbfe85248) at network_io/unix/sendrecv.c:212
#20 0x0807b8a6 in writev_it_all (s=0x867c1f8, vec=0xbfe85338, nvec=2,
len=20851, nbytes=0xbfe853dc) at core_filters.c:321
#21 0x0807c42e in ap_core_output_filter (f=0x867c850, b=0x8686538) at
core_filters.c:868
#22 0x080afa28 in ap_http_header_filter (f=0x871ee70, b=0x8691a98) at
http_filters.c:1306
#23 0x08071f0e in ap_content_length_filter (f=0x871ee58, b=0x8691a98)
at protocol.c:1338
#24 0x080b1228 in ap_byterange_filter (f=0x871ee40, bb=0x8691a98) at
byterange_filter.c:169
#25 0x08092d42 in deflate_out_filter (f=0x8691a60, bb=0x8691a98) at
mod_deflate.c:512
#26 0x08092d42 in deflate_out_filter (f=0x8695050, bb=0x8691a98) at
mod_deflate.c:512
#27 0x00116edd in apr_brigade_write (b=0x8691a98, flush=0x8087640
, ctx=0x8695050,
str=0x875e3bc "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>\r\nhttp://www.w3.org/1999/xhtml\"; xml:lang=\"fr\"
lang=\"fr\">\r\n\r\nhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>\r\nhttp://www.w3.org/1999/xhtml\"; xml:lang=\"fr\"
lang=\"fr\">\r\n\r\nhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>\r\nhttp://www.w3.org/1999/xhtml\"; xml:lang=\"fr\"
lang=\"fr\">\r\n\r\nhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>\r\nhttp://www.w3.org/1999/xhtml\"; xml:lang=\"fr\"
lang=\"fr\">\r\n\r\n) at
prefork.c:650
#46 0x080cc413 in make_child (s=0x82bcc20, slot=21) at prefork.c:746
#47 0x080cd218 in perform_idle_server_maintenance () at prefork.c:881
#48 ap_mpm_run (_pconf=0x82b6550, plog=0x82f8658, s=0x82bcc20) at prefork.c:1085
#49 0x08069c20 in main (argc=Cannot access memory at address 0x0
) at main.c:740

(gdb) frame 35
#35 0x0107e370 in execute (op_array=0x8645d04) at
/root/download/php/php-5.2.17/Zend/zend_vm_execute.h:92
92 if (EX(opline)->handler(&execute_data TSRMLS_CC) > 0) {
(gdb)

I've been also looking at this previous post:
http://bugs.php.net/bug.php?id=41130

Can anyone confirm that I have the same problem... infinite loop in
the code somewhere ?

If it is... how can I pinpoint the exact line where the error is ?

-- 
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  wrote:
> On 31 July 2010 21:34, 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  
>> wrote:
>>> Hi Vince,
>>>
>>>
>>> On Jul 31, 2010, at 3:15 PM, Vince Leibowitz wrote:

 )
 (is_page(42)( (is_page(10)(>>> wpads('leaderboard5);?>) >?
>>>
>>> Try:
>>>
>>>
 >>
 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 :)
>>>
>>>
>>>
>>
>
>     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
>
> --
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> BeWelcome/Couchsurfing: Fake51
> Twitter: http://twitter.com/kafe15
> 
>



-- 
~~
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  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  
> wrote:
>> Hi Vince,
>>
>>
>> On Jul 31, 2010, at 3:15 PM, Vince Leibowitz wrote:
>>>
>>> )
>>> (is_page(42)( (is_page(10)(>> wpads('leaderboard5);?>) >?
>>
>> Try:
>>
>>
>>> >
>>> 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 :)
>>
>>
>>
>



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

-- 

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


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

Hi Vince,


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


)
(is_page(42)( (is_page(10)() >?


Try:






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 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  wrote:
> Hi Vince,
>
>
> On Jul 31, 2010, at 3:15 PM, Vince Leibowitz wrote:
>>
>> )
>> (is_page(42)( (is_page(10)(> wpads('leaderboard5);?>) >?
>
> Try:
>
>
>> 
>> 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

Hi Vince,


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


)
(is_page(42)( (is_page(10)() >?


Try:






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



[PHP] Need help calling multiple functions with if_is

2010-07-31 Thread Vince Leibowitz
Hello,

This is my first time to post to the list. I've been working with PHP
for several years as a WordPress user, but I've come upon a problem I
can't solve.
I am trying to call up a specific php function (a plugin that displays
ads) if the page is the home page, another specific function if the
page is a specific page number, and another specific function if the
page is another page. So far, this is what I have come up with, but it
doesn't work. I suspect it is because I am using the wrong syntax or
something. If anyone can help, it would be appreciated:

)
(is_page(42)( (is_page(10)() >?

I suspect I am either not using the appropriate number of spaces, or
am not using the right syntax when trying to call different objects or
functions if the page is different. I've manipulated php code before,
but never to this extent.

If anyone can help me out, I'd really appreciate it.

Vince

-- 
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  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 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 Daniel Egeberg
On Sun, Apr 11, 2010 at 20:30, lala  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.

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)
 
 Click to lalalal
 

This is how the browser looks it without javascript
 
 Click to lalalal
 

I've said it is not for a php thread

On Tue, Jul 14, 2009 at 10:29 AM, Bob McConnell 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
>>
>> 
>>      Click to lalalal
>> 
>
> 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.

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
> 
> 
>  Click to lalalal
> 

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


 Click to lalalal


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



[PHP] Need Help.

2009-07-14 Thread Girish Padia
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


[PHP] Need Help! - Looking over a wireframe doc...

2009-05-05 Thread bruce
Hi..

I'm playing around with creating an app to allow users to
add/checkin/checkout docs from a web based app. The backend will tie into
SVN as a repository.

The app is intended to be a php/mysql/linux app.

I'm trying to find a few people that I might get to take a look at the
current doc(s) I have and give me some comments/feedback...

The goal of the app is to allow a user to register, and then select the
given doc he wants to work on, as well as the given workflow phase. This
allows the app to kind of restrict the access rights a user has to the doc,
based on where in the workflow the doc is..

Get to me offline if you're interested in taking a look.

thanks

-bruce


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

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 .= ''.$request_link.'';
setCookie('reqToken',$reqToken,time()+(24*30*60*60),'/');
setCookie('reqTokenSecret',$reqTokenSecret,time()+(24*30*60*60),'/');

?>
authorize


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

2009-03-21 Thread Daniel Brown
On Sat, Mar 21, 2009 at 10:54, Virgilio Quilario
 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.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?
>
>  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 .= ''.$request_link.'';
> setCookie('reqToken',$reqToken,time()+(24*30*60*60),'/');
> setCookie('reqTokenSecret',$reqTokenSecret,time()+(24*30*60*60),'/');
>
> ?>
> authorize
> 
> 
>  }
> 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:42, Chris Westbrook  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?


>  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 .= ''.$request_link.'';
> setCookie('reqToken',$reqToken,time()+(24*30*60*60),'/');
> setCookie('reqTokenSecret',$reqTokenSecret,time()+(24*30*60*60),'/');
>
> ?>
> authorize
> 
> 
>  }
> 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.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



[PHP] need help with code

2009-03-21 Thread Chris Westbrook
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?

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 .= ''.$request_link.'';
setCookie('reqToken',$reqToken,time()+(24*30*60*60),'/');
setCookie('reqTokenSecret',$reqTokenSecret,time()+(24*30*60*60),'/');

?>
authorize


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";);

}


}
?>

[PHP] need help on the BBcode extension: What's the syntax of the Object Oriented Notation content_handling

2009-02-22 Thread Zhang Qingcheng

Hi there,

I'm using the BBcode extension(version 1.0.2), and the manual(url: http://www.php.net/manual/en/function.bbcode-create.php) 
 said the "bbcode_initial_tags" accepted Object Oriented Notation on  
content_handling, but I don't find any document on this notation or  
syntax, so could anyone tell me how to use the Object Oriented Notation?


Regards,

Kinch

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



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

2009-01-27 Thread Terion Miller
Hello All,
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.
---
Name ."\n";  *This is the "trying to get property of
non object"*

$sql = "INSERT INTO workorders (CreatedDate, Location, WorkOrderName,
AdminID, FormName, Status, Notes) VALUES (";
$sql .= "Now(), '$Location', '$WorkOrderName', '$AdminID',
'PD_Enhanced', 'New Order', '$Notes')";
mysql_query($sql);
$WorkOrderID = mysql_insert_id();

 if ($_FILES) {
if (isset($_FILES['Logo'])) {
if (is_uploaded_file ($_FILES['Logo']['tmp_name'])) {
$ImageExt = strtolower(end(explode('.',
$_FILES['Logo']['name'])));
$Logo = "ArtUpload/Artwork/". $WorkOrderID ."_Logo.".
$ImageExt;
move_uploaded_file($_FILES['Logo']['tmp_name'],$Logo);
}
}
if (isset($_FILES['Image1'])) {
if (is_uploaded_file ($_FILES['Image1']['tmp_name'])) {
$ImageExt = strtolower(end(explode('.',
$_FILES['Image1']['name'])));
$Image1 = "ArtUpload/Artwork/". $WorkOrderID ."_Image1.".
$ImageExt;
move_uploaded_file($_FILES['Image1']['tmp_name'],$Image1);
}
}
if (isset($_FILES['Image2'])) {
if (is_uploaded_file ($_FILES['Image2']['tmp_name'])) {
$ImageExt = strtolower(end(explode('.',
$_FILES['Image2']['name'])));
$Image2 = "ArtUpload/Artwork/". $WorkOrderID ."_Image2.".
$ImageExt;
move_uploaded_file($_FILES['Image2']['tmp_name'],$Image2);
}
}
if (isset($_FILES['Image3'])) {
if (is_uploaded_file ($_FILES['Image3']['tmp_name'])) {
$ImageExt = strtolower(end(explode('.',
$_FILES['Image3']['name'])));
$Image3 = "ArtUpload/Artwork/". $WorkOrderID ."_Image3.".
$ImageExt;
move_uploaded_file($_FILES['Image3']['tmp_name'],$Image3);
}
}
if (isset($_FILES['Image4'])) {
if (is_uploaded_file ($_FILES['Image4']['tmp_name'])) {
$ImageExt = strtolower(end(explode('.',
$_FILES['Image4']['name'])));
$Image4 = "ArtUpload/Artwork/". $WorkOrderID ."_Image4.".
$ImageExt;
move_uploaded_file($_FILES['Image4']['tmp_name'],$Image4);
}
}
if (isset($_FILES['Image5'])) {
if (is_uploaded_file ($_FILES['Image5']['tmp_name'])) {
$ImageExt = strtolower(end(explode('.',
$_FILES['Image5']['name'])));
$Image5 = "ArtUpload/Artwork/". $WorkOrderID ."_Image5.".
$ImageExt;
move_uploaded_file($_FILES['Image5']['tmp_name'],$Image5);
}
}
if (isset($_FILES['ExtraImage1'])) {   *then each of the
"extraImage" are throwing the undefined variable error*
if (is_uploaded_file ($_FILES['ExtraImage1']['tmp_name'])) {
$ImageExt = strtolower(end(explode('.',
$_FILES['ExtraImage1']['name'])));
$ExtraImage1Name = "ArtUpload/Artwork/". $WorkOrderID
."_Image1.". $ImageExt;

move_uploaded_file($_FILES['ExtraImage1']['tmp_name'],$ExtraImage1Name);
}
}
if (isset($_FILES['ExtraImage2'])) {
if (is_uploaded_file ($_FILES['ExtraImage2']['tmp_name'])) {
$ImageExt = strtolower(end(explode('.',
$_FILES['ExtraImage2']['name'])));
$ExtraImage2Name = "ArtUpload/Artwork/". $WorkOrderID
."_Image2.". $ImageExt;

move_uploaded_file($_FILES['ExtraImage2']['tmp_name'],$ExtraImage2Name);
}
}
if (isset($_FILES['ExtraImage3'])) {
if (is_uploaded_file ($_FILES['ExtraImage3']['tmp_name'])) {
$ImageExt = strtolower(end(explode('.',
$_FILES['ExtraImage3']['name'])));
$ExtraImage3Name = "ArtUpload/Artwork/". $WorkOrderID
."_Image3.". $ImageExt;

move_uploaded_file($_FILES['ExtraImage3']['tmp_name'],$ExtraImage3Name);
}
}
if (isset($_FILES['ExtraImage4'])) {
if (is_uploaded_file ($_FILES['ExtraImage4']['tmp_name'])) {
$ImageExt = strtolower(end(explode('.',
$_FILES['ExtraImage4']['name'])));
$ExtraImage4Name = "ArtUpload/Artwork/". $WorkOrderID
."_Image4.". $ImageExt;

move_uploaded_file($_FILES['ExtraImage4']['tmp_name'],$ExtraImage4Name);
}
}
if (isset($_FILES['ExtraImage5'])) {
if (is_uploaded_file ($_FILES['ExtraImage5']['tmp_name'])) {
$ImageExt = strtolower(end(explode('.',
$_FILES['ExtraImage5']['name'])

Re: [PHP] Need Help - apology

2008-12-29 Thread Eric Butera
On Mon, Dec 29, 2008 at 3:18 PM, John Corry  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 - 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

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

2008-12-29 Thread Eric Butera
On Mon, Dec 29, 2008 at 2:39 PM, 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
>

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



[PHP] Need Help

2008-12-29 Thread dlinden
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;

 "The Company Intranet",
  "header" => "The Company Intranet",
  "bottom" => "Copyright(R) 2005",
  "left_nav_links" => array(),
  "body_links" => array(),
  "col_headers"=> array(),
  "data_rows"  => array(),
);

$admin = FALSE;
$base_url = "CompanyHome.php";
$trail = "Home";#24

if (!isset($_SESSION['user_name']))
  header("Location: Login.php");#27
else
{
  if (isset($_SESSION['user_dept'])
  && isset($_GET['dept_id']))
  { #32
$admin = $_SESSION['user_dept'] == $_GET['dept_id'];
  }

  $cxn = Connect_to_db("Vars.inc");
  $left_nav_links = array();
  $page["browse_level"] =   #38
isset($_GET['browse_level']) ?
  $_GET['browse_level'] : "home";   

  switch ($page["browse_level"])#42
  {
case "home":
  $sql = "SELECT name, dept_id, description
  FROM Department
  ORDER BY name";
  $results = mysqli_query($cxn, $sql);
  $body_links = "";
  while($row = mysqli_fetch_assoc($results))#50
  {
$link = "$base_url?dept_id=" . $row['dept_id']
  . "&browse_level=department";
$page["left_nav_links"][$link] = $row['name'];
$body_links .= "" . $row['name'] . " - "
  . $row['description'];
  }
  $page["left_nav_header"] = "Departments"; #59
  $page["top"] = "Welcome to our Intranet";
  $page["body_text"] = "Welcome to our Intranet "
. "where each department shares content with "
. "the whole company.  You can update your "
. "own departments content too with our simple "
. "interface.Vist the departments' "
. "home pages: $body_links";

  break;

case "department":  #70
  $dept_id = $_GET['dept_id'];
  $sql = "SELECT name, dept_id, description
  FROM Department
  WHERE dept_id = $dept_id ORDER BY name";
  $results = mysqli_query($cxn, $sql);
  $row = mysqli_fetch_assoc($results);
  $dept_name = $row['name'];
  $dept_desc= $row['description'];

  $page["left_nav"] = "$dept_name Content";
  $page["body_text"] = "$dept_name - $dept_desc";
  $sql = "SELECT a.name, a.type_id,
 count(b.content_id)
  FROM Content_Type a
  LEFT OUTER JOIN Content b on
   a.type_id = b.content_type
   and b.dept_id = $dept_id
  GROUP BY a.name, a.type_id ORDER BY name";
  $results = mysqli_query($cxn, $sql);

  $body_links = "";
  while($row = mysqli_fetch_assoc($results))#92
  {
$link = "$base_url?dept_id=$dept_id"
  . "&type_id=" . $row['type_id']
  . "&browse_level=content";
$page["left_nav_links"][$link] = $row['name'];
$body_links .= "" . $row['name'] . "";
  }
  $page["left_nav_header"] = "Content Index";
  $page["top"] = $dept_name;
  $page["body_text"] = "$dept_name - $dept_desc "
. "Vist the departments' "
. "areas: $body_links";
  $trail .= " - $dept_name";
  break;

case "content":#110
  $dept_id = $_GET['dept_id'];
  $type_id = $_GET['type_id'];
  $sql = "SELECT a.name, a.type_id, b.title,
b.description, b.content_date,
b.create_date, b.created_by,
b.last_upd_date, b.last_upd_by,
c.name as dept_name, content_id
  FROM Content_Type a, Department c
  LEFT OUTER JOIN Content b on
a.type_id = b.content_type
and a.type_id = b.content_type
and b.dept_id = $dept_id
and b.content_type = $type_id
  WHERE c.dept_id = $dept_id
  ORDER BY content_date DESC";
  $results = mysqli_query($cxn, $sql);

  $body_links = "";
  $content_count = 0;
  $page["body_text"] = "";

  while($row = mysqli_fetch_assoc($results))   #132
  {
if (!isset($area_name) && $type_id == $row["type_id"])
{
  $area_name = $row["name"];
  $dept_name = $row["dept_name"];
}
$link = "$base_url?dept_id=$dept_id"
  . "&type_id=" . $row['type_id']
  . "&browse_level=content";
$page["left_nav_links"][$link] = $row['name'];

if (!isset($row["content_id"]))   #144
  continue;

$content_id = $row["content_id"];

$content_count++;
$link = "$base_url?dept_id=$dept_id"
  . "&type_id=$type_id&browse_level=content";
$page["left_nav_links"][$link] = $row[

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


[PHP] Need help on MySQL query

2008-12-10 Thread Rahat Bashir
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


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:
>
>
>   NAME: size="80"/>
>  Foto:
>  {%%}
>  
>  Big foto:
>  {%%}
>  
>
>
>
> I need result as:
>
>
> NAME: size="80"/>
>  Foto:
>  {%%}
>  
> ==REPLACEMENT==
>
>
> And I have this result:
>
>   NAME: size="80"/>
>  Foto:
> ==REPLACEMENT==
>  
>
>
> --
> 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-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:

NAME:
 Foto:value="{%foto%}" />

 {%%}
 
==REPLACEMENT==

[snip!]

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

$out = 
preg_replace('/Big.*\{%%%.*\{%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 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:

NAME:
 Foto:
 {%%}
 
==REPLACEMENT==

[snip!]

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

Big.*\{%%%.*\{%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-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:
>
> NAME: size="80"/>
>  Foto:
>  {%%}
>  
> ==REPLACEMENT==
[snip!]

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

Big.*\{%%%.*\{%bigfoto%\}.*%%%\}.*<\/tr>/Uis','==REPLACEMENT==',$str);
?>

-- 

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



[PHP] Need help for DOM xsd validation

2007-12-02 Thread Matthias Reindl

Hi,

I'm trying to load XML data into my script. That's no problem. The  
problem is, that the

schema validation fails all time after loading a new document:

Warning: DOMDocument::schemaValidate()  
[function.DOMDocument-schemaValidate]: Element
'{http://www.desktopportal.de/Preferences}user': This element is not  
expected. Expected

is ( user ).

Funny is, if I'm creating and adding elements with php (DOMDocument  
etc.) and then
validate the xml structure, no error occures. But if I reload this  
saved file next time

when the script is reloading, I get a warning.

Any ideas? Thanks,
Matthias

This is my xml file:

http://www.desktopportal.de/Preferences";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>




This is my xsd file:

http://www.desktopportal.de/Preferences";
xmlns="http://www.desktopportal.de/Preferences";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>




minOccurs="0" maxOccurs="unbounded"/>






maxOccurs="1" minOccurs="1"/>


use="required">





minOccurs="0" maxOccurs="unbounded"/>






minOccurs="1" maxOccurs="unbounded"/>


use="required">





minOccurs="1" maxOccurs="1"/>


use="required">




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



[PHP] Need help for DOM xsd validation

2007-12-02 Thread Matthias Reindl

Hi,

I'm trying to load XML data into my script. That's no problem. The  
problem is, that the schema validation fails all time after loading a  
new document:


Warning: DOMDocument::schemaValidate()  
[function.DOMDocument-schemaValidate]: Element  
'{http://www.desktopportal.de/Preferences}user': This element is not  
expected. Expected is ( user ).


Funny is, if I'm creating and adding elements with php (DOMDocument  
etc.) and then validate the xml structure, no error occures. But if I  
reload this saved file next time when the script is reloading, I get a  
warning.


Any ideas? Thanks,
Matthias

This is my xml file:

http://www.desktopportal.de/Preferences";  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>





This is my xsd file:

http://www.desktopportal.de/Preferences";  
xmlns="http://www.desktopportal.de/Preferences";  
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>





		maxOccurs="unbounded"/>






		minOccurs="1"/>







		maxOccurs="unbounded"/>






		maxOccurs="unbounded"/>







		maxOccurs="1"/>


	use="required">




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

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

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


[PHP] Need help adding dBase support to PHP

2007-10-11 Thread Jon Westcot
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!

Thanks,

Jon



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



[PHP] need help,pls

2007-07-26 Thread esimaje juan toritseju
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 Php to enable a user to 
select one or more designs to appear on the other also to make a background 
color for the designs to be placed on,i ought to make it possible for the user 
to be able to change the background color to see which color suits the 
design,also make it possible for a user to be able to upload their own designs 
and make it sharable to other users.I will really appreciate if you will be 
able to direct me on how to go about this work.Looking forward to hearing from 
you soon.Thanks

   
-
 Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for 
your freeaccount today.

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

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



[PHP] need help

2007-07-02 Thread Muhammad Hassan Samee

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] need help on project-Creating Database

2007-03-28 Thread Karl James
Team,
 
I am in need of your help.
I have tried over the years to do this. 
But, I am not getting it correct.
 
What I want to do is build site that has team management 
for your roster of players, and display stats in a nut shell.
 
As far as stats, I have about 5 years worth of data that I want to
store in a database. I want to display it by all means. Years, players,
teams etc.
 
Then, I also want to be able to manage the players and the teams only with
the current
active year. 
 
My wish list is here:
http://www.theufl.com/ufl_project.htm
 
Please email privately if needed.
 
This is a dream of mine to finish for my website.
I want to do all the work and learn it. I know of databases just never
really gone all out on one.
Can you please tell me what tables and fields I would need in order to do
this.
I have a word doc going that shows a projected database. If you are
interested in seeing it please
let me know so I can email you off the list, as I am not able to send out
attachments. :-)
 
Your alls help would be greatly appreciated
 
Karl
 
Karl James ("TheSaint")
  [EMAIL PROTECTED]
  [EMAIL PROTECTED]
www.theufl.com  
 
 


RE: [PHP] Need help with RegEx

2006-12-15 Thread Richard Lynch

preg_match_all('|([^<]*)|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:
> 
>   16664 Rejected: Invalid LTV
> 
>
> Example 2:
> 
>   Unable to Post, Invalid Information
> 
>
> I want what is inside the  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
>> >
>> >THIS IS A TEST
>> >
>> >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("\/> 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("/(.*?)(> 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 > dir=ltr>,
>> the ? makes it non-greedy so that it stops after finding the first
>> match.
>>
>> second atom () = 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
&

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("/(.*?)(> > > 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("\/> 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("/ dir=ltr>(.+?)<\\/div>/", $orig, $matches);
>
>$matches[0]  will return the entire match (everything from ""
>$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("# dir=ltr>(.+?)#", $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-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("/(.*?)( > > 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("\/ 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("/ dir=ltr>(.+?)<\\/div>/", $orig, $matches);

$matches[0]  will return the entire match (everything from ""
$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("# dir=ltr>(.+?)#", $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-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("/(.*?)(> 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>)(.*?)/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:
>
>   16664 Rejected: Invalid LTV
>
>
>Example 2:
>
>   Unable to Post, Invalid Information
>
>
>I want what is inside the  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
>> >
>> >THIS IS A TEST
>> >
>> >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>/");
>> 
>> Using the tags you describe here, and assuming the source html is in the
>> variable $source_html, try this:
>> 
>> $trans_text = preg_replace("/(.*?)(> 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>)(.*?)/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 > dir=ltr>,
>> the ? makes it non-greedy so that it stops after finding the first match.
>> 
>> second atom () = 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 

RE: [PHP] Need help with RegEx

2006-12-11 Thread Brad Fuller

I got it.

Hello, World!";

preg_match("#(.*?)#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):
> 
>  
>   $_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:
> 
> ~16664 Rejected: Invalid LTV
> 
> 
> Example 2:
> 
> ~Unable to Post, Invalid Information
> 
> 
> I want what is inside the  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 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):



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

~16664 Rejected: Invalid LTV


Example 2:

~Unable to Post, Invalid Information


I want what is inside the  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

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:

16664 Rejected: Invalid LTV


Example 2:

Unable to Post, Invalid Information


I want what is inside the  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
> >
> >THIS IS A TEST
> >
> >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>/");
> 
> Using the tags you describe here, and assuming the source html is in the
> variable $source_html, try this:
> 
> $trans_text = preg_replace("/(.*?)( 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  dir=ltr>,
> the ? makes it non-greedy so that it stops after finding the first match.
> 
> second atom () = 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  id=result_box dir=ltr> 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 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
>>
>>THIS IS A TEST
>>
>>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>/");
>
>Using the tags you describe here, and assuming the source html is in the
>variable $source_html, try this:
>
>$trans_text = preg_replace("/(.*?)(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 ,
>the ? makes it non-greedy so that it stops after finding the first match.
>
>second atom () = 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 id=result_box dir=ltr> 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 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
>
>THIS IS A TEST
>
>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>/");

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

$trans_text = preg_replace("/(.*?)()(.*?)(<\/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 ,
the ? makes it non-greedy so that it stops after finding the first match.

second atom () = 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  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 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
> 
> THIS IS A TEST
> 
> 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>/");
> 
> 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 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 = "THIS IS A TEST";
preg_match("/(.+?)<\/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
> 
> THIS IS A TEST
> 
> 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>/");
> 
> 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 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
>
> THIS IS A TEST
>
> 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>/");
>
> 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



[PHP] Need help with RegEx

2006-12-11 Thread Anthony Papillion
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

THIS IS A TEST

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>/");

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 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 " border='0'>{$row
> ['jobType']}\n";

echo "$row[url]\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 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 "border='0'>{$row['jobType']}\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 "border='0'>{$row['jobType']}\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



[PHP] need help with foreach

2006-10-31 Thread melinem
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 "{$row 
['jobType']}\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



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



  1   2   3   4   5   6   >