Re: [PHP] Help with code

2004-12-25 Thread John Holmes
karl james wrote:
Can you tell me why this code is not working?
I get a query is empty at the moment.
http://www.theufl.com/php/wrox_php/movie_details.phps
Didn't we already see this once?
From File:
 $movie_query in mysql_query();
What kind of PHP code is that? You could really help yourself by telling 
us what query failed... what line it's on and only that line and a 
couple around it. Do you think a lot of other people are boring like me 
and going to read your code on Christmas? If you don't know what query 
is failing, then use more than mysql_error() in your die statements...

$review_result = mysql_query($review_query) or die('Query to pull 
reviews has failed. Reason: ' . mysql_error());

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Help with code

2004-12-25 Thread karl james
 
I have since updated it.
And I am having issues with a function I suppose.

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in
/home/virtual/site38/fst/var/www/html/php/wrox_php/movie_details.php on line
119

http://www.theufl.com/php/wrox_php/movie_details.php



Karl James
(TheSaint)
[EMAIL PROTECTED]
http://theufl.com/
 

-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED] 
Sent: Sunday, December 26, 2004 1:09 AM
To: karl james
Cc: php-general@lists.php.net
Subject: Re: [PHP] Help with code

karl james wrote:
 Can you tell me why this code is not working?
 I get a query is empty at the moment.
 
 http://www.theufl.com/php/wrox_php/movie_details.phps

Didn't we already see this once?

 From File:
  $movie_query in mysql_query();

What kind of PHP code is that? You could really help yourself by telling us
what query failed... what line it's on and only that line and a couple
around it. Do you think a lot of other people are boring like me and going
to read your code on Christmas? If you don't know what query is failing,
then use more than mysql_error() in your die statements...

$review_result = mysql_query($review_query) or die('Query to pull reviews
has failed. Reason: ' . mysql_error());

-- 

---John Holmes...

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

php|architect: The Magazine for PHP Professionals - www.phparch.com

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



Re: [PHP] Help wth coding

2004-12-21 Thread Richard Lynch
 http://www.theufl.com/php/wrox_php/movie_details10.php

Copy movie_details10.php into movie_details10.phps (with an 's' on the
end) and then we can surf to your source and tell you something useful.

Or, copy and paste your soure up to the line with the error to the list.

We sure can't help you just based on surfing to the URL.

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

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



Re: [PHP] help with coding #3

2004-12-21 Thread John Holmes
 From: karl james [EMAIL PROTECTED]

 Ok I will try the links again, sorry about the hassel, 

Did I miss the first part of this message?

 http://www.theufl.com/movie_details.phps
 
 website
 
 http://www.theufl.com/php/wrox_php/movie_details.php
 
 Are you able to tshoot it and see whats going on?
 
 Im not able to get the code working.

First thing I noticed is here: 

$movie_query = SELECT
   *
 FROM
 movie
 WHERE
  movie_id ='.$_GET['movie_id'].';

$movie_result = mysql_query($query,$link) or die(mysql_error());

Shouldn't that be $movie_query in mysql_query()??

---John Holmes...

UCCASS - PHP Survey System
http://www.bigredspark.com/survey.html

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



Re: [PHP] help me split chars w/o spaces by 2... like: 2004

2004-12-09 Thread ApexEleven
I did something like this a while back, I believe I used chunk_split

[code]
?

$year_split = date(Y);
$chars = chunk_split($year_split,2);
print_r($chars);

?
[/code]

it'll output something along the lines of:
20
04

Hope this helps,

-- 

Jasper Howard - Database Administration
ApexEleven.com
530 559 0107
---

On Thu, 9 Dec 2004 10:21:49 +0800, Louie Miranda [EMAIL PROTECTED] wrote:
 ?php
 $hello2 = chop($year_split);
 echo $hello2;
 ?
 
 outputs: 2004
 
 Whats the correct syntax for it? The manual said..
 
 This function is an alias of rtrim().
 
 and:
 
 rtrim
 (PHP 3, PHP 4 )
 
 rtrim --  Strip whitespace from the end of a string
 
 
 
 
 On Wed, 08 Dec 2004 18:11:19 -0800, Tyler Replogle [EMAIL PROTECTED] wrote:
  have you tride using chop() ?
  # begin code
  $year_split = date(Y);
  $chars = chop($year_split);
  $chars[0] // = 2
  $chars[1] // = 0
  $chars[2] // = 0
  $chars[3]  //= 4
  # end code
  I hope that will help
 
  From: Louie Miranda [EMAIL PROTECTED]
  Reply-To: Louie Miranda [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Subject: [PHP] help me split chars w/o spaces by 2... like: 2004
  Date: Thu, 9 Dec 2004 09:55:57 +0800
  MIME-Version: 1.0
  Received: from pb1.pair.com ([216.92.131.4]) by mc6-f24.hotmail.com with
  Microsoft SMTPSVC(5.0.2195.6713); Wed, 8 Dec 2004 17:56:52 -0800
  Received: (qmail 21242 invoked by uid 1010); 9 Dec 2004 01:56:02 -
  Received: (qmail 21150 invoked by uid 1010); 9 Dec 2004 01:56:01 -
  X-Message-Info: 6sSXyD95QpUKIecQn+Z/xIP21pcg8LTu
  Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
  Precedence: bulk
  list-help: mailto:[EMAIL PROTECTED]
  list-unsubscribe: mailto:[EMAIL PROTECTED]
  list-post: mailto:[EMAIL PROTECTED]
  Delivered-To: mailing list [EMAIL PROTECTED]
  Delivered-To: [EMAIL PROTECTED]
  Delivered-To: [EMAIL PROTECTED]
  DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;s=beta;
  d=gmail.com;
  h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding;
  
  b=gp2OcpYqK7wZkSMBhO5OvxdTzhTOQdM1+n9ZtLJ4lmsKWFpVRb9Y2kyjNIrRIX/rvXeFfwCVGh7LT6kub0DMmCGdeRiLKeCjJkxK4fWxSrP2D+FexciD2lT8ASKD7TNYC3YGIZLZbk5UEJIq9Yx2TkbIdgNd/Op3+iEviy1scI4=
  Return-Path: [EMAIL PROTECTED]
  X-OriginalArrivalTime: 09 Dec 2004 01:56:53.0406 (UTC)
  FILETIME=[5AF313E0:01C4DD92]
 
 
  
  Help me split chars w/o spaces by 2... like: 2004
  How can i make it?
  
  first: 20
  second: 04
  
  Im working on this..
  
  # begin code
  $year_split = date(Y);
  $chars = preg_split('//', $year_split, -1, PREG_SPLIT_NO_EMPTY);
  # end code
  
  But it splits the whole 2004 string..
  
  Array
  (
   [0] = 2
   [1] = 0
   [2] = 0
   [3] = 4
  )
  
  
  --
  Louie Miranda
  http://www.axishift.com
  
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 
 
 --
 Louie Miranda
 http://www.axishift.com
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 

Jasper Howard - Database Administration
ApexEleven.com
530 559 0107
---

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



RE: [PHP] help me split chars w/o spaces by 2... like: 2004

2004-12-08 Thread Tyler Replogle
have you tride using chop() ?
# begin code
$year_split = date(Y);
$chars = chop($year_split);
$chars[0] // = 2
$chars[1] // = 0
$chars[2] // = 0
$chars[3]  //= 4
# end code
I hope that will help
From: Louie Miranda [EMAIL PROTECTED]
Reply-To: Louie Miranda [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP] help me split chars w/o spaces by 2... like: 2004
Date: Thu, 9 Dec 2004 09:55:57 +0800
MIME-Version: 1.0
Received: from pb1.pair.com ([216.92.131.4]) by mc6-f24.hotmail.com with 
Microsoft SMTPSVC(5.0.2195.6713); Wed, 8 Dec 2004 17:56:52 -0800
Received: (qmail 21242 invoked by uid 1010); 9 Dec 2004 01:56:02 -
Received: (qmail 21150 invoked by uid 1010); 9 Dec 2004 01:56:01 -
X-Message-Info: 6sSXyD95QpUKIecQn+Z/xIP21pcg8LTu
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: mailto:[EMAIL PROTECTED]
list-unsubscribe: mailto:[EMAIL PROTECTED]
list-post: mailto:[EMAIL PROTECTED]
Delivered-To: mailing list [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;s=beta; 
d=gmail.com;
h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; 
   
b=gp2OcpYqK7wZkSMBhO5OvxdTzhTOQdM1+n9ZtLJ4lmsKWFpVRb9Y2kyjNIrRIX/rvXeFfwCVGh7LT6kub0DMmCGdeRiLKeCjJkxK4fWxSrP2D+FexciD2lT8ASKD7TNYC3YGIZLZbk5UEJIq9Yx2TkbIdgNd/Op3+iEviy1scI4=
Return-Path: [EMAIL PROTECTED]
X-OriginalArrivalTime: 09 Dec 2004 01:56:53.0406 (UTC) 
FILETIME=[5AF313E0:01C4DD92]

Help me split chars w/o spaces by 2... like: 2004
How can i make it?
first: 20
second: 04
Im working on this..
# begin code
$year_split = date(Y);
$chars = preg_split('//', $year_split, -1, PREG_SPLIT_NO_EMPTY);
# end code
But it splits the whole 2004 string..
Array
(
[0] = 2
[1] = 0
[2] = 0
[3] = 4
)
--
Louie Miranda
http://www.axishift.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] help me split chars w/o spaces by 2... like: 2004

2004-12-08 Thread Robby Russell
On Thu, 2004-12-09 at 09:55 +0800, Louie Miranda wrote:
 Help me split chars w/o spaces by 2... like: 2004
 How can i make it?
 
 first: 20
 second: 04
 
 Im working on this..
 
 # begin code
 $year_split = date(Y);
 $chars = preg_split('//', $year_split, -1, PREG_SPLIT_NO_EMPTY);
 # end code
 
 But it splits the whole 2004 string..
 
 Array
 (
 [0] = 2
 [1] = 0
 [2] = 0
 [3] = 4
 )
 
 

First of all, what sort of code are you building that needs to split the
year by 2 sets of 2 digits?

Second, you can do this like so:

$foo = date(Y);

$bar = array();

$bar[] = substr($foo,0,2);
$bar[] = substr($foo,2,2);

print_r($bar);


 Array
 (
 [0] = 20
 [1] = 04
 )


-Robby

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


signature.asc
Description: This is a digitally signed message part


Re: [PHP] help me split chars w/o spaces by 2... like: 2004

2004-12-08 Thread Louie Miranda
?php
$hello2 = chop($year_split);
echo $hello2;
?

outputs: 2004

Whats the correct syntax for it? The manual said.. 

This function is an alias of rtrim(). 

and: 

rtrim
(PHP 3, PHP 4 )

rtrim --  Strip whitespace from the end of a string 



On Wed, 08 Dec 2004 18:11:19 -0800, Tyler Replogle [EMAIL PROTECTED] wrote:
 have you tride using chop() ?
 # begin code
 $year_split = date(Y);
 $chars = chop($year_split);
 $chars[0] // = 2
 $chars[1] // = 0
 $chars[2] // = 0
 $chars[3]  //= 4
 # end code
 I hope that will help
 
 From: Louie Miranda [EMAIL PROTECTED]
 Reply-To: Louie Miranda [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [PHP] help me split chars w/o spaces by 2... like: 2004
 Date: Thu, 9 Dec 2004 09:55:57 +0800
 MIME-Version: 1.0
 Received: from pb1.pair.com ([216.92.131.4]) by mc6-f24.hotmail.com with
 Microsoft SMTPSVC(5.0.2195.6713); Wed, 8 Dec 2004 17:56:52 -0800
 Received: (qmail 21242 invoked by uid 1010); 9 Dec 2004 01:56:02 -
 Received: (qmail 21150 invoked by uid 1010); 9 Dec 2004 01:56:01 -
 X-Message-Info: 6sSXyD95QpUKIecQn+Z/xIP21pcg8LTu
 Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
 Precedence: bulk
 list-help: mailto:[EMAIL PROTECTED]
 list-unsubscribe: mailto:[EMAIL PROTECTED]
 list-post: mailto:[EMAIL PROTECTED]
 Delivered-To: mailing list [EMAIL PROTECTED]
 Delivered-To: [EMAIL PROTECTED]
 Delivered-To: [EMAIL PROTECTED]
 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;s=beta;
 d=gmail.com;
 h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding;
 
 b=gp2OcpYqK7wZkSMBhO5OvxdTzhTOQdM1+n9ZtLJ4lmsKWFpVRb9Y2kyjNIrRIX/rvXeFfwCVGh7LT6kub0DMmCGdeRiLKeCjJkxK4fWxSrP2D+FexciD2lT8ASKD7TNYC3YGIZLZbk5UEJIq9Yx2TkbIdgNd/Op3+iEviy1scI4=
 Return-Path: [EMAIL PROTECTED]
 X-OriginalArrivalTime: 09 Dec 2004 01:56:53.0406 (UTC)
 FILETIME=[5AF313E0:01C4DD92]
 
 
 
 Help me split chars w/o spaces by 2... like: 2004
 How can i make it?
 
 first: 20
 second: 04
 
 Im working on this..
 
 # begin code
 $year_split = date(Y);
 $chars = preg_split('//', $year_split, -1, PREG_SPLIT_NO_EMPTY);
 # end code
 
 But it splits the whole 2004 string..
 
 Array
 (
  [0] = 2
  [1] = 0
  [2] = 0
  [3] = 4
 )
 
 
 --
 Louie Miranda
 http://www.axishift.com
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 


-- 
Louie Miranda
http://www.axishift.com

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



Re: [PHP] help plssssss.!!!

2004-12-03 Thread Marek Kilimajer
Tomar Rajeev (ext) wrote:
Hello All,
I am a new member of this group and in the world of PHP;-)
and I guess to mailing lists in general too. You should give a hint 
about your problem in the subject.

In my company, around 12 web pages are there. So, I want to make a web
portal in PHP from where all these web pages can be accessed.
Also, I want to provide the link for the web pages ( will make three
categories) in three horizontal dynamic menu.
If some user clicks on the link then the corresponding web page should be
shown in the same web page just below the dynamic menu.
You don't need PHP to do this. What you are asking for can be 
acomplished in pure html. If you need more, look for php cms (content 
management system)

It will be great if you could help me in finding the source code of this
type of web page in PHP. 

Thanking in Anticipation.
Regards,
Rajeev Tomar
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] help plssssss.!!!

2004-12-03 Thread ankur_os

I think u have to go for 
http://www.w3schools.com

Thnx for joining the group

Ankur Dave


Quoting Tomar Rajeev (ext) [EMAIL PROTECTED]:

 
 Hello All,
 
 I am a new member of this group and in the world of PHP;-)
 
 In my company, around 12 web pages are there. So, I want to make a web
 portal in PHP from where all these web pages can be accessed.
 
 Also, I want to provide the link for the web pages ( will make three
 categories) in three horizontal dynamic menu.
 
 If some user clicks on the link then the corresponding web page should be
 shown in the same web page just below the dynamic menu.
 
 It will be great if you could help me in finding the source code of this
 type of web page in PHP. 
 
 Thanking in Anticipation.
 
 Regards,
 
 Rajeev Tomar
 
 -- 
 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] help plssssss.!!!

2004-12-03 Thread Richard Lynch
Tomar Rajeev (ext) wrote:
 I am a new member of this group and in the world of PHP;-)

 In my company, around 12 web pages are there. So, I want to make a web
 portal in PHP from where all these web pages can be accessed.

 Also, I want to provide the link for the web pages ( will make three
 categories) in three horizontal dynamic menu.

 If some user clicks on the link then the corresponding web page should be
 shown in the same web page just below the dynamic menu.

 It will be great if you could help me in finding the source code of this
 type of web page in PHP.

Sounds to me like a pretty basic Links page management.

Search http://phpclasses.org for Links Page Management or similar terms,
and something should come up.

You'll need to figure out the Dynamic Menus somewhere else, as that's done
with DHTML/XHTML or somesuch.  I never bothered to find out since IT WON'T
WORK ON SOME BROWSERS (like mine).

And as far as having the page show up below the links, you could use
http://php.net/readfile or HTML FRAMESET/FRAME tags.  If you use
FRAMESET/FRAME tags, the how part is pretty much not involving PHP at
all, and MANY PEOPLE HATE FRAME PAGES (like me) so will run away from your
site.

If you use http://php.net/readfile, however, all the relative links
inside of the page you are displaying are going to be broken, unless you
use something like http://php.net/file to read the HTML, then parse it
with a regular expression http://php.net/pcre to find all relative URLs
and change them to absolute by prepending the base URL of the page you
are serving up.

It would probably be a whole lot easier, really, to just link to the other
page, and let the user *go* there, instead of trying to keep them on your
little portal.  If they want to come back to your portal, they will.

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

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



Re: [PHP] Help with GET variables which do not work after upgrading

2004-11-28 Thread Burhan Khalid
Eamon Reyn wrote:
Hey,
I was happily using GET command line variables in my project under php 4.3.4 
but when I upgrade to 4.3.9 they no longer work I can make them work by 
changing back to my prior version of php but would rather use the newer one 
can anyone explain why this may happen.
Please read the release notes for 4.3.9. It will tell you there why they 
are not working.

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


RE: [PHP] Help with GET variables which do not work after upgrading

2004-11-28 Thread Adrian Portsmouth
Hi Eamon,

It looks like you need to upgrade your code to use the superglobal arrays.
Change print $unitID; to print $_GET['unitID']; and see if that helps.

You can find more information regarding superglobals here:
http://uk.php.net/en/language.variables.predefined

HTH


Adrian Portsmouth
.htaccess Manager - SilkPHP
[e] [EMAIL PROTECTED]
[w] www.htaccessmanager.com


This email, its contents and attachments are confidential and may be covered
by legal privilege.  This email contains information intended only for the
person(s) and/or entity named above. The views and opinions expressed are
those of the sender and not necessarily those of SilkPHP or its affiliates.
Any other distribution, copying, review, use or disclosure is strictly
prohibited. If you are not the intended recipient, please delete this
message and any attachments without making a copy and advise the sender by
return email - thank you.

This mail and any attachments have been scanned for viruses prior to leaving
the SilkPHP network. SilkPHP will not be liable for direct, special,
indirect or consequential damages arising from alteration of the contents of
this message by a third party or as a result of any virus being passed on.

-Original Message-
From: Eamon Reyn [mailto:[EMAIL PROTECTED] 
Sent: 28 November 2004 10:37
To: [EMAIL PROTECTED]
Subject: [PHP] Help with GET variables which do not work after upgrading

Hey,

I was happily using GET command line variables in my project under php 4.3.4
but when I upgrade to 4.3.9 they no longer work I can make them work by
changing back to my prior version of php but would rather use the newer one
can anyone explain why this may happen.

here is some sample code and the results of it -

This line creates the link with the GET var in it -

print 'blockquotea
href=showaUnit.php?unitID='.$id.''.$theArray[$i]['title'].'Unit Id = '. 
$id .'/ablockquotei'.$theArray[$i]['desc'].'/i
/blockquote/blockquote';

This is the resultant URL which appears when I click the link above

http://127.0.0.1/ieee1484/IEEE1484/UnitofLearning/showaUnit.php?unitID=1

and when I use the following code in the form

  print (Unit ID = );
  print $unitID;

I get the result displayed as - Unit ID =

Which would hopefully display Unit ID = 1 for the case above.

This could be a settings file change or something more major but I would
appreciate any help.

Apologies if this is not the right place to post this but I am getting a bit
desperate if this is the wrong place please tell me the more appropriate
one.

Eamon 

--
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] help with html through php

2004-11-26 Thread Curt Zirzow
* Thus wrote Todd Alexander:
 Hello all,
 I am a complete newbie to php so apologies for what I'm sure is a
 simple/dumb question.  I want to use php to include another html doc in
 an existing set of documents.  In other words 123.html will use php to
 call on abc.html so I can make changes to abc.html and have it update
 on all my pages.   

I'm not sure what your asking. But by default .html files will
*not* get parsed by php, unless you modifyy how your webserver
treats .html files



Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] help with html through php

2004-11-21 Thread Raditha Dissanayake
Todd Alexander wrote:
Hello all,
I am a complete newbie to php so apologies for what I'm sure is a
simple/dumb question.  I want to use php to include another html doc in
an existing set of documents.  In other words 123.html will use php to
call on abc.html so I can make changes to abc.html and have it update
on all my pages.   
 

You have struck upon a pretty standard technique you will need to look 
at the include() or require() functions to persue this further. There is 
a subtle difference between the two but when you are getting started the 
difference does not really matter all that much. On most webservers you 
will need to name your 123 file not as 123.html but as 123.php or 
123.phtml abc.html can continue to be abc.html

Again I realize this is a complete newbie question but I appreciate any
help you have.
Todd
 

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


Re: [PHP] help with html through php

2004-11-21 Thread Rens Admiraal
Hi Todd,
Maybe I can show you a technique which is real helpful to me...
You can make a HTML file which you use as template, and add some 
standard strings (character chains) to it... Like [TIME], or 
[ACTIVE_USER]... When you open the HTML document in your browser, you 
can see where your time and active user have to appear. All you now have 
to do is find a way to replace those strings... When I hear the words 
replace and strings together I have to think about the str_replace() 
function... But, str_replace needs a string as haysteck, so you have to 
get the source of your HTML in a string... How to do that?

That's easy... You can read a file line for line with the file() 
function, this returns an array... but, an array isn't what you want, 
you want 1 string... so you use the implode() function to make it 1 string
This string you can use as haysteck, and echo it later...

I think it may be a little much info, so, here an example:
*template.html
*html
   head
  title[TITLE]/title
   /head
   body
  [BODY]
   /body
/html
*script.php*
?php
   $template_string = implode( , file (template.html) );
   $template_string = str_replace ([TITLE], This is a script using 
templates, $template_string);
   $template_string = str_replace ([BODY], Body text, 
$template_string);
   echo $template_string;
?

The shorter way for Script.php if you have amny strings to replace is:
?php
   $template_string = implode( , file (template.html) );
   $replaces = array ([TITLE]  = this is a script using templates,
  [BODY]  = Body text);
   foreach ($replaces as $string = $value)
   {
  $template_string = str_replace ($string, $value, $string_template);
   }
   echo $template_string;
?
Raditha Dissanayake wrote:
Todd Alexander wrote:
Hello all,
I am a complete newbie to php so apologies for what I'm sure is a
simple/dumb question.  I want to use php to include another html doc in
an existing set of documents.  In other words 123.html will use php to
call on abc.html so I can make changes to abc.html and have it update
on all my pages.

You have struck upon a pretty standard technique you will need to look 
at the include() or require() functions to persue this further. There 
is a subtle difference between the two but when you are getting 
started the difference does not really matter all that much. On most 
webservers you will need to name your 123 file not as 123.html but as 
123.php or 123.phtml abc.html can continue to be abc.html

Again I realize this is a complete newbie question but I appreciate any
help you have.
Todd
 




Re: [PHP] help with html through php

2004-11-21 Thread M. Sokolewicz
Rens Admiraal wrote:
Hi Todd,
Maybe I can show you a technique which is real helpful to me...
You can make a HTML file which you use as template, and add some 
standard strings (character chains) to it... Like [TIME], or 
[ACTIVE_USER]... When you open the HTML document in your browser, you 
can see where your time and active user have to appear. All you now have 
to do is find a way to replace those strings... When I hear the words 
replace and strings together I have to think about the str_replace() 
function... But, str_replace needs a string as haysteck, so you have to 
get the source of your HTML in a string... How to do that?

That's easy... You can read a file line for line with the file() 
function, this returns an array... but, an array isn't what you want, 
you want 1 string... so you use the implode() function to make it 1 string
This string you can use as haysteck, and echo it later...

I think it may be a little much info, so, here an example:
*template.html
*html
   head
  title[TITLE]/title
   /head
   body
  [BODY]
   /body
/html
*script.php*
?php
   $template_string = implode( , file (template.html) );
   $template_string = str_replace ([TITLE], This is a script using 
templates, $template_string);
   $template_string = str_replace ([BODY], Body text, 
$template_string);
   echo $template_string;
?

The shorter way for Script.php if you have amny strings to replace is:
?php
   $template_string = implode( , file (template.html) );
   $replaces = array ([TITLE]  = this is a script using templates,
  [BODY]  = Body text);
   foreach ($replaces as $string = $value)
   {
  $template_string = str_replace ($string, $value, $string_template);
   }
   echo $template_string;
?
easier/shorter would be:
?php
$template_string = implode(\n, file('template.file'));
$replaces = array('[TITLE]'='a title', '[BODY]'='something else');
echo str_replace(array_keys($replaces), array_values($replaces), 
$template_string); // (array_values() isn't really required here)
?
Raditha Dissanayake wrote:
Todd Alexander wrote:
Hello all,
I am a complete newbie to php so apologies for what I'm sure is a
simple/dumb question.  I want to use php to include another html doc in
an existing set of documents.  In other words 123.html will use php to
call on abc.html so I can make changes to abc.html and have it update
on all my pages.   
You have struck upon a pretty standard technique you will need to look 
at the include() or require() functions to persue this further. There 
is a subtle difference between the two but when you are getting 
started the difference does not really matter all that much. On most 
webservers you will need to name your 123 file not as 123.html but as 
123.php or 123.phtml abc.html can continue to be abc.html

Again I realize this is a complete newbie question but I appreciate any
help you have.
Todd
 



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


Re: [PHP] help with html through php

2004-11-21 Thread Pete
In message [EMAIL PROTECTED], Raditha Dissanayake
[EMAIL PROTECTED] writes
Todd Alexander wrote:

Hello all,
I am a complete newbie to php so apologies for what I'm sure is a
simple/dumb question.  I want to use php to include another html doc in
an existing set of documents.  In other words 123.html will use php to
call on abc.html so I can make changes to abc.html and have it update
on all my pages.   
  

You have struck upon a pretty standard technique you will need to look 
at the include() or require() functions to persue this further. There is 
a subtle difference between the two but when you are getting started the 
difference does not really matter all that much. On most webservers you 
will need to name your 123 file not as 123.html but as 123.php or 
123.phtml abc.html can continue to be abc.html

 
Again I realize this is a complete newbie question but I appreciate any
help you have.
 
Todd

A further point (since you are newbie G) is to remember that abc.html
will not normally be a complete page on it's own - it will only have the
parts of the final page that you actually want to include, not all the
HEAD... BODY stuff...

-- 
Pete Clark

http://www.hotcosta.com
http://www.spanishholidaybookings.com

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



Re: [PHP] help with html through php

2004-11-21 Thread Rens Admiraal
thnx ;-)
this really is shorter, and easier to use... !!!
M. Sokolewicz wrote:
Rens Admiraal wrote:
Hi Todd,
Maybe I can show you a technique which is real helpful to me...
You can make a HTML file which you use as template, and add some 
standard strings (character chains) to it... Like [TIME], or 
[ACTIVE_USER]... When you open the HTML document in your browser, you 
can see where your time and active user have to appear. All you now 
have to do is find a way to replace those strings... When I hear the 
words replace and strings together I have to think about the 
str_replace() function... But, str_replace needs a string as 
haysteck, so you have to get the source of your HTML in a string... 
How to do that?

That's easy... You can read a file line for line with the file() 
function, this returns an array... but, an array isn't what you want, 
you want 1 string... so you use the implode() function to make it 1 
string
This string you can use as haysteck, and echo it later...

I think it may be a little much info, so, here an example:
*template.html
*html
   head
  title[TITLE]/title
   /head
   body
  [BODY]
   /body
/html
*script.php*
?php
   $template_string = implode( , file (template.html) );
   $template_string = str_replace ([TITLE], This is a script using 
templates, $template_string);
   $template_string = str_replace ([BODY], Body text, 
$template_string);
   echo $template_string;
?

The shorter way for Script.php if you have amny strings to replace is:
?php
   $template_string = implode( , file (template.html) );
   $replaces = array ([TITLE]  = this is a script using 
templates,
  [BODY]  = Body text);
   foreach ($replaces as $string = $value)
   {
  $template_string = str_replace ($string, $value, 
$string_template);
   }

   echo $template_string;
?
easier/shorter would be:
?php
$template_string = implode(\n, file('template.file'));
$replaces = array('[TITLE]'='a title', '[BODY]'='something else');
echo str_replace(array_keys($replaces), array_values($replaces), 
$template_string); // (array_values() isn't really required here)
?

Raditha Dissanayake wrote:
Todd Alexander wrote:
Hello all,
I am a complete newbie to php so apologies for what I'm sure is a
simple/dumb question.  I want to use php to include another html 
doc in
an existing set of documents.  In other words 123.html will use 
php to
call on abc.html so I can make changes to abc.html and have it 
update
on all my pages.   

You have struck upon a pretty standard technique you will need to 
look at the include() or require() functions to persue this further. 
There is a subtle difference between the two but when you are 
getting started the difference does not really matter all that much. 
On most webservers you will need to name your 123 file not as 
123.html but as 123.php or 123.phtml abc.html can continue to be 
abc.html

Again I realize this is a complete newbie question but I appreciate 
any
help you have.

Todd
 






RE: [PHP] Help: Database Search

2004-11-15 Thread Gryffyn, Trevor
You can't do WHERE Industry = 1, 2, 3 unless that's something you can
do in MySQL but not the other DB's I've used.

What you CAN do is us IN:


WHERE Industry IN (1, 2, 3)

Or..

WHERE Industry IN ('1','2','3')


IN basically does a Industry = 1 OR Industry = 2 OR Industry = 3 type
thing.

If there's a more efficient way to do your query, I'd recommend it.
IN or even the multiple OR statements can be very intensive on a
database with a high load or tons of rows.  But it's definitely the
right answer for some solutions.

If you have 8 categories for Industry and you're doing IN (1, 2, 3, 4,
5) then you might consider doing a  6,  7,  8 type thing (I'm
guessing you can do NOT IN (6, 7, 8), just never done it).   The fewer
things you're checking in your WHERE clause, the less work your DB
server has to do.

HTH

-TG

 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED] 
 Sent: Saturday, November 13, 2004 1:16 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Help: Database Search
 
 
 I've changed my logic around but still running into a
 sql query error.
 I've tried a number of things with no success.  Here
 is the error that returns on POST:
 
 SELECT PostStart, JobTitle, Industry, LocationState,
 VendorID FROM VendorJobs WHERE (VendorJobs.Industry =
 ''1','2','3''Query failed: You have an error in your
 SQL syntax. Check the manual that corresponds to your
 MySQL server version for the right syntax to use near
 '1','2','3''' at line 2 . 
 
 Here is the relevant code:
 
 $Ind = $HTTP_POST_VARS['Ind'];
 if (count($Ind)  0 AND is_array($Ind)) {
 $Ind = '.implode(',', $Ind).';
 }
 $sql = SELECT PostStart, JobTitle, Industry,
 LocationState, VendorID
 FROM VendorJobs;
 //if ($Ind)
 $sql .=  WHERE (VendorJobs.Industry = '$Ind';
 
 I'm not trying to be a pain here.  Either I'm not
 catching a syntax error or something else.
 
 Stuart

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



Re: [PHP] Help: Database Search

2004-11-13 Thread Stuart Felenstein
I've changed my logic around but still running into a
sql query error.
I've tried a number of things with no success.  Here
is the error that returns on POST:

SELECT PostStart, JobTitle, Industry, LocationState,
VendorID FROM VendorJobs WHERE (VendorJobs.Industry =
''1','2','3''Query failed: You have an error in your
SQL syntax. Check the manual that corresponds to your
MySQL server version for the right syntax to use near
'1','2','3''' at line 2 . 

Here is the relevant code:

$Ind = $HTTP_POST_VARS['Ind'];
if (count($Ind)  0 AND is_array($Ind)) {
$Ind = '.implode(',', $Ind).';
}
$sql = SELECT PostStart, JobTitle, Industry,
LocationState, VendorID
FROM VendorJobs;
//if ($Ind)
$sql .=  WHERE (VendorJobs.Industry = '$Ind';

I'm not trying to be a pain here.  Either I'm not
catching a syntax error or something else.

Stuart

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



Re: [PHP] Help: Database Search

2004-11-10 Thread Jon Hill
You might want to try looking up the syntax for left join queries.
I think this might be what you are after.

http://dev.mysql.com/doc/mysql/en/JOIN.html


On Wednesday 10 November 2004 14:37, Stuart Felenstein wrote:
 I am creating a database search form and results.
 Running into a problem though.
 I have two form elements, both that are fed by tables
 that have int values (1, 2 , etc)

 my sql statement is such:

 SELECT vendorjobs.PostStart, vendorjobs.JobTitle,
 vendorjobs.Industry, vendorjobs.VendorID,
 vendorjobs.LocationCity, vendorjobs.TaxTerm FROM
 vendorjobs WHERE vendorjobs.Industry = '$Ind' AND
 Date_Sub(Curdate(), interval '$Days' day) = PostStart
 

 But if the user decides to only use one of the
 elements, then I don't want the query to return
 nothing because of the And in the where clause so I
 have these 2 statements that set a default value
 (shown here as 0 in the event one of the two elements
 aren't selected:  (Having no luck as the form still
 only works correctly if I've set both elements)

 $Ind = 0;
 if (isset($_POST['Ind'])) {
   $Ind = (get_magic_quotes_gpc()) ? $_POST['Ind'] :
 addslashes($_POST['Ind']);
 }
 $Days = 0;
 if (isset($_POST['Days'])) {
   $Days = (get_magic_quotes_gpc()) ? $_POST['Days'] :
 addslashes($_POST['Days']);

 Thank you ,
 Stuart

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



Re: [PHP] Help: Database Search

2004-11-10 Thread Stuart Felenstein

--- Jon Hill [EMAIL PROTECTED] wrote:

 You might want to try looking up the syntax for left
 join queries.
 I think this might be what you are after.
 
 http://dev.mysql.com/doc/mysql/en/JOIN.html
 
It has nothing to do with left joins.  It works fine
provided I do one of two things, make selections on
both form elements, or change the where statement to
or instead of and.

Stuart

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



Re: [PHP] Help: Database Search

2004-11-10 Thread Jason Wong
On Wednesday 10 November 2004 14:37, Stuart Felenstein wrote:

 But if the user decides to only use one of the
 elements, then I don't want the query to return
 nothing because of the And in the where clause so I
 have these 2 statements that set a default value
 (shown here as 0 in the event one of the two elements
 aren't selected:  (Having no luck as the form still
 only works correctly if I've set both elements)

Why not build your sql query according to whether or not whatever you want is 
selected or not.  That way debugging is easier as you won't be looking at 
queries that contain redundant ... AND 0 

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
This system will self-destruct in five minutes.
*/

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



Re: [PHP] Help: Database Search

2004-11-10 Thread Jason Wong
On Wednesday 10 November 2004 15:37, Stuart Felenstein wrote:
 --- Jason Wong [EMAIL PROTECTED] wrote:
  Why not build your sql query according to whether or
  not whatever you want is
  selected or not.  That way debugging is easier as
  you won't be looking at
  queries that contain redundant ... AND 0 

 Jason, How would I do that ? Care to share a short
 exmaple ?

A simplistic pseudo-code version:

  $sql = SELECT blah WHERE 1; 
  if ($something = selected) {
$sql .= AND something;
  }
  ...
  ...
  $sql .= ... rest of query;

Anyway, someone has already posted a more detailed example.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Hmm...  Which would do a better job at driving physicists crazy?  Travel
faster than light, or a floating-point boolean value?
-- Michael Mol
*/

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



RE: [PHP] Help: Database Search

2004-11-10 Thread Graham Cossey
What about doing something like:

$sql = SELECT * FROM my_table WHERE col1=$var1;

if (isset($var2))
$sql .=  AND col2='$var2'; 

HTH

Graham

 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
 Sent: 10 November 2004 14:37
 To: [EMAIL PROTECTED]
 Subject: [PHP] Help: Database Search 
 
 
 I am creating a database search form and results.
 Running into a problem though.
 I have two form elements, both that are fed by tables
 that have int values (1, 2 , etc)
 
 my sql statement is such:
 
 SELECT vendorjobs.PostStart, vendorjobs.JobTitle,
 vendorjobs.Industry, vendorjobs.VendorID,
 vendorjobs.LocationCity, vendorjobs.TaxTerm FROM
 vendorjobs WHERE vendorjobs.Industry = '$Ind' AND
 Date_Sub(Curdate(), interval '$Days' day) = PostStart
 
 
 But if the user decides to only use one of the
 elements, then I don't want the query to return
 nothing because of the And in the where clause so I
 have these 2 statements that set a default value
 (shown here as 0 in the event one of the two elements
 aren't selected:  (Having no luck as the form still
 only works correctly if I've set both elements)
 
 $Ind = 0;
 if (isset($_POST['Ind'])) {
   $Ind = (get_magic_quotes_gpc()) ? $_POST['Ind'] :
 addslashes($_POST['Ind']);
 }
 $Days = 0;
 if (isset($_POST['Days'])) {
   $Days = (get_magic_quotes_gpc()) ? $_POST['Days'] :
 addslashes($_POST['Days']);
 
 Thank you ,
 Stuart
 
 -- 
 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] Help: Database Search

2004-11-10 Thread Stuart Felenstein

--- Jason Wong [EMAIL PROTECTED] wrote:

 Why not build your sql query according to whether or
 not whatever you want is 
 selected or not.  That way debugging is easier as
 you won't be looking at 
 queries that contain redundant ... AND 0 
 

Jason, How would I do that ? Care to share a short
exmaple ?

Thank you 
Stuart

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



Re: [PHP] help with fopen path

2004-11-09 Thread Marek Kilimajer
Giles Roadnight wrote:
Hi All
 
I'm developing a fusebox PHP app and have a class in a /classes
directory that opens an xml file in a directory below the site root
using this path: ../siteconfig.xml
 
All of the places I have used this class from so far have been in the
site root. I am now starting some pages in a sub directory. When I use
this class it says it can't open the file. I have tried
../../siteconfig.xml instead but it doesn't work either.
 
What's the best way to go about fixing this? I'm quite new to php and
I'm not sure where the relative path is taken from - i.e. is it the
index.php page or the class (obviously not) or my switch file or what?
The paths are relative to $PHP_SELF, so you need just 'siteconfig.xml'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] help with fopen path

2004-11-09 Thread Graham Cossey


 -Original Message-
 From: Giles Roadnight [mailto:[EMAIL PROTECTED]
 Sent: 09 November 2004 13:07
 To: [EMAIL PROTECTED]
 Subject: [PHP] help with fopen path


 Hi All

 I'm developing a fusebox PHP app and have a class in a /classes
 directory that opens an xml file in a directory below the site root
 using this path: ../siteconfig.xml

 All of the places I have used this class from so far have been in the
 site root. I am now starting some pages in a sub directory. When I use
 this class it says it can't open the file. I have tried
 ../../siteconfig.xml instead but it doesn't work either.

 What's the best way to go about fixing this? I'm quite new to php and
 I'm not sure where the relative path is taken from - i.e. is it the
 index.php page or the class (obviously not) or my switch file or what?


Just a thought:
If your referencing a file within a PHP script that is included/required
within another script the path should be relative to the 'parent' script.

I am guessing that if you make reference above the site root (using ../../)
the site root will be assumed.

If you have access to the web server config try setting up an alias
such as /config which points to the directory containing your config xml
so that your scripts can reference /config/siteconfig.xml from any
directory.

HTH

Graham

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



Re: [PHP] help with fopen path

2004-11-09 Thread James McGlinn
Hi Giles,
I'm developing a fusebox PHP app and have a class in a /classes
directory that opens an xml file in a directory below the site root
using this path: ../siteconfig.xml
All of the places I have used this class from so far have been in the
site root. I am now starting some pages in a sub directory. When I use
this class it says it can't open the file. I have tried
../../siteconfig.xml instead but it doesn't work either.
What's the best way to go about fixing this? I'm quite new to php and
I'm not sure where the relative path is taken from - i.e. is it the
index.php page or the class (obviously not) or my switch file or what?
You might want to set your global parameters (such as the full path to 
class files) in a config file which is auto_prepend'ed to each PHP 
script.

That way you can always require_once( $GLOBALS['classPath'] . 
'/class.YourClass.php' ) regardless of your working directory.

James McGlinn
Project Manager
BCom, BSc, Zend Certified Engineer (PHP)
Servers.co.nz Ltd
68 Shortland St, Auckland	PO Box 3688 Shortland St, Auckland, New 
Zealand
Phone: 0800 4 SERVERS	Fax: +64 9 358 5187

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


Re: [PHP] help in php script

2004-11-04 Thread Klaus Reimer
Deepak Dhake wrote:
But i am not getting any output if i follow the above procedure. Can you 
tell me how to do it? I have to have the script TimeRotateImage.php 
which calculates which image to print accoring to local time and i want 
to embed the file name in html tag to print it on screen.
It's not clear what your PRINT macros are doing. Maybe you forgot to 
send the content-type-header? Or maybe there is a script error which is 
not displayed when you call the page inside a image tag. Call the script 
directly in your browser to see what's going on. If it outputs binary 
data then everything is working but you forgot the content-type header.

--
Bye, K http://www.ailis.de/~k/ (FidoNet: 2:240/2188.18)
[A735 47EC D87B 1F15 C1E9  53D3 AA03 6173 A723 E391]
(Finger [EMAIL PROTECTED] to get public key)


signature.asc
Description: OpenPGP digital signature


Re: [PHP] help in php script

2004-11-04 Thread Deepak Dhake
PRINT is nothing but...
TimeRotateImage.php
?php
$curr_time = (localtime());
if ($curr_time[2] = 6 and $curr_time[2] = 17) {
   print img src='image1.jpg';
 }
else {
   print img src='image2.jpg';
 }
?
this script (something like this) should be called from another script like,
?PHP
print img src='TimeRotateImage.php';
?
did you get what i am saying? please let me know if you have some solution.
thanks
Klaus Reimer wrote:
Deepak Dhake wrote:
But i am not getting any output if i follow the above procedure. Can 
you tell me how to do it? I have to have the script 
TimeRotateImage.php which calculates which image to print accoring to 
local time and i want to embed the file name in html tag to print it 
on screen.

It's not clear what your PRINT macros are doing. Maybe you forgot to 
send the content-type-header? Or maybe there is a script error which 
is not displayed when you call the page inside a image tag. Call the 
script directly in your browser to see what's going on. If it outputs 
binary data then everything is working but you forgot the content-type 
header.

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


Re: [PHP] help in php script

2004-11-04 Thread Klaus Reimer
Deepak Dhake wrote:
?PHP
print img src='TimeRotateImage.php';
?
did you get what i am saying? please let me know if you have some solution.
thanks
No. I must admit, It don't understand it. Let me try: You have a script 
a.php which outputs this static content:

img src=b.php
b.php outputs the static content img src=c.jpeg
This can't work. You browser tries to download an image with the name 
'img src=c.jpeg'. I think THAT's your problem and the reason why I 
did not understand you problem. If you use a PHP script inside an img 
src attribute then this PHP-Script must output an image. Complete with 
content-type header and the image as binary data in the body.

Or another solution for a.php:
html
 body
  img src=?php include('b.php')? /
 /body
/html
but I don't see the sense here. You can just do all this in one script:
?php
$curr_time = (localtime());
if ($curr_time[2] = 6 and $curr_time[2] = 17) {
  $img = 'a.jpg';
}
else {
  $img = 'b.jpg';
}
?
html
 body
  img src=?=$img? /
 /body
/html
If I still misunderstood your problem then maybe your description was 
not detailed enough.

--
Bye, K http://www.ailis.de/~k/ (FidoNet: 2:240/2188.18)
[A735 47EC D87B 1F15 C1E9  53D3 AA03 6173 A723 E391]
(Finger [EMAIL PROTECTED] to get public key)


signature.asc
Description: OpenPGP digital signature


Re: [PHP] help in php script

2004-11-04 Thread Klaus Reimer
Klaus Reimer wrote:
This can't work. You browser tries to download an image with the name 
'img src=c.jpeg'. 
Ah, I'm talking nonsense. I meant the browser tries to DISPLAY an image 
with the CONTENT 'img src=c.jpeg'. The browser can't do this. 
That's why you don't see anything.

--
Bye, K http://www.ailis.de/~k/ (FidoNet: 2:240/2188.18)
[A735 47EC D87B 1F15 C1E9  53D3 AA03 6173 A723 E391]
(Finger [EMAIL PROTECTED] to get public key)


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Help needed on php/mysql

2004-11-02 Thread Garth Hapgood - Strickland
Well my page doesnt have any of the spoken about elements on it yet, because I am not 
clear as to go about it.

The fields I speak of are things that need to be added extra to my page. 

Here is my pages code so far...

  ?php
  require('includes/application_top.php');
  require('registration_globals.php');
  require('includes/form_check.js.php');
  ?
  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  html
  head
  titleMatchmakers - empowerment opportunities network/title
  meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
  link href=style.css rel=stylesheet type=text/css
  script language=JavaScript type=text/JavaScript

  !--

  function MM_preloadImages() { //v3.0 
  var d=document; if(d.images){ if(!d.MM_p) d .MM_p=new Array();
  var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; ia.length; i++)
  if (a[i].indexOf(#)!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  }

  !-- Hide from old browsers
  function error_popup() {
  newwin = window.open(error_popup.php,sss,height=470,width=450)
  }
  // end hiding --

  //-- 

  /script

  /head
  body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0
  !-- header //--
  ?php require('includes/header.php'); ?
  !-- header_eof //--
  !-- body //--
  table width=100% border=0 cellspacing=2 cellpadding=5 
background=images/page_bg.gif
  tr 
  td valign=toptable width=130
  tr
  td width=120 align=right class=pagetitlebrregistrationimg 
src=images/register_image.gif/td
  /tr
  /table/td 
  td
  table width=100% border=0 cellpadding=0 cellspacing=0
  tr valign=top 
  pbrbrbFill in all the fields below correct and accurately, then click 
Register Now./bbrbr
  /tr
  tr
  tdtable width=65%
  form title=register method=post onsubmit=return check_form();
?php
if (isset($submit)  $submit == Register Now){
  if (strlen($business_name) == 0) {}
  else if (strlen($business_owner) == 0) {}
  else if (strlen($street_address) == 0) {}
  else if (strlen($suburb) == 0) {}
  else if (strlen($city_town) == 0) {}
  else if (strlen($province_desc) == 0) {}

  $email_popup(); (the code i was trying to use to call popup window)
}
else {
  $insertquery = INSERT INTO business
  (BusinessName, BusinessOwner, StreetAdress, Suburb, CityTown, ProvinceID, 
StreetCode, PostalAddress, PostalCode, WebsiteAddress, IndustryID, IndustryOther, 
BusinessAge, AnnualTurnoverID, EmpowermentProfileID, BEEScoreCardID, 
PreferredLocationID, PreferredProductService, PreferredMatchPartner, PreferredAgeID, 
PreferredTurnoverID, PreferredEmpowermentProfileID, DateRegistered, MarketSourceID) 
  VALUES
  ($business_name, $business_owner, $street_address, '', '', '', '', '', '', '', 
'', '', '', '', '', '', '', '', '', '', '', '', '', '',); 

echo Your registration has been submitted; 
}

? 
  tr
  td class=formAreaTitle.: Business Contact Details/td
  /tr
  tr
  td class=main
  table border=0 width=100% cellspacing=4 cellpadding=0 class=formArea
  tr
  td width=45% align=right class=contentBusiness Name:/td
  td width=55%input class=content type=text size=35 maxlength=100 
name=business_name/td
  /tr
  tr
  td width=45% align=right class=contentBusiness Owner:/td
  td width=55%input class=content type=text size=35 maxlength=100 
name=business_owner/td
  /tr
  tr
  td width=45% align=right class=contentStreet Address:/td
  td width=55%input class=content type=text size=35 maxlength=100 
name=street_address/td
  /tr
  tr
  td width=45% align=right class=contentSuburb:/td
  td width=55%input class=content type=text size=35 maxlength=100 
name=suburb/td
  /tr
  tr
  td width=45% align=right class=contentCity/Town:/td
  td width=55%input class=content type=text size=35 maxlength=100 
name=city_town/td
  /tr
  tr
  td width=45% align=right class=contentProvince:/td
  td width=55% 
  select class=content name=province_desc id=selectoption value=-- select 
one --/option
  ?PHP for($x=0;$x$number_provinces;$x++)
  {
  echo('option value='.$rijprovinces[$x][ProvinceID].'');
  echo(''.$rijprovinces[$x][Description].'/option');
  }
  ?
  /select
  /td
  /tr
  tr
  td width=45% align=right class=contentStreet Code:/td
  td width=55%input class=content type=text size=5 maxlength=4 
name=street_code/td
  /tr
  tr
  td width=45% align=right class=contentPostal Address:/td
  td width=55%textarea rows=5 cols=35 class=content 
name=postal_address/textarea/td
  /tr
  tr
  td width=45% align=right class=contentPostal Code:/td
  td width=55%input class=content type=text size=5 maxlength=4 
name=postal_code/td
  /tr
  tr
  td width=45% align=right class=contentWebsite Address:/td
  td width=55%input class=content type=text size=35 maxlength=50 
name=website_address/td
  /tr
  /table
  /td 
  /tr 
  tr
  td class=formAreaTitle.: Business Information/td
  /tr
  tr
  td class=main width=60%
  table border=0 width=100% cellspacing=4 cellpadding=0 class=formArea
  tr
  td width=45% align=right 

Re: [PHP] Help needed on php/mysql

2004-11-02 Thread Lists
Hmmm...I'm not sure I'm following you.  You just want to know how to  
deal with multiple drop down lists?  Or do you want to be able to check  
and make sure all the mandatory selections have been chosen?
-dg
http://www.rexruff.com

On Nov 2, 2004, at 4:58 AM, Garth Hapgood - Strickland wrote:
Well my page doesnt have any of the spoken about elements on it yet,  
because I am not clear as to go about it.

The fields I speak of are things that need to be added extra to my  
page.

Here is my pages code so far...
  ?php
  require('includes/application_top.php');
  require('registration_globals.php');
  require('includes/form_check.js.php');
  ?
  !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  html
  head
  titleMatchmakers - empowerment opportunities network/title
  meta http-equiv=Content-Type content=text/html;  
charset=iso-8859-1
  link href=style.css rel=stylesheet type=text/css
  script language=JavaScript type=text/JavaScript

  !--
  function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d .MM_p=new Array();
  var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0;  
ia.length; i++)
  if (a[i].indexOf(#)!=0){ d.MM_p[j]=new Image;  
d.MM_p[j++].src=a[i];}}
  }

  !-- Hide from old browsers
  function error_popup() {
  newwin = window.open(error_popup.php,sss,height=470,width=450)
  }
  // end hiding --
  //--
  /script
  /head
  body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0
  !-- header //--
  ?php require('includes/header.php'); ?
  !-- header_eof //--
  !-- body //--
  table width=100% border=0 cellspacing=2 cellpadding=5  
background=images/page_bg.gif
  tr
  td valign=toptable width=130
  tr
  td width=120 align=right class=pagetitlebrregistrationimg  
src=images/register_image.gif/td
  /tr
  /table/td
  td
  table width=100% border=0 cellpadding=0 cellspacing=0
  tr valign=top
  pbrbrbFill in all the fields below correct and accurately,  
then click Register Now./bbrbr
  /tr
  tr
  tdtable width=65%
  form title=register method=post onsubmit=return check_form();
?php
if (isset($submit)  $submit == Register Now){
  if (strlen($business_name) == 0) {}
  else if (strlen($business_owner) == 0) {}
  else if (strlen($street_address) == 0) {}
  else if (strlen($suburb) == 0) {}
  else if (strlen($city_town) == 0) {}
  else if (strlen($province_desc) == 0) {}

  $email_popup(); (the code i was trying to use to call popup  
window)
}
else {
  $insertquery = INSERT INTO business
  (BusinessName, BusinessOwner, StreetAdress, Suburb, CityTown,  
ProvinceID, StreetCode, PostalAddress, PostalCode, WebsiteAddress,  
IndustryID, IndustryOther, BusinessAge, AnnualTurnoverID,  
EmpowermentProfileID, BEEScoreCardID, PreferredLocationID,  
PreferredProductService, PreferredMatchPartner, PreferredAgeID,  
PreferredTurnoverID, PreferredEmpowermentProfileID, DateRegistered,  
MarketSourceID)
  VALUES
  ($business_name, $business_owner, $street_address, '', '', '',  
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',  
'',);

echo Your registration has been submitted;
}
?
  tr
  td class=formAreaTitle.: Business Contact Details/td
  /tr
  tr
  td class=main
  table border=0 width=100% cellspacing=4 cellpadding=0  
class=formArea
  tr
  td width=45% align=right class=contentBusiness Name:/td
  td width=55%input class=content type=text size=35  
maxlength=100 name=business_name/td
  /tr
  tr
  td width=45% align=right class=contentBusiness Owner:/td
  td width=55%input class=content type=text size=35  
maxlength=100 name=business_owner/td
  /tr
  tr
  td width=45% align=right class=contentStreet Address:/td
  td width=55%input class=content type=text size=35  
maxlength=100 name=street_address/td
  /tr
  tr
  td width=45% align=right class=contentSuburb:/td
  td width=55%input class=content type=text size=35  
maxlength=100 name=suburb/td
  /tr
  tr
  td width=45% align=right class=contentCity/Town:/td
  td width=55%input class=content type=text size=35  
maxlength=100 name=city_town/td
  /tr
  tr
  td width=45% align=right class=contentProvince:/td
  td width=55%
  select class=content name=province_desc id=selectoption  
value=-- select one --/option
  ?PHP for($x=0;$x$number_provinces;$x++)
  {
  echo('option value='.$rijprovinces[$x][ProvinceID].'');
  echo(''.$rijprovinces[$x][Description].'/option');
  }
  ?
  /select
  /td
  /tr
  tr
  td width=45% align=right class=contentStreet Code:/td
  td width=55%input class=content type=text size=5  
maxlength=4 name=street_code/td
  /tr
  tr
  td width=45% align=right class=contentPostal Address:/td
  td width=55%textarea rows=5 cols=35 class=content  
name=postal_address/textarea/td
  /tr
  tr
  td width=45% align=right class=contentPostal Code:/td
  td width=55%input class=content type=text size=5  
maxlength=4 name=postal_code/td
  /tr
  tr
  td width=45% align=right class=contentWebsite Address:/td
  td 

Re: [PHP] Help needed on php/mysql {Scanned}

2004-11-02 Thread Garth Hapgood - Strickland
As you can see from my code, I do want to check if all mandatory fields are
selected or filled in. As well as the issue of the communicationtyes.

SO far I do not have fields or anything for the user to use, to select the
different CommunicationTypes he wants. I am not sure how to go about this
because, there is the issue that more than one Destination can be added
for a single CommType. And the number of CommTypes is not fixed and could
vary, so thats why Im not sure how much input fields etc to put on page.

Does this make sense.
Garth


 Hmmm...I'm not sure I'm following you.  You just want to know how to
 deal with multiple drop down lists?  Or do you want to be able to check
 and make sure all the mandatory selections have been chosen?
 -dg
 http://www.rexruff.com

 On Nov 2, 2004, at 4:58 AM, Garth Hapgood - Strickland wrote:

  Well my page doesnt have any of the spoken about elements on it yet,
  because I am not clear as to go about it.
 
  The fields I speak of are things that need to be added extra to my
  page.
 
  Here is my pages code so far...
 
?php
require('includes/application_top.php');
require('registration_globals.php');
require('includes/form_check.js.php');
?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html
head
titleMatchmakers - empowerment opportunities network/title
meta http-equiv=Content-Type content=text/html;
  charset=iso-8859-1
link href=style.css rel=stylesheet type=text/css
script language=JavaScript type=text/JavaScript
 
!--
 
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d .MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0;
  ia.length; i++)
if (a[i].indexOf(#)!=0){ d.MM_p[j]=new Image;
  d.MM_p[j++].src=a[i];}}
}
 
!-- Hide from old browsers
function error_popup() {
newwin = window.open(error_popup.php,sss,height=470,width=450)
}
// end hiding --
 
//--
 
/script
 
/head
body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0
!-- header //--
?php require('includes/header.php'); ?
!-- header_eof //--
!-- body //--
table width=100% border=0 cellspacing=2 cellpadding=5
  background=images/page_bg.gif
tr
td valign=toptable width=130
tr
td width=120 align=right class=pagetitlebrregistrationimg
  src=images/register_image.gif/td
/tr
/table/td
td
table width=100% border=0 cellpadding=0 cellspacing=0
tr valign=top
pbrbrbFill in all the fields below correct and accurately,
  then click Register Now./bbrbr
/tr
tr
tdtable width=65%
form title=register method=post onsubmit=return check_form();
  ?php
  if (isset($submit)  $submit == Register Now){
if (strlen($business_name) == 0) {}
else if (strlen($business_owner) == 0) {}
else if (strlen($street_address) == 0) {}
else if (strlen($suburb) == 0) {}
else if (strlen($city_town) == 0) {}
else if (strlen($province_desc) == 0) {}
 
$email_popup(); (the code i was trying to use to call popup
  window)
  }
  else {
$insertquery = INSERT INTO business
(BusinessName, BusinessOwner, StreetAdress, Suburb, CityTown,
  ProvinceID, StreetCode, PostalAddress, PostalCode, WebsiteAddress,
  IndustryID, IndustryOther, BusinessAge, AnnualTurnoverID,
  EmpowermentProfileID, BEEScoreCardID, PreferredLocationID,
  PreferredProductService, PreferredMatchPartner, PreferredAgeID,
  PreferredTurnoverID, PreferredEmpowermentProfileID, DateRegistered,
  MarketSourceID)
VALUES
($business_name, $business_owner, $street_address, '', '', '',
  '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
  '',);
 
  echo Your registration has been submitted;
  }
 
  ?
tr
td class=formAreaTitle.: Business Contact Details/td
/tr
tr
td class=main
table border=0 width=100% cellspacing=4 cellpadding=0
  class=formArea
tr
td width=45% align=right class=contentBusiness Name:/td
td width=55%input class=content type=text size=35
  maxlength=100 name=business_name/td
/tr
tr
td width=45% align=right class=contentBusiness Owner:/td
td width=55%input class=content type=text size=35
  maxlength=100 name=business_owner/td
/tr
tr
td width=45% align=right class=contentStreet Address:/td
td width=55%input class=content type=text size=35
  maxlength=100 name=street_address/td
/tr
tr
td width=45% align=right class=contentSuburb:/td
td width=55%input class=content type=text size=35
  maxlength=100 name=suburb/td
/tr
tr
td width=45% align=right class=contentCity/Town:/td
td width=55%input class=content type=text size=35
  maxlength=100 name=city_town/td
/tr
tr
td width=45% align=right class=contentProvince:/td
td width=55%
select class=content name=province_desc id=selectoption

Re: [PHP] Help with preg_match_all()

2004-11-01 Thread Klaus Reimer
Curt Zirzow wrote:
And so on.. It's a kind of a template system... well... I need to
create a expression to get all the tags from the HTML with
preg_match_all() in order to have them in a array...
So your looking from something that starts with '{' and continues
while not a ')' ...
  /{([^}]*?)}/
If you are already using the ? meta character then you can simply do this:
/{(.*?)}/
The while not-approch is useful if you don't want to use the ? meta 
character (to be compatible to regex engines which don't support this). 
But then it would look like this:

/{([^}]*)}/
But all these expressions are to lazy for the required work. The tags 
should be matched more exactly using this:

/{$([\w\.]+)}/
This implies that the variable names always begin with a dollar 
character and they can contain upper and lowercase characters, numbers, 
underscores and periods. The variable name must contain at least one 
character, so {$} is not matched.

--
Bye, K http://www.ailis.de/~k/ (FidoNet: 2:240/2188.18)
[A735 47EC D87B 1F15 C1E9  53D3 AA03 6173 A723 E391]
(Finger [EMAIL PROTECTED] to get public key)


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Help needed on php/mysql

2004-11-01 Thread Lists
Seeing the page might help.
On Nov 1, 2004, at 2:52 AM, Garth Hapgood - Strickland wrote:
I have written a registration page in php and have a number of edit 
boxes
and drop-down lists. The lists are pulling data out of their respective
tables, whereas the edit boxes are just for saving data.

Now my main table where all my data is being saved is called Business. 
Onto
this I have a table called BusinessCommunication which has the fields
(BusinessCommunicationID, BusinessID, CommunicationTypeID, 
Destination).

BusinessCommunicationID = Primary Key
BusinessID = Foreign key from Business Table
CommunicationTypeID = Foreign key from CommunicationType table (lists 
all
communication types)
Destination = field where data is stored (tel number, email address or 
fax
number etc)

Now the problem is that I want the person registering to be able to 
select
the Communication Type/s he wants to add and then be able to enter the
relevant information for each selected CommType. There must also be 
ability
to add 2 of the same CommType.

How can I achieve this as simply and affective as possible on my
registration page.
If you have any solutions are need more information. Please let me know
Many thanx
Garth
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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


Re: [PHP] Help with Advanced Guestbook

2004-10-31 Thread Lists
It looks like you can change quite a bit by opening the body.php file 
in the templates folder.  If you are using FP, if you haven't 
already, make sure to set it so it does not affect code.  You might 
want to open that in Notepad to make sure though.

On Oct 31, 2004, at 1:03 PM, Melanie wrote:
I am trying to use Advanced Guestbook in my website 
(www.tracingfootprints.com) but would like to have it match (in style, 
background, etc) the other pages in the site. I've been trying to 
figure out how to do that (with very limited PHP knowledge) without 
success. My site is hosted by Go Daddy on LInux. I'm designing the 
site in FrontPage 2002.
Thanks!
Melanie

--
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] Help with preg_match_all()

2004-10-31 Thread Curt Zirzow
* Thus wrote Francisco Javier Escoppinichi Fernndez:
 Hello people...
 
 I'm relatively a beginner with regular expressions, so I need a little
 help here.. I hope you can help me...

If you read the whole section @ http://php.net/pcre you'll be able
to do this in your sleep.

 
 Ok, I have a HTML file with several tags like this:
 {$base.username}
 {$base.date}
 {$blog.lastpost}
 
 And so on.. It's a kind of a template system... well... I need to
 create a expression to get all the tags from the HTML with
 preg_match_all() in order to have them in a array...

So your looking from something that starts with '{' and continues
while not a ')' ...

  /{([^}]*?)}/



Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] Help with preg_match_all()

2004-10-31 Thread Francisco Javier Escoppinichi Fernández
Thanks!

Worked like a charm!

*Problem solved*


On Mon, 1 Nov 2004 03:01:12 +, Curt Zirzow
[EMAIL PROTECTED] wrote:
 * Thus wrote Francisco Javier Escoppinichi Fernndez:
  Hello people...
 
  I'm relatively a beginner with regular expressions, so I need a little
  help here.. I hope you can help me...
 
 If you read the whole section @ http://php.net/pcre you'll be able
 to do this in your sleep.
 
 
  Ok, I have a HTML file with several tags like this:
  {$base.username}
  {$base.date}
  {$blog.lastpost}
 
  And so on.. It's a kind of a template system... well... I need to
  create a expression to get all the tags from the HTML with
  preg_match_all() in order to have them in a array...
 
 So your looking from something that starts with '{' and continues
 while not a ')' ...
 
   /{([^}]*?)}/
 
 Curt
 --
 Quoth the Raven, Nevermore.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Francisco Javier Escoppinichi Fernández
Email: [EMAIL PROTECTED]
Web: http://www.fire-dragon.net/
MSN: [EMAIL PROTECTED]
Cel: 044 (612) 348 91 00

Sólo hay 3 cosas que no vuelven atrás: la palabra emitida, la flecha
lanzada y la oportunidad perdida.

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



Re: [PHP] Help needed

2004-10-29 Thread Greg Donald
On Fri, 29 Oct 2004 15:22:29 +0530, suma parakala
[EMAIL PROTECTED] wrote:
   I developed a html form in which I have text box and combo box. Now my
 problem is I have to pass the values of this page to another page. How can i
 pass the values/variables to next page using href
 Kindly help me

You have to submit the form in some way, GET, POST, or a perhaps a
javascript invocation of either.  Once the form is submitted to the
next page, the variables will be available via the $_GET or $_POST
arrays.  You can view these arrays with print_r().  This is the
theory, but if you post your actual code, people will most likely help
you debug it.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



RE: [PHP] Help needed

2004-10-29 Thread Graham Cossey

 Hi
   I developed a html form in which I have text box and combo
 box. Now my
 problem is I have to pass the values of this page to another
 page. How can i
 pass the values/variables to next page using href
 Kindly help me
 Thanks
 Suma

As you've posted to a PHP list I will assume your second page is a PHP page.

Set your FORM action to the second page ie:

FORM name=myForm method=POST action=page2.php
  INPUT type=TEXT name=field1

Then within page2.php all the form fields will be available in the $_POST
array.

$field1 = $_POST['field1'];

You can also use GET in place of POST.

As for using href, well this isn't a form option as far as I am aware. If
you wish to subsequently pass variables using href:

a href=pagex.php?var1=val1var2=val2Link Text/a

--OR--

?php
echo a href=\pagex.php?var1=$var1var2=$var2\Link Text/a;
?

HTH
Graham

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



[PHP] SOLVED Re: [PHP] Help: Database search and results

2004-10-24 Thread Stuart Felenstein
Wow~! I'm getting good.
--- Stuart Felenstein [EMAIL PROTECTED] wrote:

 I have created a database search and results set. 
 Things seem to work fine until I add the join
 statements into the results page query string. 
 If I don't use the joins , the search works great. 
 It
 returns the correct results based on the criteria
 inp..

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



Re: [PHP] Help: Database search and results

2004-10-24 Thread Stuart Felenstein
Ooops, not solved yet.
--- Stuart Felenstein [EMAIL PROTECTED] wrote:

I have created a database search and results set. 
Things seem to work fine until I add the join
statements into the results page query string. 
If I don't use the joins , the search works great.  It
returns the correct results based on the criteria
input. If I add the joins in, then basically all i get
regardless of my search criteria is a complete dump of
every listing.

NOW - I don't expect any suggestions based on my above
question, but was not sure if it was okay to post the
code.  Both pages total about 325 lines.  If it's okay
to post it I will. 

Thank you ,
Stuart

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



Re: [PHP] Help! No output from PHP CLI

2004-10-21 Thread Jason Wong
On Wednesday 20 October 2004 12:06, Warren Guy wrote:

 I'm having a strange problem with command line PHP. Scripts seem to
 function fine, however with no output.

 [EMAIL PROTECTED]:~ php
 ? echo moocows\n; ?
 ^D
 [EMAIL PROTECTED]:~

Try using ?php ... ?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
You auto buy now.
*/

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



RE: [PHP] Help: Suggestions for multi page form validation

2004-10-19 Thread Stuart Felenstein
If it's okay I'll throw out two more questions then.

1-Probably a silly question, but is a faux pas if I
don't do client side [javascript] validations ? 

2a-  Textboxes - provided I'm not allowing special
characters (only alphanumeric) does this alone protect
me from things like sql injections ?

2b- Do selects (menus, dropdowns) need to be validated
for string content.  aka, can crafty hackers turn
these into a way to enter some funky data ?

Thank you ,
Stuart


--- Graham Cossey [EMAIL PROTECTED] wrote:

 Personally I would do as you suggest in 1. I would
 think your users would
 get rather annoyed if they had gone through several
 form pages to be told at
 the end of an error in form page1.
 
 So, page2 validates page1 etc. I would assume that
 page2 already does some
 processing of page1 anyway, as I believe you are
 adding the for.

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



RE: [PHP] Help: Suggestions for multi page form validation

2004-10-19 Thread Graham Cossey
I do not do any javascript validation, and try to avoid it if at all
possible as you cannot guarantee that the client has JavaScript enabled,
much like relying on cookies.

If you are concerned about 'crafty hackers' you'll probably need to check
every form element. You probably also want to check somehow that page2.php
is actually being called from page1.php and not by any other means.

Others on the list are much better equipped to deal with these matters than
I, as I don't currently lock down my application to this degree.

If you have not already, get along to Chris Shiflett's site, it's got some
great info.

http://shiflett.org especially: http://shiflett.org/articles

HTH
Graham

 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
 Sent: 19 October 2004 10:26
 To: Graham Cossey; [EMAIL PROTECTED]
 Subject: RE: [PHP] Help: Suggestions for multi page form validation


 If it's okay I'll throw out two more questions then.

 1-Probably a silly question, but is a faux pas if I
 don't do client side [javascript] validations ?

 2a-  Textboxes - provided I'm not allowing special
 characters (only alphanumeric) does this alone protect
 me from things like sql injections ?

 2b- Do selects (menus, dropdowns) need to be validated
 for string content.  aka, can crafty hackers turn
 these into a way to enter some funky data ?

 Thank you ,
 Stuart


 --- Graham Cossey [EMAIL PROTECTED] wrote:

  Personally I would do as you suggest in 1. I would
  think your users would
  get rather annoyed if they had gone through several
  form pages to be told at
  the end of an error in form page1.
 
  So, page2 validates page1 etc. I would assume that
  page2 already does some
  processing of page1 anyway, as I believe you are
  adding the for.


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



RE: [PHP] Help: Suggestions for multi page form validation

2004-10-19 Thread Stuart Felenstein
Yes, this is a great reminder, as I thought about it.

Man, can one form be so time consuming ? :)

Stuart
--- Graham Cossey [EMAIL PROTECTED] wrote:

 You probably also want to check
 somehow that page2.php
 is actually being called from page1.php and not by
 any other means.
 
 
 HTH
 Graham
 
  -Original Message-
  From: Stuart Felenstein
 [mailto:[EMAIL PROTECTED]
  Sent: 19 October 2004 10:26
  To: Graham Cossey; [EMAIL PROTECTED]
  Subject: RE: [PHP] Help: Suggestions for multi
 page form validation
 
 
  If it's okay I'll throw out two more questions
 then.
 
  1-Probably a silly question, but is a faux pas
 if I
  don't do client side [javascript] validations ?
 
  2a-  Textboxes - provided I'm not allowing special
  characters (only alphanumeric) does this alone
 protect
  me from things like sql injections ?
 
  2b- Do selects (menus, dropdowns) need to be
 validated
  for string content.  aka, can crafty hackers turn
  these into a way to enter some funky data ?
 
  Thank you ,
  Stuart

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



RE: [PHP] Help With Error

2004-10-19 Thread php-list
Pablo,

Thanks for responding. I found out what the problem was. There was an
argument that was empty (i.e. empty string) in the add_cat() method. Thanks
for your help, I really appreciate it.  :)

[snip]
Notice: Undefined index: 0 in
L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line
77
[/snip]

It's telling you that $data['0'], which is used twice in your query, is not
a valid index (ie. it doesn't exist) for the $data array.

Why don't you dump the $data array after it is set to see where the problem
is:

$data = $this-get_cat_coord($child);
print_r($data);
die();

Take a look at what comprises the $data array and you should find your
problem.

HTH,

Pablo

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Sunday, October 17, 2004 8:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Help With Error

Hello Everyone,

I keep getting the following errors in my class and I don't know why. Maybe
something has changed in PHP 5.x that I don't know about? Here are the
errors and the methods of that class:

---
Notice: Undefined index: 0 in
L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line
77

Notice: Undefined index: 0 in
L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line
77

Fatal error: Cannot use object of type DB_Error as array in
L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on line
46
---


Line 77 is the 5th line of the following function:


---
function get_ancestors($child) {
// get child's lft  rgt values
$data = $this-get_cat_coord($child);
// get ancestors of child based on child's lft and rgt values
$tree = $this-fetch('SELECT * FROM tree WHERE lft 
'.$data['0']['lft'].' AND rgt  '.$data['0']['rgt'].' ORDER BY lft ASC');
return $tree;
}
---


Line 46 is the 3rd line of the following function


---
function get_parent($child) {
$parent = $this-get_ancestors($child);
$parent = $parent[count($parent)-1];
if (count($parent)  0) {
return $parent;
} else {
return 0;
}
}
---


I am calling the following function which calls the other two child
functions above:


---
function add_cat($cat, $addAfterCat_name='', $addAfterCat_lft='') {
if (!$this-exists_in_category($cat, $addAfterCat_name)) {
$db = $this-dbconnect();
if ($cat != ''  $addAfterCat_lft != '') {
$db-query(UPDATE tree SET rgt=rgt+2 WHERE
rgt.$addAfterCat_lft);
$db-query(UPDATE tree SET lft=lft+2 WHERE
lft.$addAfterCat_lft);
$add_query = INSERT INTO tree SET lft=';
$add_query .= $addAfterCat_lft+1;
$add_query .= ', rgt=';
$add_query .= $addAfterCat_lft+2;
$add_query .= ', category='$cat';
echo $add_query;
$db-query($add_query);
$message = 'Category Added To Tree';
} elseif ($cat != ''  $addAfterCat_lft == '') {
$message = 'Please Input A Category To Add';
} elseif ($cat == ''  $addAfterCat_lft != '') {
$message = 'Please Choose A Category To Add This Category
To';
}
} else {
$message = 'Category Already Exists In The Parent Category';
}
return $message;
}
---

What am I doing wrong?

-- 
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] Help! No output from PHP CLI

2004-10-19 Thread Matthew Sims
 Hi all,

 I'm having a strange problem with command line PHP. Scripts seem to
 function fine, however with no output.

 [EMAIL PROTECTED]:~ php
 ? echo moocows\n; ?
 ^D
 [EMAIL PROTECTED]:~

 However works fine on another machine with a seemingly identical php.ini

 [EMAIL PROTECTED]:~ php
 ? echo moocows\n; ?
 ^D
 moocows
 [EMAIL PROTECTED]:~

 Any ideas or suggestions greatly appreciated.

 Regards,

 --
 Warren Guy [EMAIL PROTECTED]
 System Administrator, Family Health Network
 Phone: +61 8 9389 8777 Fax: +61 8 9389 8444

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




Isn't there a --enable-cli option when compiling PHP for command line? If
so, was that included as part of the install?

I saw this site:
http://www.devarticles.com/c/a/PHP/PHP-CLI-and-Cron

-- 
--Matthew Sims
--http://killermookie.org

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



RE: [PHP] Help With Error

2004-10-17 Thread Pablo Gosse
[snip]
Notice: Undefined index: 0 in
L:\localhost\catalog\catalog_0.1.0\includes\classes\tree.class.php on
line
77
[/snip]

It's telling you that $data['0'], which is used twice in your query, is
not a valid index (ie. it doesn't exist) for the $data array.

Why don't you dump the $data array after it is set to see where the
problem is:

$data = $this-get_cat_coord($child);
print_r($data);
die();

Take a look at what comprises the $data array and you should find your
problem.

HTH,

Pablo

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



Re: [PHP] Help with parsing result code

2004-10-15 Thread Matt M.
 I'm setting up a credit card payment app. When I send the information
 through the form I get a result similar to this:
 
 NOT CAPTURED:00:428930479495:NA:1015:9755676331042890:1:1
 
 This is the only data in the result page.
 
 I have never done parsing, and I have no idea of how to get this
 information inerted into variables.
 
 The result data is a series of data separated by ':'
 
 Could anyone please give me a hint as of where to look for information
 on how to do the parsing, or a short sample script?

http://us2.php.net/manual/en/function.preg-split.php

should do it

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



Re: [PHP] Help with parsing result code

2004-10-15 Thread Matt M.
 http://us2.php.net/manual/en/function.preg-split.php
 
 should do it


also http://us2.php.net/explode

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



Re: [PHP] Help with parsing result code

2004-10-15 Thread Carlos Alberto Bazan-Canabal
Thank you Matt and Ed.

I have solved the issue and started looking into parsing and regular
expressions.

Thx

Carlos.


On Fri, 15 Oct 2004 10:57:02 -0500, Matt M. [EMAIL PROTECTED] wrote:
  http://us2.php.net/manual/en/function.preg-split.php
 
  should do it
 
 
 also http://us2.php.net/explode


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



Re: [PHP] Help with sessions problem please

2004-10-14 Thread Jason Wong
On Thursday 14 October 2004 17:35, Graham Cossey wrote:

 A user logs in to my 'site' (script1.php) and I store relevant details in a
 session, all fine. I redirect to another page (script2.php) which checks
 and retrieves certain session values, all fine. My problem is with
 script3.php which happens to be within an iframe in script2.php. When the
 user is automatically passed to that page, from log in, the session details
 are not available but if the user makes a (menu) selection the session
 values are available to script3.php within the iframe. help !

 Simplified code:

 script1.php
 ?php
   session_start();
   [some code]
   $_SESSION['user'] = $_POST['user'];
   [some code]
   $hdr = Location: script2.php?.SID;
   header($hdr);
 ?

Use an absolute URL for header redirects.

You're passing the session id (SID) onto script2 but not to script3, if that's 
the only method by which you're propagating the session id then script3 is 
not going to have a session.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
I appoint you ambassador to Fantasy Island!!!
*/

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



Re: [PHP] Help with sessions problem please

2004-10-14 Thread John Holmes
Graham Cossey wrote:
I'm having a bad day with sessions which hopefully someone can help me with.
A user logs in to my 'site' (script1.php) and I store relevant details in a
session, all fine. I redirect to another page (script2.php) which checks and
retrieves certain session values, all fine. My problem is with script3.php
which happens to be within an iframe in script2.php. When the user is
automatically passed to that page, from log in, the session details are not
available but if the user makes a (menu) selection the session values are
available to script3.php within the iframe. help !
Simplified code:
script1.php
?php
  session_start();
  [some code]
  $_SESSION['user'] = $_POST['user'];
  [some code]
  $hdr = Location: script2.php?.SID;
  header($hdr);
?
script2.php
?php
  session_start();
  if (!isset($_SESSION['user']))
  Header(Location: ../index.htm);  Does not redirect.
  [some code]
  iframe name=content src=script3.php
Your browser does not support the use of frames.
  /ifame
  [some code]
?
script3.php
?php
  session_start();
  print_r($_SESSION);  outputs Array()
  [some code]
?
If you need any specific info on my config just ask and I'll try and supply
it.
You need to use full URLs in your header() redirects, first of all.
header('Location: http://www.example.org/script2.php?.SID);
Is a session cookie being set at all? You redirect to script2 and pass 
the SID in the URL, so that's why the session persists. You're not 
passing the SID in the URL for the source of the iframe leading to 
script3, so the script doesn't know what session to pick up.

Try: iframe name=content src=script3.php??=SID?
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Help with sessions problem please

2004-10-14 Thread Chris Shiflett
--- Jason Wong [EMAIL PROTECTED] wrote:
 Use an absolute URL for header redirects.

Glad to see someone else preaching the good HTTP gospel. :-)
 
 You're passing the session id (SID) onto script2 but not to
 script3, if that's the only method by which you're propagating
 the session id then script3 is not going to have a session.

I think Jason hit the nail on the head with this one, but you might not
understand the answer. While script3.php might seem to be within
script2.php, due to the visual layout you're providing with the iframe,
this is completely independent of the technical implementation, which is
that each is a separate resource.

If that's confusing, think of an iframe as a little embedded browser. If
it fails to properly identify itself (via cookie or URL), then there is no
existing session to resume. Your call to session_start() will actually
create a new session every time script3.php is requested.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004http://httphandbook.org/

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



Re: [PHP] Help with sessions problem please

2004-10-14 Thread Chris Shiflett
--- John Holmes [EMAIL PROTECTED] wrote:
 header('Location: http://www.example.org/script2.php?.SID);

He is human after all. :-)

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004http://httphandbook.org/

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



Re: [PHP] Help with sessions problem please

2004-10-14 Thread Chris Dowell
No
I think it's more likely that one of his tentacles slipped
Chris Shiflett wrote:
--- John Holmes [EMAIL PROTECTED] wrote:
header('Location: http://www.example.org/script2.php?.SID);

He is human after all. :-)
Chris
=
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming December 2004http://httphandbook.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Help with sessions problem please [SOLVED]

2004-10-14 Thread Graham Cossey
Thanks guys for the help, adding SID to my iframe src solved my immediate
problem.

Am I correct in thinking then that the SID is automatically passed on
relative URLs only within the same browser/[i]frame/window when
use_trans_sid is enabled?

Graham

 -Original Message-
 From: Chris Shiflett [mailto:[EMAIL PROTECTED]
 Sent: 14 October 2004 11:03
 To: Jason Wong; [EMAIL PROTECTED]
 Subject: Re: [PHP] Help with sessions problem please


 --- Jason Wong [EMAIL PROTECTED] wrote:
  Use an absolute URL for header redirects.

 Glad to see someone else preaching the good HTTP gospel. :-)

  You're passing the session id (SID) onto script2 but not to
  script3, if that's the only method by which you're propagating
  the session id then script3 is not going to have a session.

 I think Jason hit the nail on the head with this one, but you might not
 understand the answer. While script3.php might seem to be within
 script2.php, due to the visual layout you're providing with the iframe,
 this is completely independent of the technical implementation, which is
 that each is a separate resource.

 If that's confusing, think of an iframe as a little embedded browser. If
 it fails to properly identify itself (via cookie or URL), then there is no
 existing session to resume. Your call to session_start() will actually
 create a new session every time script3.php is requested.

 Hope that helps.

 Chris

 =
 Chris Shiflett - http://shiflett.org/

 PHP Security - O'Reilly HTTP Developer's Handbook - Sams
 Coming December 2004http://httphandbook.org/

 --
 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] Help with sessions problem please

2004-10-14 Thread John Holmes
Chris Shiflett wrote:
--- John Holmes [EMAIL PROTECTED] wrote:
header('Location: http://www.example.org/script2.php?.SID);
He is human after all. :-)
That's just a rumour' I started...
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Help Me Understand PHP5, register_globals=off, $HTTP_POST_VARS, and $_POST

2004-10-13 Thread Jason Wong
On Wednesday 13 October 2004 15:08, Francis Chang wrote:

[snip]

 access the post variables.  My question is, is the $HTTP_POST_VARS global
 still populated for backwards compatibility?  In other words, if I have an
 old script that has the following piece of code running on a PHP5.0
 environment with register_globals off (after submission of a form), would
 it still work as expected?

 Function someFunction($variable) {
   global $HTTP_POST_VARS;

   return IsSet($HTTP_POST_VARS[$variable])

 }

manual  Appendix B. Migrating from PHP 4 to PHP 5

see section New Directives.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
There are more dead people than living, and their numbers are increasing.
-- Eugene Ionesco
*/

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



Re: [PHP] help me to get out of this mass mailing

2004-10-09 Thread Matt M.
 I'm implementing mass mailing program...as there are hundred's of users that receive 
 mails...as a result i'm getting this error...
 
 Fatal error: Maximum execution time of 30 seconds exceeded in 
 d:\phpsites\ac\asc\acendo on line 42

take a look at 

http://us4.php.net/manual/en/ref.info.php#ini.max-execution-time

you need to bump it up

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



Re: [PHP] help me to get out of this mass mailing

2004-10-09 Thread Greg Donald
On Sat, 9 Oct 2004 16:41:28 +0530, suneel [EMAIL PROTECTED] wrote:
 I'm implementing mass mailing program...as there are hundred's of users that receive 
 mails...as a result i'm getting this error...
 
 Fatal error: Maximum execution time of 30 seconds exceeded in 
 d:\phpsites\ac\asc\acendo on line 42

This was just discussed in great detail like 2 or 3 days ago.  Did you
try searching the mailing list archives?

http://marc.theaimsgroup.com/?l=php-general


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



RE: [PHP] Help with Array Sorting Please

2004-10-08 Thread Ford, Mike
On 07 October 2004 17:29, Nick Wilson wrote:

 Hi,
 
 If you scroll up the list you'll see another thread of mine, this is
 related. The reason for a new thread is that i've made a lot
 of progress
 but the old was getting really confusing..
 
 Here's the scoop:
 
 I have an array like this:
 
 123 = 1  // each value may have few or many duplicate values 321 = 1
 543 = 2
 432 = 2 // like here, more 2's than 1's see?
 566 = 2
 568 = 2
 999 = 3
 878 = 3
 444 = 3

That's not terribly good, as you are using the unknowns (ip addresses) as keys to 
the knowns (machine IDs).  It would be better keying off the machine IDs, although 
this does lead to a 2-level array; something like:

   array( 1 = array(123),
  2 = array(543, 432, 566, 568),
  3 = array(999, 878, 444)
)

 Now, the keys are not the issue. What i would really like, is for
 that array, to end up like this: 
 
 123 = 1
 543 = 2
 999 = 3
 321 = 1
 432 = 2
 878 = 3
 123 = 1
 566 = 2

OK. So you don't really want an array out of this, but a sequence of machine ID = IP 
address pairs.  Do you want this to cycle ad infinitum, or just until you've hit every 
IP address at least once?  In either case, using my restructured array, I think your 
basic loop looks something like this:

   // don't assume machine IDs are sequential:
   $mach_ids = array_keys($array);

   // this loop may look odd, but can't foreach $array itself as
   // that gives a copy and following code needs original.
   foreach ($mach_ids as $m_id):
  reset($array[$m_id]);
   endforeach

   foreach ($mach_ids as $m_id):
  list(,$ip) = each($array[$m_id]);
  if ($ip===FALSE):
 reset($array[$m_id]);
 list(,$ip) = each($array[$m_id]);
  endif;

  // do stuff with $m_id and $ip

   endforeach;

That's an endless loop -- there's no code in there to terminate it, so if you want to 
stop at some point you'll have to figure out the conditions to test and break out.

Usual disclaimer -- it's off the top of my head and untested!

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 

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



Re: [PHP] Help with Array Sorting Please

2004-10-08 Thread Nick Wilson

* and then Ford, Mike declared
php
  543 = 2
  432 = 2 // like here, more 2's than 1's see?
  566 = 2
  568 = 2
  999 = 3
  878 = 3
  444 = 3
 
 That's not terribly good, as you are using the unknowns (ip addresses) as keys to 
 the knowns (machine IDs).  It would be better keying off the machine IDs, although 
 this does lead to a 2-level array; something like:
 
array( 1 = array(123),
   2 = array(543, 432, 566, 568),
   3 = array(999, 878, 444)
 )

That's exactly what i have Mike, the above was what i had generated in
an attempt to get the ips in sequential machineId order ;-)

So, now im back to square one, do you have a suggestion as to how to
acheive the goal? -

many, many thanks..

-- 
Nick W

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



Re: [PHP] Help with Array Sorting Please

2004-10-08 Thread Nick Wilson

* and then Ford, Mike declared
  543 = 2
  432 = 2 // like here, more 2's than 1's see?
  566 = 2
  568 = 2
  999 = 3
  878 = 3
  444 = 3
 
 That's not terribly good, as you are using the unknowns (ip addresses) as keys to 
 the knowns (machine IDs).  It would be better keying off the machine IDs, although 
 this does lead to a 2-level array; something like:
 
array( 1 = array(123),
   2 = array(543, 432, 566, 568),
   3 = array(999, 878, 444)
 )

That's exactly what i have Mike, the above was what i had generated in
an attempt to get the ips in sequential machineId order ;-)

So, now im back to square one, do you have a suggestion as to how to
acheive the goal? -

many, many thanks..

-- 
Nick W

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



Re: [PHP] Help with Array Sorting Please

2004-10-08 Thread Nick Wilson

* and then Nick Wilson declared
 
 * and then Ford, Mike declared
 php

sorry about the dupes everyone, i changed router today and resent a
whole bunch of stuff b4 i realized it wasnt goint out...
-- 
Nick W

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



Re: [PHP] Help with Array Sorting Please

2004-10-08 Thread M Saleh EG
i'd recommand u to use trees if u got complicated data arrays.

use tree datascturcutres... u could sort n do watever then
or jus queues or stacks depending on what u wanna do

Try PEAR Tree class it might help

Hope that was usefull.


On Fri, 8 Oct 2004 20:13:10 +0200, Nick Wilson [EMAIL PROTECTED] wrote:
 
 * and then Nick Wilson declared
 
  * and then Ford, Mike declared
  php
 
 sorry about the dupes everyone, i changed router today and resent a
 whole bunch of stuff b4 i realized it wasnt goint out...
 
 
 --
 Nick W
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
M.Saleh.E.G
97150-4779817

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



Re: [PHP] Help with Array Sorting Please

2004-10-08 Thread Nick Wilson

* and then M Saleh EG declared
 i'd recommand u to use trees if u got complicated data arrays.
 
 use tree datascturcutres... u could sort n do watever then
 or jus queues or stacks depending on what u wanna do
 
 Try PEAR Tree class it might help
 
 Hope that was usefull.

*very* useful, thankyou so much! ;-)

-- 
Nick W

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



Re: [PHP] Help with Array Sorting Please

2004-10-07 Thread djoseph

 I have an array like this:
 
 123 = 1  // each value may have few or many duplicate values 
 321 = 1
 543 = 2
 432 = 2 // like here, more 2's than 1's see?
 566 = 2
 568 = 2
 999 = 3
 878 = 3
 444 = 3
 
 Now, the keys are not the issue. What i would really like, is for that
 array, to end up like this:
 
 123 = 1
 543 = 2
 999 = 3
 321 = 1
 432 = 2
 878 = 3
 123 = 1
 566 = 2
 
 and so on... 

I didn't see your other thread, but, would sort() help you?  www.php.net/sort

-Dan Joseph

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



RE: [PHP] Help needed Postgresql and PHP

2004-10-05 Thread Warren Vail
Extracting name and addresses from postgres as a comma separated values
CSV file should be doable with postgress utilities or scripts.  Assuming
you have access to a word processor like Microsoft Word, that has a Mail
Merge capability, where your letter can be merged and printed with names
and addresses from your CSV file.

Factors affecting the wisdom of this approach are;
* The volume of letters you expect to print and the printers you expect to
use (bubble jet ink cartridges are expensive).
* If name and address are the only substitutions in the letter.  Greetings,
additional content may require more that a CSV solution.
* Special bulk mail requirements like zip code sort and selections should be
doable in postgres.
* For really large volumes you will need to break down the workload for
multiple printers in a fashion that makes sense.

If you want to reinvent the wheel by developing your own mail merge process,
I would recommend against it, unless there is some significant gain by doing
that.  I'm guessing that your have already considered this, but are looking
for some other solution for some reason that is not apparent to me.

Good Luck,

Warren Vail


-Original Message-
From: suma parakala [mailto:[EMAIL PROTECTED]
Sent: Monday, October 04, 2004 11:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Help needed Postgresql and PHP

Hi
I am developing an application using php and postgresql . My problem is I
need to retrieve name and addresses from table(postgres sql table)  and
print letter (body of letter will be same). Kindly help /Suggest how i can
do this
Thanks
Suma

_
Looking for a soulmate?  http://www.shaadi.com/ptnr.php?ptnr=hmltag Log onto
Shaadi.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] Help with fwrite()

2004-09-15 Thread Nick Wilson

* and then Nick Wilson declared
 Hi all, 
 
 Im trying to delete a line from a file after having first read the line.  
 The file contains a list or urls, one per new line: like this:

BTW, reading the file into an array, shifting off the first element and
rewriting isnt a good option for me as the urls.txt file can be *very*
big...
-- 
Nick W

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



Re: [PHP] Help with fwrite()

2004-09-15 Thread John Holmes
From: Nick Wilson [EMAIL PROTECTED]
Im trying to delete a line from a file after having first read the line.
The file contains a list or urls, one per new line: like this:
[snip]
 fwrite($f, '', strlen($url2use)); // Where is the gotha?
Hmmm... how can you write an empty string with a length?
If you did something like
fwrite($f,str_repeat('x',strlen($url2use));
then you'd overwrite the URL with , though.
You can't just remove part of a file like you remove part of a string. 
You'll need to read (eventually) the entire file and only write back what 
you want to keep.

Now, you said this could be a very large file, so you don't want to read the 
whole thing into memory. That's smart, so maybe using a swap file would be 
handy? Read from file1, if it's a URL you want to keep, then write it to 
file2. rinse, lather, repeat and at the end rename file2 to file1. This way 
you're only reading one line at a time into memory.

Maybe I'm overlooking another obvious method. If so, someone will pop up. :)
---John Holmes... 

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


Re: [PHP] Help with fwrite()

2004-09-15 Thread John Nichel
John Holmes wrote:
From: Nick Wilson [EMAIL PROTECTED]
Im trying to delete a line from a file after having first read the line.
The file contains a list or urls, one per new line: like this:
[snip]
 fwrite($f, '', strlen($url2use)); // Where is the gotha?

Hmmm... how can you write an empty string with a length?
If you did something like
fwrite($f,str_repeat('x',strlen($url2use));
then you'd overwrite the URL with , though.
You can't just remove part of a file like you remove part of a string. 
You'll need to read (eventually) the entire file and only write back 
what you want to keep.

Now, you said this could be a very large file, so you don't want to read 
the whole thing into memory. That's smart, so maybe using a swap file 
would be handy? Read from file1, if it's a URL you want to keep, then 
write it to file2. rinse, lather, repeat and at the end rename file2 to 
file1. This way you're only reading one line at a time into memory.

Maybe I'm overlooking another obvious method. If so, someone will pop 
up. :)

---John Holmes...
Is keeping this info in a db an option?
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Help with fwrite()

2004-09-15 Thread Nick Wilson

* and then John Nichel declared
 John Holmes wrote:
 You can't just remove part of a file like you remove part of a string. 
 You'll need to read (eventually) the entire file and only write back 
 what you want to keep.
 
 Now, you said this could be a very large file, so you don't want to read 
 the whole thing into memory. That's smart, so maybe using a swap file 
 would be handy? Read from file1, if it's a URL you want to keep, then 
 write it to file2. rinse, lather, repeat and at the end rename file2 to 
 file1. This way you're only reading one line at a time into memory.
 
 
 Is keeping this info in a db an option?

Not a good one, no. I've tried to figure a schema for it but it's been a
long time since i did db work ;-)

Speed is key here, it's an app that uses the Google API to fetch
relevant urls, then uses cURL to fetch the pages, and if the user wants,
to POST to that page. A DB would be okay i think but filesystem calls
are just faster aren't they?

Where I fail on the DB schema is getting my head around the relationship
between the data, here's roughly what i need to do if anyone is curious
or might prod me in the right direction...

Each user (must have an id,name clearly) can fetch as many urls as they
wish, those urls get written to the db, then as each url is fetched from
the db it is dealt with with php and deleted from the db.

What if a user gets cut off from the script and a whole bunch of
unwanted urls are in the db though? 

Should the db go like this?

db_urls
url_id | user_id | project_id | url

db_user
user_id | name | whatever

db_project
project_id | user_id

Wow, now i've written it down it seems clearer ;) you guys reckon that's
the right kind of schema (based on what you know from the above..)?

Thanks John Holmes, that's seems pretty neat but i may have been
mistaken, i did a test with 5000 urls (shouldnt get much more than that
at any one time) and the memory usage wasnt so bad at all...

-- 
Nick W

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



Re: [PHP] Help with fwrite()

2004-09-15 Thread John Holmes
From: Nick Wilson [EMAIL PROTECTED]
Each user (must have an id,name clearly) can fetch as many urls as they
wish, those urls get written to the db, then as each url is fetched from
the db it is dealt with with php and deleted from the db.
What if a user gets cut off from the script and a whole bunch of
unwanted urls are in the db though?
Should the db go like this?
db_urls
url_id | user_id | project_id | url
db_user
user_id | name | whatever
db_project
project_id | user_id
Wow, now i've written it down it seems clearer ;) you guys reckon that's
the right kind of schema (based on what you know from the above..)?
That structure looks good, but it really depends upon what dealt with by 
PHP means.

As for the user getting cut off with urls still in the DB... it shouldn't be 
an issue, but again it depends on what dealt with by PHP means.

---John Holmes... 

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


Re: [PHP] Help with fwrite()

2004-09-15 Thread Nick Wilson

* and then John Holmes declared
 Should the db go like this?
 
 db_urls
 url_id | user_id | project_id | url
 
 db_user
 user_id | name | whatever
 
 db_project
 project_id | user_id
 
 Wow, now i've written it down it seems clearer ;) you guys reckon that's
 the right kind of schema (based on what you know from the above..)?
 
 That structure looks good, but it really depends upon what dealt with by 
 PHP means.

Well, the url is fetched into a variable by cURL, i then do a whole
bunch of stuff with that variable with regex and wotnot, then the user
decides if they want to post to that url, or discard it. Either way, the
result is the url is deleted from the db_url (and now i think more about
it, written to db_url_done - or a flag put on db_url (that's better i
think))

 As for the user getting cut off with urls still in the DB... it shouldn't 

Yeah, i realized that the moment i sent the mail ;-) they should be able
to pick up with a project right where they left off

my thanks, always good to get your schema cheked out by more
knowledgable folk

-- 
Nick W

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



RE: [PHP] Help With PEAR::DB Connection

2004-09-13 Thread php-list
Jim,

Thank you. Problem solved thanks to you. The moment you said that PEAR::DB
is not finding the MySQL extention I realized that the extension in php.ini
hasn't been commented out and the extension folder had not been recognized
by PHP. I forgot we had to do that in PHP5. Everything is working like a
charm now. I really appreciate your time and concern.

Nilaab


P.S. -- And sorry, I'm using Windows XP as the development environment and
Linux as the server. The Windows OS is where I was having the problem.
Thanks again...


-Original Message-
From: James Kaufman [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 11, 2004 7:50 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Help With PEAR::DB Connection

On Sat, Sep 11, 2004 at 01:48:43AM -0500, [EMAIL PROTECTED] wrote:
 Hello everyone,
 
 I have a problem connecting to the Database. When I execute the code at
the
 bottom, it gives me this message: DB Error: extension not found. It sees
 the DB file and the parameters are correct. I checked the include path and
 it was correct. Did I do something wrong? Any help would be greatly
 appreciated. Thank you.
 
 
 require_once 'DB.php';
 $user = 'foo';
 $pass = 'bar';
 $host = 'localhost';
 $db_name = 'clients_db';
 $dsn = mysql://$user:[EMAIL PROTECTED]/$db_name;
 $db = DB::connect($dsn);
 if (DB::isError($db)) {
 die ($db-getMessage());
 }
 
 -- Nilaab
 

The message 'extension not found' means that PEAR couldn't find the mysql db
extension. Hmm. In cases like this, create a phpinfo.php file as documented
on
this list and see what shows up. Or, you can type at the command prompt: php
-i, then look for the MySQL extension in the output.

Also, you neglected to tell us what OS you are running, etc.

-- 
Jim Kaufman
Linux Evangelist
public key 0x6D802619
---
A dog teaches a boy fidelity, perseverance, and to turn around three
times before lying down.
-- Robert Benchley

-- 
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] Help With PEAR::DB Connection

2004-09-11 Thread James Kaufman
On Sat, Sep 11, 2004 at 01:48:43AM -0500, [EMAIL PROTECTED] wrote:
 Hello everyone,
 
 I have a problem connecting to the Database. When I execute the code at the
 bottom, it gives me this message: DB Error: extension not found. It sees
 the DB file and the parameters are correct. I checked the include path and
 it was correct. Did I do something wrong? Any help would be greatly
 appreciated. Thank you.
 
 
 require_once 'DB.php';
 $user = 'foo';
 $pass = 'bar';
 $host = 'localhost';
 $db_name = 'clients_db';
 $dsn = mysql://$user:[EMAIL PROTECTED]/$db_name;
 $db = DB::connect($dsn);
 if (DB::isError($db)) {
 die ($db-getMessage());
 }
 
 -- Nilaab
 

The message 'extension not found' means that PEAR couldn't find the mysql db
extension. Hmm. In cases like this, create a phpinfo.php file as documented on
this list and see what shows up. Or, you can type at the command prompt: php
-i, then look for the MySQL extension in the output.

Also, you neglected to tell us what OS you are running, etc.

-- 
Jim Kaufman
Linux Evangelist
public key 0x6D802619
---
A dog teaches a boy fidelity, perseverance, and to turn around three
times before lying down.
-- Robert Benchley

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



Re: [PHP] help-fetching-url-contents

2004-09-10 Thread John Holmes
From: vijayaraj nagarajan [EMAIL PROTECTED]
i would like to fetch the content of a url.
and then would like to put in my page... dynamically
refreshing it once in a day...
is it possible to do this in php.
i have used perl get url option and then parse the
file, with the date and time function...to do this.
$file = file_get_contents('http://www.domain.com/page.php');
Save $file locally and you have your copy. use cron to run the command once 
per day.

---John Holmes... 

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


[PHP] Re: PHP Help

2004-09-03 Thread Torsten Roehr
Conbud [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hey, Im making a site to where I can fill out a form and it adds updates
to
 the main page, but I only want the site to display 5 updates on it, now I
 know how to make it only show 5 updates, but then that means when a new
 update is posted to the site, it just stores the old updates in the
database
 and over time this can make the database quite large, How would I make it
 delete the oldest update and just add the newest update to the top of the
 list ? So this way I only have 5 updates stored in the database at all
 times.

 Thanks
 ConbuD

Insert your new item, then delete the oldest one:

DELETE FROM table ORDER BY date asc LIMIT 1

Whereas 'date' is your date column.

Regards, Torsten Roehr

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



Re: [PHP] Help with Strings Please

2004-08-31 Thread Marek Kilimajer
Nick Wilson wrote:
Hi, 

I have a string like this, read from an html file: ' VALUE=16'
The value could be any number. I am trying to get that number.
I have this so far, i was hoping someone might tell me how to get that
number:
?php
  $handle = fopen(page.php, r);
  while (!feof($handle)) {
$buffer .= fgets($handle, 4096);
  }
  fclose($handle);
  $result = stristr($buffer, 'NAME=c');
  print (Result:br /.$result);
?
Im not very good at regex, is there an function that would help me?
(couldnt see one...)
thx...
preg_match('/value\s*=\s*([0-9]+)/i', $buffer, $result);
print (Result:br /.$result[1]);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Help with Strings Please

2004-08-31 Thread Justin French
Nick,
Nick wrote:
I have a string like this, read from an html file: ' VALUE=16'
The value could be any number. I am trying to get that number.
If you have that exact string and you want to extract just the number, 
then a simple regex to delete all non-numeric characters should 
suffice.

I have this so far, i was hoping someone might tell me how to get that
number:
?php
  $handle = fopen(page.php, r);
  while (!feof($handle)) {
$buffer .= fgets($handle, 4096);
  }
  fclose($handle);
  $result = stristr($buffer, 'NAME=c');
  print (Result:br /.$result);
?
Ok, so I don't see ' VALUE=16' in here anywhere -- I think you need 
to be a lot more descriptive about the source content and what exactly 
you want to extract, and provide a few examples, so that we can cover 
all your bases.

Regular Expressions are _probably_ what you need, but you REALLY need 
to provide a decent description and multiple examples of what you want, 
otherwise we're just wasting time.

---
Justin French
http://indent.com.au
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Help with Strings Please

2004-08-31 Thread John Holmes
From: Marek Kilimajer [EMAIL PROTECTED]
  $handle = fopen(page.php, r);
  while (!feof($handle)) {
$buffer .= fgets($handle, 4096);
  }
  fclose($handle);
file_get_contents() could be helpful here, too...
---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Help with Strings Please

2004-08-31 Thread Nick Wilson

* and then Marek Kilimajer declared
 Im not very good at regex, is there an function that would help me?
 (couldnt see one...)
 
 
 preg_match('/value\s*=\s*([0-9]+)/i', $buffer, $result);
 print (Result:br /.$result[1]);

Marek, you're a star ;-)

I *hate* having to ask someone to do my work, mastering regular
expressions' in going on my christmas wish list! hehe... 

thanks again...

PS: Justin, got it covered. Thanks..


-- 
Nick W

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



RE: [PHP] Help SQLServer connection: What's server_name??

2004-08-13 Thread Fernando Verdu Castillo
 [snip]
 Hi all, that's my first question here, I'm not subscribed.
 
 I'm tring to connect a local DB (Apache+sqlserver2K), but when I execute
 this
 simple example:
 
 ?php
 $conectID = mssql_connect(,SA,);
 mssql_select_db(Northwind);
 $result=mssql_query(select * from products,$numero );
 while ($row=mssql_fetch_array($result)) {
$counter++; $c1=$row[ProductName];
$c2=$row[UnitPrice];
echo ($counter c1: $c1 c2: $c2\n);
 }
 mssql_close($conectID);
 ?
 
 I get: Warning: MS SQL: Unable to connect to server: 
 
 I tried many words in there (): localhost, LOCAL, PCs name, name
 that
 appears in Enterprisa Manager I don't know what word is asking me
 for
 it's a stupid question, I know, but
 [/snip]
 
 Do you know the IP address? You could try 127.0.0.1 if it is the server
 you are working on. If it is a remote server you can get the IP from
 your network admin

Thanks for your answer. I tried (Apache and DB are in the same computer) this
but I get the same error... I have SQLserver2K (personal) installed and it
works fine... What's the matter? I'm thinking on reinstall it, but I'm afraid
that will be a waste of time :(

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



RE: [PHP] Help SQLServer connection: What's server_name??

2004-08-12 Thread Jay Blanchard
[snip]
Hi all, that's my first question here, I'm not subscribed.

I'm tring to connect a local DB (Apache+sqlserver2K), but when I execute
this
simple example:

?php
$conectID = mssql_connect(,SA,);
mssql_select_db(Northwind);
$result=mssql_query(select * from products,$numero );
while ($row=mssql_fetch_array($result)) {
   $counter++; $c1=$row[ProductName];
   $c2=$row[UnitPrice];
   echo ($counter c1: $c1 c2: $c2\n);
}
mssql_close($conectID);
?

I get: Warning: MS SQL: Unable to connect to server: 

I tried many words in there (): localhost, LOCAL, PCs name, name
that
appears in Enterprisa Manager I don't know what word is asking me
for
it's a stupid question, I know, but
[/snip]

Do you know the IP address? You could try 127.0.0.1 if it is the server
you are working on. If it is a remote server you can get the IP from
your network admin

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



Re: [PHP] Help Loading MySQL Extension with PHP5/Apache1.3

2004-08-12 Thread John Holmes
John Holmes wrote:
Okay... I've done this before but can't get it working now. I've got 
PHP5 working correctly, but I'm trying to load the MySQL php_mysql.dll 
file. I'm using Apache 1.3 on Windows XP.
Nevermind... (^((*(*^%%$^% libmysql.dll [EMAIL PROTECTED]@#(## !!! windows 
#*[EMAIL PROTECTED]@!!
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Help Loading MySQL Extension with PHP5/Apache1.3

2004-08-12 Thread Neil Freeman
John Holmes wrote:
***
This Email Has Been Virus Swept
***
Okay... I've done this before but can't get it working now. I've got 
PHP5 working correctly, but I'm trying to load the MySQL php_mysql.dll 
file. I'm using Apache 1.3 on Windows XP.

No matter what I use for extension_dir in php.ini, it can't seem to find 
the file. An error dialog will pop up saying Unable to load dynamic 
library 'c:\php\ext\php_mysql.dll' - The specified module could not be 
found. even though that's where the [EMAIL PROTECTED]@ file is!

I've tried putting the .dll in c:\php and c:\windows\system32, also, but 
I always get the same error even though the path it shows in the error 
is the correct path. I've tried c:/php, c:/php/ext/, c:\php\ext, c:\php, 
blank, etc with and without trailing slashes...

The everyone user has full control over the entire c:\php directory 
and subdirectories.

Any ideas? Going back to PHP4 until I can get this sorted out...
Examples from Apache error log of paths to file apache couldn't find:
'\php\ext\php_mysql.dll'
'c:/php/ext\php_mysql.dll'
'c:/php/ext\php_mysql.dll'
'c:\php\ext\php_mysql.dll'
'c:/php/ext/php_mysql.dll'
'c:\php\ext\php_mysql.dll'
'./php_mysql.dll'
'c:/php/ext/php_mysql.dll'
'c:\php\ext\php_mysql.dll'
'c:/php/ext\php_mysql.dll'
'c:/php/ext\php_mysql.dll'
'\php\ext\php_mysql.dll'
'c:/php/ext/php_mysql.dll'
'c:\windows\system32\php_mysql.dll'
I had a similar problem which I eventually resolved. Here are my settings:
  extension_dir = C:/PHP/ext/
  extension=php_mysql.dll
Remember to copy 'libmysql.dll' to your Windows System directory (e.g. 
C:\Windows\System32\). If I remember correctly I also had to remove PHP 
4's 'php4ts.dll' from the System directory - maybe this was just getting 
PHP5 running though?

Restart Apache and hope for the best.
Neil
This communication is confidential to the intended recipient(s). If you are not 
that person you are not permitted to make use of the information and you are requested 
to notify the sender immediately of its receipt then destroy the copy in your 
possession. Any views or opinions expressed are those of the originator and may not 
represent those of Advanced System Architectures Ltd.
*** This Email Has Been Virus Checked ***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] help with regular expression

2004-07-29 Thread Michael Sims
Barbara Picci wrote:
 I've a script that must strip a string when it find the first word
 containing at least 4 characters; it must print the content of the
 string before that word, that word, a separator and the rest of the
 string.

 I've tried with ereg whit this script ([EMAIL PROTECTED] is the separator):

 ereg( '^([^ ]{4,})(.*)$', $testo, $matches);

 $contents = [EMAIL PROTECTED];

 but it is not the right script because if the strin($testo) is the
 thing is the script doesn't find nothing and doesn't print. For this
 example the right content of $contents must be:

 $contents = the [EMAIL PROTECTED];

 instead of nothing.

I'm more comfortable with the PCRE functions:

$string = the thing is;

if (preg_match('/^(.*?\S{4,})(\s*)(.*)$/', $string, $matches)) {
  $contents = $matches[1].'[EMAIL PROTECTED]'.$matches[3].\n;
  print_r($contents);
}

prints

the [EMAIL PROTECTED]

Your regex is anchoring its search for the first 4 character word to the beginning
of the string, which is probably not what you want.

I'm assuming from your description that you want whitespace that appears after the
first 4 character word to be replaced by the delimiter.  Also you didn't specify
what should happen if the four character word happens to appear at the end of the
string.  Also keep in mind that there are other word boundaries besides simply
whitespace, so you might want to use the \w, \W metacharaters instead of \s
and \S.  See perldoc perlre for more details...

HTH

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



Re: [PHP] Help with a image upload class

2004-07-21 Thread Jason Wong
On Thursday 22 July 2004 11:56, Joe Harman wrote:

 Hello, I was curious if someone would help me alter this class so that
 instead of using it to upload images... I could send it a full URL path
 to an image, and it would save it to my server...

1) I'm not going to change the script for you. Unless you're willing to pay :)

2) Please don't post reams of irrelevant code.

Have a look at the manual  Filesystem Functions. Recent versions of PHP will 
allow you to use functions such as fopen() with a URL.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
He who minds his own business is never unemployed.
*/

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



Re: [PHP] Help - GUI using PHP

2004-07-20 Thread Chris Hayes

  A GUI having a drwable area and a button in a frame is required. The
points colected by drawing in the drawable area needs to be stored in a
datastructure in php. can we do this using php? If so for
displaying graphics what should be done?
  This GUI has to be embedded in a browser and displayed in any clients
machine. Is it possible?
PHP works serverside which means that is can do all sorts of things to a 
page BEFORE it is send to the browser, but not while the page is being 
viewed by the user.

For this drawable area you would need to find something which is able to 
interact, options are javascript with DHTML (taking care to be cross 
browser compatible), java (requires user to install java) and there are 
likely to be more candidates. If you take for instance javascript and DHTML 
for the drawable area, this script can then score the points collected in a 
hidden form which then can be submitted to PHP. PHP can store it in many 
databases or in data files.

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


Re: [PHP] Help on copying part of a text file

2004-07-16 Thread John W. Holmes
C.F. Scheidecker Antunes wrote:
Hello all,
I need some help on the following:
I need to extract a paragraph from a text file that is delimited with a 
--start-paragraph-- and --end-paragraph-- However, after 
--start-paragraph-- there's a blank line that I need to remove.

The delimiter --start-paragraph-- might be one the first line or it 
might be on any middle line of the line. That is, --start-paragraph line 
starts at some point on the file.

Here's na example:
--start-paragraph--
This is a paragraph that I need to extract with a php function and 
return just
the string of it.
--end-paragraph--

After I run the function extract_paragraph($content) I should get the 
string:
function extract_paragraph($content)
{
  $start = '--start-paragraph--';
  $end = '--end-paragraph--';
  preg_match(/$start(.*)$end/s,$content,$matches);
  return trim($matches[1]);
}
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Help Formatting String into URL

2004-07-10 Thread Curt Zirzow
* Thus wrote Ryan Schefke:
 Hi,
 
  
 
 Can someone help me write a short code snippet to format a string to add:
 
  
 
 http://www http://www/   -- if the string is google.com and doesn't have
 http://www http://www/  in front of it

This is really not a good idea to do blindly, what if I was
submitting a site that was  like say.. news.php.net?

you will simply break things.


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



Re: [PHP] help to generate barcodes

2004-07-09 Thread Ewout
- Original Message - 
From: Vicente Vives [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, July 09, 2004 11:42 AM
Subject: [PHP] help to generate barcodes


 Hello everybody,
 
 I'm looking for a way to generate barcodes from the web. I found some
 ActiveX for ASP but i want to generate them using PHP :-)
 
 Do you know how?
 Do you know any library to do it?

Look here: 

http://pear.php.net/package/Image_Barcode


regards,
Ewout

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



Re: [PHP] help me with eregi

2004-07-05 Thread Richard Davey
w ho do you make a eregi so it looks at the var as a single line

If anyone helps you after you posted 15KB of pointless HTML.. twice..
I'll be amazed.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

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



Re: [PHP] help me with eregi

2004-07-05 Thread water_foul
sorry i didn't relise i did that till just now

Richard Davey [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 w ho do you make a eregi so it looks at the var as a single line

 If anyone helps you after you posted 15KB of pointless HTML.. twice..
 I'll be amazed.

 Best regards,

 Richard Davey
 -- 
  http://www.launchcode.co.uk - PHP Development Services
  I am not young enough to know everything. - Oscar Wilde

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



<    4   5   6   7   8   9   10   11   12   13   >