[PHP] ASP guts needs help.

2004-09-22 Thread LW Ellis
I'm new to php, but am familar with ASP.
I have this code to open and read a text file.
What I need is to take out the 'while' and present the data one line at a 
time.
I read up on fgetcsv, but we will be using one text file per record.
I just need to format how it is displayed.

Under fgetcvs there was some code to display records $data[0] and 
1,2,3,4,etc.

Can someone please point me in the right direction?
?php
   if (!($fp = fopen(test.txt, r)))
   exit(Unable to open the input file.);
   while (!feof($fp))
   {
   $buffer = fgets($fp, 1024);
   print $bufferbr\n;
   }
   fclose($fp);
?
Thanx in advance.
Later,
Leon 

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


RE: [PHP] thumbnail of webpage

2004-09-22 Thread Warren Vail
I may have found something, a perl script that with all the appropriate
pieces turns a page into a jpg image.

http://marginalhacks.com/Hacks/html2jpg/

from there resizing using GD is a snap.

Warren Vail

-Original Message-
From: Vail, Warren [mailto:[EMAIL PROTECTED]
Sent: Friday, September 17, 2004 6:48 PM
To: 'Jason Davidson'; Michael Mao; [EMAIL PROTECTED]
Subject: RE: [PHP] thumbnail of webpage

I have been looking into this over the last week and have come up blank as
well.  Doing this manually is simple, point your browser to your URL, and in
windows use altprint Scrn to copy an image of the rendering in the
browser to the scratch-pad, then paste the image into a tool like paint to
cut out the part of the image you want, and use the skew/stretch tool in
paint to create the thumbnail (GD is a good solution as well) saving the
file as a jpg image.

The difficulties with php is that opening the URL with fopen or using CURL
allows getting the content of a page in html form, but provides no bitmap
rendering of all that, let alone allowing JavaScript to alter the
presentation as it would in a browser.

What would be useful, if there were a way to open the URL in an IFRAME, and
with JavaScript somehow capture a bitmap of the rendering of the web page,
perhaps encoding the bitmap as mod64 characters and placing the result in a
textarea for posting as input to a php script.  This was the best solution
that I could come up with but I don't have the skills to make this happen,
yet.  Question for anyone here, is does this sound like a path that might
work?  Can JavaScript access the rendered content of a webpage in window
bitmap form?

In my travels, someone had suggested coding something using mozilla and
invoking it from a php script, but no one has done this yet that I can
determine.

Warren Vail


-Original Message-
From: Jason Davidson [mailto:[EMAIL PROTECTED]
Sent: Friday, September 17, 2004 6:08 PM
To: Michael Mao; [EMAIL PROTECTED]
Subject: Re: [PHP] thumbnail of webpage


First, im not sure how you would capture a snapshot of the page, sinse the
page is rendered by the browser, and php is completely server side.
Possibly there is a way to fopen a page or something, but... i dunno..

as for making thumbnail, using the gd extension, is quite easy. check the
manual for GD.

Jason


Michael Mao [EMAIL PROTECTED] wrote:

 Is there a way to capture a snapshot of a html page and save it as a
 jpg
 using php?

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



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

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

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



[PHP] Solved [PHP] ASP guts needs help.

2004-09-22 Thread LW Ellis
Never mind...
As usual, about the time you ask for help, the brain gets unstuck and you 
find the solution.

Thanx anyways
Leon 

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


Re: [PHP] alternative to mysql_field_name()

2004-09-22 Thread Andrew Kreps
On Tue, 21 Sep 2004 22:01:02 +0100, Luke [EMAIL PROTECTED] wrote:
 however, i'd like to add more meaningful names as the field name
 headings in the excel file. can anyone suggest how i can write a list of
 tab separated headings into $header?
 

If you're talking about hard coding the header, it's not difficult to
do.  Just create an array with your desired field names, and print it
out using the join function.  Something like:

$fields = array ('field1', 'field2', 'field3');
$header = join ($fields, \t) . \n;

I haven't double checked the syntax, but that should be pretty close.

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



Re: [PHP] List Etiquette

2004-09-22 Thread Octavian Rasnita
Michael Sims wrote:
 Octavian Rasnita wrote:
 No, there is no way for customizing the headers Outlook Express use
 to put in the email messages.
 I wish there was, because I don't like them also...
 
 Although I haven't used it personally, OE-QuoteFix may help:
 
 http://home.in.tum.de/~jain/software/oe-quotefix/
 
 I do have experience with Outlook-QuoteFix by the same author and it
 works well. 

Oh cool! I have installed and now the format of the message looks great!
Thanks for telling me about that program.

Teddy

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



[PHP] QUERY_STRING from command line

2004-09-22 Thread Rajesh Batchu
Hi,
 
I am working on a php script which is accessed as below
 
http://10.10.10.10/pageone.php?hellohowareyou
 
in the pageone.php i am accessing the variable $_SERVER[QUERY_STRING 
and i am getting the proper hellohowareyou as value.
 
All these days i was accessing this over the browser. But now i need to POST to this
page from command line. When i am usnig the below logic to post to this page, i am not 
getting any value in the $_SERVER[QUERY_STRING. 
-- 
$usepath=http://10.10.10.10/pageone.php;;
$host=10.10.10.10;
$data=hellohowareyou;
$fp = fsockopen($host, 80, $errno, $errstr, 360);
fputs($fp, POST $usepath HTTP/1.0\n);
$strlength = strlen($data);

fputs($fp, Content-type: application/x-www-form-urlencoded\n);
fputs($fp, Content-length:  . $strlength . \n\n);
fputs($fp, ?$data \n\n);
$output = ;

while (!feof($fp)) {
$output .= fgets($fp, 1024);
}
//print  out put is  $output aaa br ;
//exit;
fclose($fp);

   print $output.aaa\n;
   
 
Can some one suggest me some solution..
 
Thanks in advance
 
Regards,
Rajesh B. 


-
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.

[PHP] md arrays

2004-09-22 Thread Justin French
I have an array that looks something like this:
$cart = Array
(
[0] = Array
(
[id] = LT4697
[qty] = 1
)
[1] = Array
(
[id] = LT4153
[qty] = 3
)
[2] = Array
(
[id] = LT4697
[qty] = 1
)
)
I'm aware that I probably could just have a single dimension array, but 
there's more to be added later, and I prefer to treat this data like 
rows from mysql.

Anyway, what's the *least expensive* way to:
- check if an item (eg LT4153) is in the cart already?
- get the current qty of an item (eg LT4153)
The cart won't be big, so a foreach() on the cart isn't out of 
question, but I'd like to know the *right* way :)

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


[PHP] Re: md arrays

2004-09-22 Thread Niklas Lampén
I suggest you to use something like this as your cart:
  $cart = Array
(
  [LT4697] = Array
(
  [qty] = 1
)
  [LT1234] = Array
(
  [qty] = 2
)
)
So you can easily check with in_array() / is_array() if product is in 
the cart allready.

Niklas

Justin French wrote:
I have an array that looks something like this:
$cart = Array
(
[0] = Array
(
[id] = LT4697
[qty] = 1
)
[1] = Array
(
[id] = LT4153
[qty] = 3
)
[2] = Array
(
[id] = LT4697
[qty] = 1
)
)
I'm aware that I probably could just have a single dimension array, but 
there's more to be added later, and I prefer to treat this data like 
rows from mysql.

Anyway, what's the *least expensive* way to:
- check if an item (eg LT4153) is in the cart already?
- get the current qty of an item (eg LT4153)
The cart won't be big, so a foreach() on the cart isn't out of question, 
but I'd like to know the *right* way :)

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


Re: [PHP] QUERY_STRING from command line

2004-09-22 Thread raditha dissanayake
Rajesh Batchu wrote:
Hi,
I am working on a php script which is accessed as below
http://10.10.10.10/pageone.php?hellohowareyou
in the pageone.php i am accessing the variable $_SERVER[QUERY_STRING 
and i am getting the proper hellohowareyou as value.

All these days i was accessing this over the browser. But now i need to POST to this
page from command line. When i am usnig the below logic to post to this page, i am not 
getting any value in the $_SERVER[QUERY_STRING. 
 

that is because you are not using the query string. POST sends it's data 
in the body of the message and as a part of the url.
try

$usepath=http://10.10.10.10/pageone.php?hellohowareyou;;
and use GET instead of POST.
been a while since I read the RFC but if you use 1.1 i think you have to send the host 
header.

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mysql_connect does not connect

2004-09-22 Thread Jason Wong
On Wednesday 22 September 2004 03:43, Chris Dowell wrote:

 Sam Hobbs wrote:
 I am not assuming; that is why I am asking this question. You really can
  say the same thing except without the emotions. You can simply state the
  fact that as far as you know it is not a PHP problem. It really, really
  helps to keep in mind that it is better to simply state facts. That keeps
  things less emotional and generally keeps things at a more reasonable
  level.

What is ironic is that our protagonist keeps urging everyone to stay rational 
and not go all emotional when throughout the thread he has repeatedly 
demonstrated that it was he who was irrational and emotional.

-- 
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
--
/*
QOTD:
I'll listen to reason when it comes out on CD.
*/

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



Re: [PHP] List Etiquette

2004-09-22 Thread Jason Wong
On Wednesday 22 September 2004 03:41, Andre Dubuc wrote:

 Arrgh! I use Kmail. I click 'Reply' and I get your personal address
 (instead of the correct 'To:' address. Bummer! Gotta spend some energy
 wiping the current 'To:' addrress, type in letter 'p', click auto-complete
 for correct address, and click again. Sigh . . . way too much work for me.

If you already filter your list mail into a folder then simply edit the folder 
properties to associate it with a mailing list. Then you can use the 'l' key 
to reply to list.

-- 
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
--
/*
In the strict scientific sense we all feed on death -- even vegetarians.
-- Spock, Wolf in the Fold, stardate 3615.4
*/

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



Re: [PHP] alternative to mysql_field_name()

2004-09-22 Thread Marek Kilimajer
Luke wrote:
hi there,
i am currently using the following code to loop through the results of a
sql query and extract the field names ($export contains the query
results from the database). the script goes on to place the results in
an excel file.
for ($i = 0; $i  $fields; $i++) {
$header .= mysql_field_name($export, $i) . \t;
} 

however, i'd like to add more meaningful names as the field name
headings in the excel file. can anyone suggest how i can write a list of
tab separated headings into $header?
$header_texts = array('column1' = 'Column One', 'column2' = 'Column Two');
for ($i = 0; $i  $fields; $i++) {
$header .= $header_texts[mysql_field_name($export, $i)] . \t;
}
Or you can use constants:
define('TEXT_HEADER_COLUMN1', 'Column One');
define('TEXT_HEADER_COLUMN2', 'Column Two');
for ($i = 0; $i  $fields; $i++) {
$header .= constant('TEXT_HEADER_' . 
strtoupper(mysql_field_name($export, $i))) . \t;
}

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


[PHP] Does PHP need another mailing list???

2004-09-22 Thread Gerard Samuel
Just wondering.
With the advent of php5 with its OO capabilities, is php-general too
*general* for advanced php5 users?
For me, I've learned quite a lot from listening to others, and participating
in threads on php-general  php-db.
Currently, Im investigating OO theory, and how I can translate it to my 
code.
But with no one to talk to, and no one to listen to,
its going to be a lot more trial and error on my part, fumbling in the dark.
Granted, there a handful of online resources on the net, they are not 
*staffed* (by staffed,
I mean they are not setup to provide 24/7 discussions like how mailing 
lists are).

Wanted to see what others may think about this matter.
Thanks for listening...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] List Etiquette

2004-09-22 Thread Lester Caine
Jason Wong wrote:
Have fun driving on the wrong side of the road.
What side is that? Doesn't it depend on national preference?
Not personal preference for certain.
That depends on if there IS a national preference. Having seen drivers 
in some countries there still seems to be a difference of opinion ;)

So even legal requirements can't enforce some preferred activities, so I 
shall continue to bottom post, or just not quote which ever is 
appropriate :) I have all the messages archived, so I don't need every 
extra copy anyway.

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Does PHP need another mailing list???

2004-09-22 Thread Niklas Lampén
It's wrong to think people here don't know how to code object oriented. 
You can do that with PHP4 too - and you should in many cases.

In some time PHP4 will be old school and PHP5 will be the general one. 
In my oppinion, it's good for not-OO ppl to see how to do things in OO way.

If you have an OO question on your mind, just ask and see if someone 
knows the answer. I'm pretty sure there is a lot of ppl reading this 
list who have coding experience in other OO languages. Many general OO 
questions can be answered by the knowledge in other languages too.

IMHO there is no need for a new list. Spread the word of OO coding and 
the world will be a better place. :)

Niklas

Gerard Samuel wrote:
Just wondering.
With the advent of php5 with its OO capabilities, is php-general too
*general* for advanced php5 users?
For me, I've learned quite a lot from listening to others, and 
participating
in threads on php-general  php-db.
Currently, Im investigating OO theory, and how I can translate it to my 
code.
But with no one to talk to, and no one to listen to,
its going to be a lot more trial and error on my part, fumbling in the 
dark.
Granted, there a handful of online resources on the net, they are not 
*staffed* (by staffed,
I mean they are not setup to provide 24/7 discussions like how mailing 
lists are).

Wanted to see what others may think about this matter.
Thanks for listening...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Solved [PHP] ASP guts needs help.

2004-09-22 Thread Burhan Khalid
LW Ellis wrote:
Never mind...
As usual, about the time you ask for help, the brain gets unstuck and 
you find the solution.
You should post back with a solution (append SOLVED to your subject) so 
that it becomes part of the thread (and archived). This way, next time 
someone else has a similar issue, they can search the archives for the 
post and find the answer.

Not that many people search the archives, but hey -- here's hopin :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Recommendations for php email list managers?

2004-09-22 Thread Dustin Krysak
I am interested in the postfix/php solution as well for a MLM, as well 
as just form processing.

d


I wonder why aren't you using PHP to send the messages via Postfix.
Anyway, he did not say that he was using a platform that can run 
Postfix. If he is using Windows 2000 or later with IIS/Exchange, he 
can actually queue messages much faster than piping to postfix.

--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] flash php

2004-09-22 Thread Dustin Krysak
Can anyone recommend any good tutorials on using flash mx 2004 with PHP 
to display MYsql content using PHP? Including loading and displaying 
JPGs and movies (referenced in the database).

thanks in advance!
d
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Does PHP need another mailing list???

2004-09-22 Thread raditha dissanayake
Gerard Samuel wrote:
Just wondering.
With the advent of php5 with its OO capabilities, is php-general too
*general* for advanced php5 users?
This topic has been discussed at least once a month. Please refer to 
list archives.

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Mohavi

2004-09-22 Thread Chris Dowell
Yeah
I've rebuilt a huge CoOperative Marketing Fund Administration tool using 
version 1.3 or 1.4 (I can't be arsed to look right now).

It's good for what it does - the only problem I have lies in the fact 
that the classes you generate for actions and views are generally quite 
large, and if the code is not tidy it becomes hellishly difficult to 
read. I have a colleague who singlehandedly caused me to pull out most 
of my hair because his normally-inconvenient style of coding was made 
incomprehensible due to the sheer size of some of the classfiles.

Version 2 looks even better, but unfortunately wasn't released when I 
started :(

Hope this helps
Cheers
Chris
p.s. I think the gist of that was that I like Mojavi but not people who 
use it

Greg Donald wrote:
Anyone using this?
http://mojavi.org/
If so, how do you like it?

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


Re: [PHP] inserting timestamp into mysql field

2004-09-22 Thread Chris Dowell
That's not 100% correct
If you have more than one TIMESTAMP field only the first (IIRC) will be 
filled with the current time - other TIMESTAMP fields will only be filed 
if you set them = NULL.

This is true of MySQL  4.1.2 - there is more fine-grained control over 
the behaviour from 4.1.2 onwards.

Note that for  4.1.2 the first TIMESTAMP field will also be 
automatically set on UPDATE.

Hope this helps
Cheers
Chris
Andrew Kreps wrote:
On Tue, 21 Sep 2004 16:25:37 +0100, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
i need to insert a current timestamp into a mysql field when a form is posted.
can anyone suggest a simple way of doing this?

Here's the MySQL answer: If you have a (data type) timestamp field in
your table, you don't need to do anything.  MySQL will automatically
fill it in on insert, and update it when you run an update query.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Image Text

2004-09-22 Thread b2
 imagecolorresolve()
does not make a difference
What other functions is worth playing with

Is there a site where I can download font files (  which I can use in
imageloadfont ()  ) from
I'm after Arial in a few differnt sizes


Greg Donald [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Tue, 21 Sep 2004 19:37:45 +0100, b2 [EMAIL PROTECTED] wrote:
  I'm trying to create images with a bit of text pasted on top
  using the code bolow
  My problem is that the text color either are lost (lighter colors) or
print
  in a different color
  it seems that it's mix the text color and the background color
  Is there away around this
  ?
  $im1=backgroundimage.jpg;
  Header(Content-type: image/jpeg);
  [EMAIL PROTECTED]($im1);
  $red = ImageColorAllocate($src,255,0,0);
  $blue = ImageColorAllocate($src,0,0,255);

 Try imagecolorresolve() instead here.

  also
  where can I find different fonts that I can use in
  imageloadfont ()

 Depends on your system.

 c:\windows\fonts
 /usr/share/fonts/truetype

 is where I've used fonts from previously.


 --
 Greg Donald
 http://gdconsultants.com/
 http://destiney.com/

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



[PHP] how to concatenate php variables in mysql query

2004-09-22 Thread luke
hi,

i'm trying to concatenate two php variables (containing form data) in a mysql
query. i'm currenty using the dot operator:

telphone number =$telcode.$telnumber' 

but only the telcode gets written to the database.

any ideas?

many thanks,

luke m.

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



Re: [PHP] choose upload folder

2004-09-22 Thread Jason Wong
On Wednesday 22 September 2004 05:16, Greg Donald wrote:
 On Tue, 21 Sep 2004 23:05:17 +0200, Joerg P [EMAIL PROTECTED] wrote:
  I am building a script only for local use and would like the user to
  choose a specific folder on his computer, to catalogize all files in
  this folder.
 
  How do I let the user choose this folder?

 input type=file

That would only give the name of a file.

  input type=text

would be more useful. Or perhaps have php generate a list of folders to choose 
from.

-- 
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
--
/*
When a lion meets another with a louder roar,
the first lion thinks the last a bore.
-- G.B. Shaw
*/

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



[PHP] open_basedir restriction and local value for php.ini

2004-09-22 Thread Bogdan Ribic
Hello all,
  I am having problems with cleint's webserver and its open_basedir 
settings. open_basedir is set to folder where all my php files are, but 
when I include a file that already includes another one (all under 
allowed directory tree) it throws out warnings:

Warning: open_basedir restriction in effect. File is in wrong directory 
in /home/www/web14/html/lib/cmember.php on line 3

line 3 of cmember,php has:
require_once lib.php
both cmember and php are in lib directory.
phpinfo() says that local settings for open_basedir is
/home/www/web14
and master settings is empty. It is an older php version, 4.2.2, on SuSe 
Linux.

So... is there anything I can do other than turning off local setting 
for open_basdir. And if there isn't, where do I turn off these settings, 
ie where do you set lolal php.ini values for particular sites?

Thanx in advance.
Boban.
--
Please reply to the list and not to my email directly.
I use usenet server and do not check yahoo email account.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] implode errors if array empty

2004-09-22 Thread luke
hi there,

i am using implode to get the contents of an array into a single variable:

$enterprises = implode(,, $enterprise) //enterprise contains the array.

however, if the array is empty (the user didnt select anything in the form),
the implode function errors out.

can anyone think of a way round this?

many thanks,

luke m.

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



Re: [PHP] implode errors if array empty

2004-09-22 Thread luke
resolved with if(empty()) - apologies.


[EMAIL PROTECTED] wrote:

 hi there,
 
 i am using implode to get the contents of an array into a single variable:
 
 $enterprises = implode(,, $enterprise) //enterprise contains the array.
 
 however, if the array is empty (the user didnt select anything in the form),
 the implode function errors out.
 
 can anyone think of a way round this?
 
 many thanks,
 
 luke m.

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



[PHP] Re: open_basedir restriction and local value for php.ini

2004-09-22 Thread Niklas Lampén
Is the situation this:
/home/a.php includes page /home/lib/b.php which includes /home/lib/c.php?
If I recall correctly, when you include a file in an included file, the 
script is run in the directory where a.php is located. So you need to 
include files based on that directory.

I recommend you to set in a.php variable $RootDir to '/home/' and to do 
all including based on that.

a.php: require($RootDir . 'lib/b.php');
b.php: require($RootDir . 'lib/c.php');
This assumes you never use b.php without including it from a.php. To 
avoid this assuming I use settings file in projects that has to be 
portable and include that file to every single page of the project.

Niklas
Bogdan Ribic wrote:
Hello all,
  I am having problems with cleint's webserver and its open_basedir 
settings. open_basedir is set to folder where all my php files are, but 
when I include a file that already includes another one (all under 
allowed directory tree) it throws out warnings:

Warning: open_basedir restriction in effect. File is in wrong directory 
in /home/www/web14/html/lib/cmember.php on line 3

line 3 of cmember,php has:
require_once lib.php
both cmember and php are in lib directory.
phpinfo() says that local settings for open_basedir is
/home/www/web14
and master settings is empty. It is an older php version, 4.2.2, on SuSe 
Linux.

So... is there anything I can do other than turning off local setting 
for open_basdir. And if there isn't, where do I turn off these settings, 
ie where do you set lolal php.ini values for particular sites?

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


Re: [PHP] List Etiquette

2004-09-22 Thread Jason Wong
On Wednesday 22 September 2004 16:12, Lester Caine wrote:

 That depends on if there IS a national preference. Having seen drivers
 in some countries there still seems to be a difference of opinion ;)

 So even legal requirements can't enforce some preferred activities, 

You're missing the point. If everybody drove every which way they want then 
the result is chaos.

-- 
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
--
/*
Marvelous!  The super-user's going to boot me!
What a finely tuned response to the situation!
*/

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



Re: [PHP] implode errors if array empty

2004-09-22 Thread Petar Nedyalkov
Hello,

I suppose the $enterprise variable doesn't hold an empty array but is not 
defined and because of this you get the error. Test with the following 
example:

?php

$array = array();
$comma_separated = implode(,, $array);

echo $comma_separated;

?

It does not send any errors back. If you substitute $array = array(); with 
$array = ; you'll get a woarning: Warning: implode(): Bad arguments. in 
temp.php on line 4.

Just have in mind that when posting multiple select fields and no options are 
selected - you simply have no corresponding value in the _POST array (or in 
the $enterpise variable if you're using register_globals). There's no empty 
array but nothing defined.

On Wednesday 22 September 2004 13:16, [EMAIL PROTECTED] wrote:
 hi there,

 i am using implode to get the contents of an array into a single variable:

 $enterprises = implode(,, $enterprise) //enterprise contains the array.

 however, if the array is empty (the user didnt select anything in the
 form), the implode function errors out.

 can anyone think of a way round this?

 many thanks,

 luke m.

-- 
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
-
Orbitel - the New Generation Telecom! See www.orbitel.bg.

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



[PHP] Re: open_basedir restriction and local value for php.ini

2004-09-22 Thread Bogdan Ribic
Thanx, but the script works fine with this include structure. I just 
need to get rid of the warnings.

Niklas lampén wrote:
Is the situation this:
/home/a.php includes page /home/lib/b.php which includes /home/lib/c.php?
If I recall correctly, when you include a file in an included file, the 
script is run in the directory where a.php is located. So you need to 
include files based on that directory.

I recommend you to set in a.php variable $RootDir to '/home/' and to do 
all including based on that.

a.php: require($RootDir . 'lib/b.php');
b.php: require($RootDir . 'lib/c.php');
This assumes you never use b.php without including it from a.php. To 
avoid this assuming I use settings file in projects that has to be 
portable and include that file to every single page of the project.

Niklas


--
Please reply to the list and not to my email directly.
I use usenet server and do not check yahoo email account.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: open_basedir restriction and local value for php.ini

2004-09-22 Thread Niklas Lampén
I think my solution will get you rid of the error messages. 
Alternatively you can use ? error_reporting(0); ? to disable errors.

Niklas
Bogdan Ribic wrote:
Thanx, but the script works fine with this include structure. I just 
need to get rid of the warnings.

Niklas lampén wrote:
Is the situation this:
/home/a.php includes page /home/lib/b.php which includes /home/lib/c.php?
If I recall correctly, when you include a file in an included file, 
the script is run in the directory where a.php is located. So you need 
to include files based on that directory.

I recommend you to set in a.php variable $RootDir to '/home/' and to 
do all including based on that.

a.php: require($RootDir . 'lib/b.php');
b.php: require($RootDir . 'lib/c.php');
This assumes you never use b.php without including it from a.php. To 
avoid this assuming I use settings file in projects that has to be 
portable and include that file to every single page of the project.

Niklas


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


Re: [PHP] Does PHP need another mailing list???

2004-09-22 Thread Gerard Samuel
raditha dissanayake wrote:
Gerard Samuel wrote:
Just wondering.
With the advent of php5 with its OO capabilities, is php-general too
*general* for advanced php5 users?

This topic has been discussed at least once a month. Please refer to 
list archives.
I wasn't aware of this.  So I searched MARC using the terms php5 
mailing list, mailing list,
mailing list oop, mailing list another.  I didnt get any relevant hits.
Could you point me to some threads.
Thanks

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


Re: [PHP] Re: Does PHP need another mailing list???

2004-09-22 Thread Gerard Samuel
Niklas Lampén wrote:
It's wrong to think people here don't know how to code object 
oriented. You can do that with PHP4 too - and you should in many cases.

In some time PHP4 will be old school and PHP5 will be the general one. 
In my oppinion, it's good for not-OO ppl to see how to do things in OO 
way.

If you have an OO question on your mind, just ask and see if someone 
knows the answer. I'm pretty sure there is a lot of ppl reading this 
list who have coding experience in other OO languages. Many general OO 
questions can be answered by the knowledge in other languages too.

IMHO there is no need for a new list. Spread the word of OO coding and 
the world will be a better place. :)
You're taking my post out of context.  Im not saying people who 
participate in php-general do
not know how to code object oriented.
In my mind, even if php4 were discontinued today, OO would be too 
*general* for php-general.
Reason why I say that, is because in my mind, OO (especially when 
combined with design patterns)
is a higher language than plain vanilla php.
And that php-general discussions usually revolve around php's plain 
vanilla nuts and bolts.
But I'm not going to pursue this any further, as my original post
was meant as an inquiry and not as an arguement.
Thanks for replying...

Gerard Samuel wrote:
Just wondering.
With the advent of php5 with its OO capabilities, is php-general too
*general* for advanced php5 users?
For me, I've learned quite a lot from listening to others, and 
participating
in threads on php-general  php-db.
Currently, Im investigating OO theory, and how I can translate it to 
my code.
But with no one to talk to, and no one to listen to,
its going to be a lot more trial and error on my part, fumbling in 
the dark.
Granted, there a handful of online resources on the net, they are not 
*staffed* (by staffed,
I mean they are not setup to provide 24/7 discussions like how 
mailing lists are).

Wanted to see what others may think about this matter.
Thanks for listening...

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


[PHP] Get remote servers ip

2004-09-22 Thread Mag
Hi,
I have a textbox where a visitor can enter a site
name/url (eg: http://google.com) and i need to display
that ip on the screen.

how do i get the ipaddress of google.com using PHP? 

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)




__
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] Get remote servers ip

2004-09-22 Thread Eugeni Doljenko
That's very simple. Use gethostbyname() function. Look LXVIII. Network 
Functions for more details.

- Original Message - 
From: Mag [EMAIL PROTECTED]
To: php php [EMAIL PROTECTED]
Sent: Wednesday, September 22, 2004 3:47 PM
Subject: [PHP] Get remote servers ip


Hi,
I have a textbox where a visitor can enter a site
name/url (eg: http://google.com) and i need to display
that ip on the screen.
how do i get the ipaddress of google.com using PHP?
Thanks,
Mag
=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Appended [PHP] Solved [PHP] ASP guy needs help.

2004-09-22 Thread LW Ellis

LW Ellis wrote:
Never mind...
As usual, about the time you ask for help, the brain gets unstuck and you 
find the solution.
You should post back with a solution (append SOLVED to your subject) so 
that it becomes part of the thread (and archived). This way, next time 
someone else has a similar issue, they can search the archives for the 
post and find the answer.

Not that many people search the archives, but hey -- here's hopin :)
My answer I'm sure there are others...
?php
   if (!($fp = fopen(test.txt, r)))
   exit(Unable to open the input file.);
   while (!feof($fp))
  {
  $buffer[] = fgets($fp, 1024);
}
   fclose($fp);
?
// change the [0] to 1,2,3,4,...for each line of the text file you want to 
display.
? echo $buffer[0]?

Leon
PS No I didn't want to while it. 

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


Re: [PHP] Get remote servers ip

2004-09-22 Thread Mag
gethostbyname() of course!!!

Got it, I just forgot the function name.

Thanks,
Mag


--- Eugeni Doljenko [EMAIL PROTECTED] wrote:

 That's very simple. Use gethostbyname() function.
 Look LXVIII. Network 
 Functions for more details.
 
 - Original Message - 
 From: Mag [EMAIL PROTECTED]
 To: php php [EMAIL PROTECTED]
 Sent: Wednesday, September 22, 2004 3:47 PM
 Subject: [PHP] Get remote servers ip
 
 
  Hi,
  I have a textbox where a visitor can enter a site
  name/url (eg: http://google.com) and i need to
 display
  that ip on the screen.
 
  how do i get the ipaddress of google.com using
 PHP?
 
  Thanks,
  Mag
 
  =
  --
  - The faulty interface lies between the chair and
 the keyboard.
  - Creativity is great, but plagiarism is faster!
  - Smile, everyone loves a moron. :-)
 
 
 
 
  __
  Do you Yahoo!?
  New and Improved Yahoo! Mail - 100MB free storage!
  http://promotions.yahoo.com/new_mail
 
  -- 
  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
 
 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] Re: Does PHP need another mailing list???

2004-09-22 Thread Marek Kilimajer
Gerard Samuel wrote:
Niklas Lampén wrote:
It's wrong to think people here don't know how to code object 
oriented. You can do that with PHP4 too - and you should in many cases.

In some time PHP4 will be old school and PHP5 will be the general one. 
In my oppinion, it's good for not-OO ppl to see how to do things in OO 
way.

If you have an OO question on your mind, just ask and see if someone 
knows the answer. I'm pretty sure there is a lot of ppl reading this 
list who have coding experience in other OO languages. Many general OO 
questions can be answered by the knowledge in other languages too.

IMHO there is no need for a new list. Spread the word of OO coding and 
the world will be a better place. :)

You're taking my post out of context.  Im not saying people who 
participate in php-general do
not know how to code object oriented.
In my mind, even if php4 were discontinued today, OO would be too 
*general* for php-general.
Reason why I say that, is because in my mind, OO (especially when 
combined with design patterns)
is a higher language than plain vanilla php.
Then why should it be hosted on php.net?
I think oop-internet-list is what you want.
http://mailman.csce.uark.edu/mailman/listinfo/oop-internet-list
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Get remote servers ip [part 2]

2004-09-22 Thread Mag
Hi again,
Am having a bit of a problem here, basically I have a
text box on my site where the visitor enters a url and
I display that url's ip address...which as Eugeni
kindly pointed out can be easily done with
gethostbyname()...but the problem is the url entered
at my site would be something like:

http://google.com/index.html
or
http://www.google.com/something/more/index.html

and gethostbyname is only displaying the ip if I pass
it something like 
www.google.com

Any idea how i can strip the first 2 examples to get
the format i can pass to gethostbyname() ?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] Appended [PHP] Solved [PHP] ASP guy needs help.

2004-09-22 Thread Marek Kilimajer
LW Ellis wrote:

LW Ellis wrote:
Never mind...
As usual, about the time you ask for help, the brain gets unstuck and 
you find the solution.

You should post back with a solution (append SOLVED to your subject) 
so that it becomes part of the thread (and archived). This way, next 
time someone else has a similar issue, they can search the archives 
for the post and find the answer.

Not that many people search the archives, but hey -- here's hopin :)
My answer I'm sure there are others...
?php
   if (!($fp = fopen(test.txt, r)))
   exit(Unable to open the input file.);
   while (!feof($fp))
  {
  $buffer[] = fgets($fp, 1024);
}
   fclose($fp);
?
// change the [0] to 1,2,3,4,...for each line of the text file you want 
to display.
? echo $buffer[0]?

Leon
PS No I didn't want to while it.
W/out making large array in memory:
$fp = fopen(test.txt, r)
   or die(Unable to open the input file.);
$display_line = 6;
$i=1;
while (($line = fgets($fp, 1024)) !== false  $i  $display_line) $i++;
echo htmlspecialchars($line);
fclose($fp);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] how to concatenate php variables in mysql query

2004-09-22 Thread Jay Blanchard
[snip]
telphone number =$telcode.$telnumber' 

but only the telcode gets written to the database.
[/snip]

There is not enough here to know for sure (I am betting this is part of
a query), but if your code looks like the above you are missing a single
quote after the =. Now, if you enclose the variables in the single
quotes without other manipulation it will probably not work as expected.
Can we see the whole query?

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



RE: [PHP] Re: Does PHP need another mailing list???

2004-09-22 Thread Jay Blanchard
[snip]
Reason why I say that, is because in my mind, OO (especially when 
combined with design patterns) is a higher language than plain vanilla php.
[/snip]

Replace PHP with C++ and you'll see how ridiculous this statement looks. It is as if 
you were pitting PROCEDURAL against OOP, which we know co-exist within the code 
structure of each and every program written that has OO capability.

A seperate list is not needed. However, you could benefit from subscribing to a C++ 
list/newsgroup or an OO list/newsgroup to supplement that which will be (and already 
has been some, search archives for PHP5 with no other qualifier) discussed on this 
list.

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



Re: [PHP] how to concatenate php variables in mysql query

2004-09-22 Thread luke
here is the whole query:

$query = INSERT INTO inmarsat_comp SET date_added=NOW(), prefix='$prefix',
firstname='$firstname', lastname='$lastname', job_title='$jobtitle',
company_name='$company',
no_of_employees='$employees',address_1='$address1',address_2='$address2',
address_3='$address3', town='$town', county ='$county', postcode='$postcode',
country ='$country', telephone_number='$telcode.$telnumber',
fax_number='$faxcode.$faxnumber', email='$email', enterprise='$enterprises',
optin_thirdparty='$distribute', optin_news='$market';

only the telcode gets inserted.

many thanks,

luke m




Jay Blanchard [EMAIL PROTECTED] wrote:

 [snip]
 telphone number =$telcode.$telnumber' 
 
 but only the telcode gets written to the database.
 [/snip]
 
 There is not enough here to know for sure (I am betting this is part of
 a query), but if your code looks like the above you are missing a single
 quote after the =. Now, if you enclose the variables in the single
 quotes without other manipulation it will probably not work as expected.
 Can we see the whole query?
 
 --
 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] Get remote servers ip [part 2]

2004-09-22 Thread Jay Blanchard
[snip]
and gethostbyname is only displaying the ip if I pass
it something like 
www.google.com

Any idea how i can strip the first 2 examples to get
the format i can pass to gethostbyname() ?
[/snip]


Start here ... http://www.php.net/url

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



RE: [PHP] how to concatenate php variables in mysql query

2004-09-22 Thread Jay Blanchard
[snip]
telephone_number='$telcode.$telnumber',

only the telcode gets inserted.
[/snip]

Concat them before placing into the query...(have you echo'd $telnumber
to make sure it is not empty?)

$wholeTelNumber = $telcode . $telnumber;
echo $wholeTelNumber;

telephone_number='$wholeTelNumber',

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



Re: [PHP] Get remote servers ip [part 2]

2004-09-22 Thread John Nichel
Mag wrote:
Hi again,
Am having a bit of a problem here, basically I have a
text box on my site where the visitor enters a url and
I display that url's ip address...which as Eugeni
kindly pointed out can be easily done with
gethostbyname()...but the problem is the url entered
at my site would be something like:
http://google.com/index.html
or
http://www.google.com/something/more/index.html
and gethostbyname is only displaying the ip if I pass
it something like 
www.google.com

Any idea how i can strip the first 2 examples to get
the format i can pass to gethostbyname() ?
It's all in the manual...
http://us4.php.net/manual/en/function.parse-url.php
--
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] how to concatenate php variables in mysql query

2004-09-22 Thread Daniel Kullik
[EMAIL PROTECTED] wrote:
here is the whole query:
$query = INSERT INTO inmarsat_comp SET date_added=NOW(), prefix='$prefix',
firstname='$firstname', lastname='$lastname', job_title='$jobtitle',
company_name='$company',
no_of_employees='$employees',address_1='$address1',address_2='$address2',
address_3='$address3', town='$town', county ='$county', postcode='$postcode',
country ='$country', telephone_number='$telcode.$telnumber',
fax_number='$faxcode.$faxnumber', email='$email', enterprise='$enterprises',
optin_thirdparty='$distribute', optin_news='$market';
only the telcode gets inserted.
many thanks,
luke m

Jay Blanchard [EMAIL PROTECTED] wrote:

[snip]
telphone number =$telcode.$telnumber' 

but only the telcode gets written to the database.
[/snip]
There is not enough here to know for sure (I am betting this is part of
a query), but if your code looks like the above you are missing a single
quote after the =. Now, if you enclose the variables in the single
quotes without other manipulation it will probably not work as expected.
Can we see the whole query?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Hiya.
Hmm... should't the query look like this:
INSERT INTO table (col1, col2, ...) VALUES (val1, val2, ...);
SET is used for UPDATE-queries.
Daniel
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] how to concatenate php variables in mysql query

2004-09-22 Thread John Holmes
From: [EMAIL PROTECTED]
$query = INSERT INTO inmarsat_comp SET date_added=NOW(), 
prefix='$prefix',
firstname='$firstname', lastname='$lastname', job_title='$jobtitle',
company_name='$company',
no_of_employees='$employees',address_1='$address1',address_2='$address2',
address_3='$address3', town='$town', county ='$county', 
postcode='$postcode',
country ='$country', telephone_number='$telcode.$telnumber',
fax_number='$faxcode.$faxnumber', email='$email', 
enterprise='$enterprises',
optin_thirdparty='$distribute', optin_news='$market';

only the telcode gets inserted.
Are you -sure- $telnumber has a value? With that query, you will see both 
the $telcode and the $telnumber in your database, but because of the way 
you're doing it, you'll see the literal period you have in the string, too. 
Now, if telephone_number is a numeric column, everything after the 
non-numeric period character will be truncated (but then why do you have 
quotes).

So, solution is to join the two outside of the query:
$telnum = $telcode . $telnumber
$query =  ... telephone_number = '$telnum' ... ;
or escape out of the string to join them in the query...
$query =  ... = '$country', telephone_number = ' . $telcode . $telnumber . 
', fax_number ... ;

---John Holmes... 

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


Re: [PHP] Does PHP need another mailing list???

2004-09-22 Thread raditha dissanayake
Gerard Samuel wrote:

Just wondering.
With the advent of php5 with its OO capabilities, is php-general too
*general* for advanced php5 users?

This topic has been discussed at least once a month. Please refer to 
list archives.

I wasn't aware of this.  So I searched MARC using the terms php5 
mailing list, mailing list,
mailing list oop, mailing list another.  I didnt get any relevant 
hits.
Could you point me to some threads.
Thanks
I was refering to is php-general too *general* for advanced php5 users 
not specifically at php 5.

We have also discussed whether php-general is an appropriate name for 
the list some people (specially mysql and javascript users) believe it 
should just be named the general list.


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Get remote servers ip [part 2]

2004-09-22 Thread Mag
Hey,
Thanks Jay, I needed a starting point and after
reading  at the url you posted I think I need
parse_url...

Thanks,
Mag

--- Jay Blanchard
[EMAIL PROTECTED] wrote:

 [snip]
 and gethostbyname is only displaying the ip if I
 pass
 it something like 
 www.google.com
 
 Any idea how i can strip the first 2 examples to
 get
 the format i can pass to gethostbyname() ?
 [/snip]
 
 
 Start here ... http://www.php.net/url
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



__
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] Get remote servers ip [part 2]

2004-09-22 Thread Mag
 
 It's all in the manual...
 
 http://us4.php.net/manual/en/function.parse-url.php

Hey John,
Thanks, got it!
-Mag 


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] how to concatenate php variables in mysql query

2004-09-22 Thread Daniel Kullik
Daniel Kullik wrote:
[EMAIL PROTECTED] wrote:
here is the whole query:
$query = INSERT INTO inmarsat_comp SET date_added=NOW(), 
prefix='$prefix',
firstname='$firstname', lastname='$lastname', job_title='$jobtitle',
company_name='$company',
no_of_employees='$employees',address_1='$address1',address_2='$address2',
address_3='$address3', town='$town', county ='$county', 
postcode='$postcode',
country ='$country', telephone_number='$telcode.$telnumber',
fax_number='$faxcode.$faxnumber', email='$email', 
enterprise='$enterprises',
optin_thirdparty='$distribute', optin_news='$market';

only the telcode gets inserted.
many thanks,
luke m

Jay Blanchard [EMAIL PROTECTED] wrote:

[snip]
telphone number =$telcode.$telnumber'
but only the telcode gets written to the database.
[/snip]
There is not enough here to know for sure (I am betting this is part of
a query), but if your code looks like the above you are missing a single
quote after the =. Now, if you enclose the variables in the single
quotes without other manipulation it will probably not work as expected.
Can we see the whole query?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Hiya.
Hmm... should't the query look like this:
INSERT INTO table (col1, col2, ...) VALUES (val1, val2, ...);
SET is used for UPDATE-queries.
Daniel

Argh, sorry. I should have checked to MySQL manual before posting. The syntax 
you're using is also correct. But actually you don't need to concatenate strings 
here. Leave the dots and try it again.

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


Re: [PHP] how to concatenate php variables in mysql query

2004-09-22 Thread Marek Kilimajer
[EMAIL PROTECTED] wrote:
here is the whole query:
$query = INSERT INTO inmarsat_comp SET date_added=NOW(), prefix='$prefix',
firstname='$firstname', lastname='$lastname', job_title='$jobtitle',
company_name='$company',
no_of_employees='$employees',address_1='$address1',address_2='$address2',
address_3='$address3', town='$town', county ='$county', postcode='$postcode',
country ='$country', telephone_number='$telcode.$telnumber',
fax_number='$faxcode.$faxnumber', email='$email', enterprise='$enterprises',
optin_thirdparty='$distribute', optin_news='$market';
only the telcode gets inserted.
I guess telephone_number is type INT, then telephone_number= 
'$telcode.$telnumber'  becomes telephone_number= '555.456545' , which 
is float, converted to int becomes just 555.

You don't need concatenation oparators (.) within doublequoted strings, 
use just telephone_number= '$telcode$telnumber' 

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


Re: [PHP] choose upload folder

2004-09-22 Thread raditha dissanayake
Marek Kilimajer wrote:
Joerg P wrote:
I have to be more specific:
I dont want the file, I want the folder.

This happens on the client side, it has nothing to do with php.
You could possibly do it with signed java applets or activex scripts.
If I may be permitted a shameless plug, Rad Upload is an applet that can 
do just that.

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] implode errors if array empty

2004-09-22 Thread Marek Kilimajer
[EMAIL PROTECTED] wrote:
resolved with if(empty()) - apologies.
isset() is more apropriate as $enterprise is not defined at all, empty() 
will issue a notice.

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


Re: [PHP] implode errors if array empty

2004-09-22 Thread John Holmes
From: Marek Kilimajer [EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:
resolved with if(empty()) - apologies.
isset() is more apropriate as $enterprise is not defined at all, empty() 
will issue a notice.
No it won't. 

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


RE: [PHP] how to concatenate php variables in mysql query

2004-09-22 Thread Yoed Anis
Luke,

MySQL has a built in CONCAT function. This will concat two strings togther.
In your example it would look like telephone_number = CONCAT('$telcode',
'$telnumber') ...

See the MySQL manual for more info on the concat function. Of course using
this function will force the data to be a string.

Yoed

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 22, 2004 7:47 AM
To: Jay Blanchard; [EMAIL PROTECTED]
Subject: Re: [PHP] how to concatenate php variables in mysql query


here is the whole query:

$query = INSERT INTO inmarsat_comp SET date_added=NOW(), prefix='$prefix',
firstname='$firstname', lastname='$lastname', job_title='$jobtitle',
company_name='$company',
no_of_employees='$employees',address_1='$address1',address_2='$address2',
address_3='$address3', town='$town', county ='$county',
postcode='$postcode', country ='$country',
telephone_number='$telcode.$telnumber',
fax_number='$faxcode.$faxnumber', email='$email', enterprise='$enterprises',
optin_thirdparty='$distribute', optin_news='$market';

only the telcode gets inserted.

many thanks,

luke m




Jay Blanchard [EMAIL PROTECTED] wrote:

 [snip]
 telphone number =$telcode.$telnumber'
 
 but only the telcode gets written to the database.
 [/snip]
 
 There is not enough here to know for sure (I am betting this is part 
 of a query), but if your code looks like the above you are missing a 
 single quote after the =. Now, if you enclose the variables in the 
 single quotes without other manipulation it will probably not work as 
 expected. Can we see the whole query?
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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

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



Re: [PHP] Re: Does PHP need another mailing list???

2004-09-22 Thread Gerard Samuel
Marek Kilimajer wrote:
Gerard Samuel wrote:
Niklas Lampén wrote:
It's wrong to think people here don't know how to code object 
oriented. You can do that with PHP4 too - and you should in many cases.

In some time PHP4 will be old school and PHP5 will be the general 
one. In my oppinion, it's good for not-OO ppl to see how to do 
things in OO way.

If you have an OO question on your mind, just ask and see if someone 
knows the answer. I'm pretty sure there is a lot of ppl reading this 
list who have coding experience in other OO languages. Many general 
OO questions can be answered by the knowledge in other languages too.

IMHO there is no need for a new list. Spread the word of OO coding 
and the world will be a better place. :)

You're taking my post out of context.  Im not saying people who 
participate in php-general do
not know how to code object oriented.
In my mind, even if php4 were discontinued today, OO would be too 
*general* for php-general.
Reason why I say that, is because in my mind, OO (especially when 
combined with design patterns)
is a higher language than plain vanilla php.

Then why should it be hosted on php.net?
I think oop-internet-list is what you want.
http://mailman.csce.uark.edu/mailman/listinfo/oop-internet-list
Thanks for the link...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Using '

2004-09-22 Thread Juan Pablo Herrera
Hi!
i have:
$html = '
 html
   MY HTML
 /html
 ';
Inside of my html i used ', this produced a parse error, how can i solved
it?.
Regards,
JP



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



[PHP] Split haystack at nth occurrence of needle?

2004-09-22 Thread Brian Dunning
I've been RTFMing for about an hour and I can't find a string function 
to split haystack 'onebrtwobrthreebrfourbrfive' at the nth 
occurrence of needle 'br'. strpos gives me the position of the first 
needle, and strrpos gives me the position of the last needle. But I'm 
looking for the position of one of the in-between needles, so that I 
can use substr() to trim everything from there on. What very obvious 
function was I unable to find in the manual?

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


[PHP] RE: **[SPAM]** [PHP] Using '

2004-09-22 Thread Jay Blanchard
[snip]
Hi!
i have:
$html = '
 html
   MY HTML
 /html
 ';
Inside of my html i used ', this produced a parse error, how can i
solved
it?.
[/snip]

http://www.php.net/htmlentities

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



Re: [PHP] Using '

2004-09-22 Thread François Moreau
Hi Juan,
   You might consider using the Heredoc syntax, as presented here :
http://www.php.net/manual/en/ 
language.types.string.php#language.types.string.syntax.heredoc

Your code snippet would look like this and do exactly what you had  
intended :

$html = EOD
HTML
YOUR HTML
/HTML
EOD;
François
Le 04-09-22, à 11:55, Juan Pablo Herrera a écrit :
Hi!
i have:
$html = '
 html
   MY HTML
 /html
 ';
Inside of my html i used ', this produced a parse error, how can i  
solved
it?.
Regards,
JP


--
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] Split haystack at nth occurrence of needle?

2004-09-22 Thread Chris Boget
 I've been RTFMing for about an hour and I can't find a string function 
 to split haystack 'onebrtwobrthreebrfourbrfive' at the nth 
 occurrence of needle 'br'. strpos gives me the position of the first 
 needle, and strrpos gives me the position of the last needle. But I'm 
 looking for the position of one of the in-between needles, so that I 
 can use substr() to trim everything from there on. What very obvious 
 function was I unable to find in the manual?

You could use explode().

?
  $string = 'onebrtwobrthreebrfourbrfive';
  $nthPos = 4;

  $tmpArr = explode( 'br', $string );
  $nthString = $tmpArr[($nthPos - 1)];
?

Chris

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



RE: [PHP] simplexml and xpath

2004-09-22 Thread Matthew Sims
 So I've just recently fallen in love with simplexml. But from what I've
 read, is it true that xpath doesn't really work properly?

 I'm using an XML file that has a section like this:

 item
 titleTitle/title
 linkLink/link
 descriptionDesc/description dc:subjectSubject/dc:subject
 dc:date2004-09-20T18:15:00+00:00/dc:date
 /item

 My sample of my PHP code is:

 ?php
 $library = simplexml_load_file('file.rss');
 foreach ($library-item as $item) {
   echo $item-xpath('dc:date');
 }
 ?

 I just want to get the date. Am I doing xpath incorrectly or does xpath
 not
 currently work properly in PHP5?

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


So I figured it out.

?php
$library = simplexml_load_file('file.rss');
foreach ($library-item as $item) {
  list( ,$date) = each($item-xpath('dc:date'));
  echo $date;
}
?

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

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



Re: [PHP] {Spam?} Re: [PHP] Anyone using SPL Iterators?

2004-09-22 Thread John Holmes
Curt Zirzow wrote:
* Thus wrote John Holmes:
A later example implements ArrayAccess and IteratorAggregate and then 
says you can use count($A), but it doesn't work for my tests. It always 
returns 1.

That example i think is minor mistake. As noted in the example
above you have to call pass -getIterator() to count(). count()
doesn't detect if the object if getIterator is present, its just
returns 1 since $A isn't an array.
BUT.. this works:
  echo count( (array)$A );
Yet, even if you use count($A-getIterator()) or cast the object,
the indexes (0,1,2) arn't defined, unlesss you redifine the
offsetGet() to get the proper one.
So is there an implementation so that you can use count() on the 
object and have it treated like an array? i.e. you define what the 
count should return?

The ideal solution, as I understand all of this, would be to have
$A = new ArrayReloaded(array('one','two','three'));
and have count($A) return 3. Do you know how that'd be done?
--
---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] Split haystack at nth occurrence of needle?

2004-09-22 Thread Brian Dunning
?
  $string = 'onebrtwobrthreebrfourbrfive';
  $nthPos = 4;
  $tmpArr = explode( 'br', $string );
  $nthString = $tmpArr[($nthPos - 1)];
?
Thanks Chris, that works great, but it's not doing what I want. I'm 
just trying to get the position of the 3rd occurrence (for example) of 
'br'. So I'm looking for a function that will return the value 19, 
given the above example string.

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


[PHP] header(Location: ) problem

2004-09-22 Thread luke
hi,

is there a way of setting a target property for header(Location:
thanks.htm)?

my form is in an iframe so when i hit submit, my php page redirects the user
to thanks.htm but this is rendered within the iframe not in a fresh page.

any ideas?

thanks,

luke.

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



Re: [PHP] header(Location: ) problem

2004-09-22 Thread John Nichel
[EMAIL PROTECTED] wrote:
hi,
is there a way of setting a target property for header(Location:
thanks.htm)?
No.  Not in php.
--
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] header(Location: ) problem

2004-09-22 Thread Marek Kilimajer
[EMAIL PROTECTED] wrote:
hi,
is there a way of setting a target property for header(Location:
thanks.htm)?
my form is in an iframe so when i hit submit, my php page redirects the user
to thanks.htm but this is rendered within the iframe not in a fresh page.
No, you have to use target in the form - forms have target atribute too.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Split haystack at nth occurrence of needle?

2004-09-22 Thread Silvio Porcellana
Hi
if you want the *rest of the string from the nth br*, I think
'preg_match_all' with PREG_OFFSET_CAPTURE can help you (see
http://www.php.net/manual/en/function.preg-match-all.php)

You could do something like:

code
$string = onebrtwobrthreebrfourbrfive;
$count = preg_match_all('/br([^]+)/', $string, $out,
PREG_OFFSET_CAPTURE);
/code

and you will have an array of 2 arrays, where the first one contains the
full pattern matches and the second one contains arrays for each string
matched *and the starting offset* of that string.
Therefore, to know where the 2nd br ends (so we would get 'three') all you
have to do is:
$out[1][1][1] = 14

Just my .2 euros...

Silvio Porcellana

- Original Message - 
From: Brian Dunning [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, September 22, 2004 5:54 PM
Subject: [PHP] Split haystack at nth occurrence of needle?


 I've been RTFMing for about an hour and I can't find a string function
 to split haystack 'onebrtwobrthreebrfourbrfive' at the nth
 occurrence of needle 'br'. strpos gives me the position of the first
 needle, and strrpos gives me the position of the last needle. But I'm
 looking for the position of one of the in-between needles, so that I
 can use substr() to trim everything from there on. What very obvious
 function was I unable to find in the manual?

 Thanks,

 - Brian

 -- 
 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] Using '

2004-09-22 Thread Marek Kilimajer
Juan Pablo Herrera wrote:
Hi!
i have:
$html = '
 html
   MY HTML
 /html
 ';
Inside of my html i used ', this produced a parse error, how can i solved
it?.
Escape it: \'
It must be somewhere in the manual, I think.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Using '

2004-09-22 Thread GH
Just remember to make sure that the closing EOD; is flush with the
left margin an that there are NO spaces and NO other characters to the
left of it or PHP will give you a PARSE error


On Wed, 22 Sep 2004 11:56:54 -0400, François Moreau
[EMAIL PROTECTED] wrote:
 Hi Juan,
You might consider using the Heredoc syntax, as presented here :
 http://www.php.net/manual/en/
 language.types.string.php#language.types.string.syntax.heredoc
 
 Your code snippet would look like this and do exactly what you had
 intended :
 
 $html = EOD
HTML
YOUR HTML
/HTML
 EOD;
 
 François
 
 Le 04-09-22, à 11:55, Juan Pablo Herrera a écrit :
 
 
 
  Hi!
  i have:
  $html = '
   html
 MY HTML
   /html
   ';
  Inside of my html i used ', this produced a parse error, how can i
  solved
  it?.
  Regards,
  JP
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] Split haystack at nth occurrence of needle?

2004-09-22 Thread Robert Cummings
On Wed, 2004-09-22 at 12:31, Brian Dunning wrote:
  ?
$string = 'onebrtwobrthreebrfourbrfive';
$nthPos = 4;
$tmpArr = explode( 'br', $string );
$nthString = $tmpArr[($nthPos - 1)];
  ?
 
 Thanks Chris, that works great, but it's not doing what I want. I'm 
 just trying to get the position of the 3rd occurrence (for example) of 
 'br'. So I'm looking for a function that will return the value 19, 
 given the above example string.

The following should get you going:

function strpos_nth( $hay, $needle, $n=1 )
{
$offset = -1;

if( $n  1 )
{
return false;
}

while( $n--  0 )
{
if( ($offset = strpos( $hay, $needle, $offset + 1 )) === false )
{
return false;
}
}

return $offset;
}

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Split haystack at nth occurrence of needle?

2004-09-22 Thread Janet Valade
Brian Dunning wrote:
Thanks Chris, that works great, but it's not doing what I want. I'm just 
trying to get the position of the 3rd occurrence (for example) of 
'br'. So I'm looking for a function that will return the value 19, 
given the above example string.
From your first post, you just want to remove everything after a 
certain occurrence. I don't understand why explode won't work for you. 
As in,

?
  $string = 'onebrtwobrthreebrfourbrfive';
  $nthPos = 4;
  $tmpArr = explode( 'br', $string );
  $newArr = array_slice($tmpArr,0,$nthPos-1);
  $shortString = implode('br',$newArr);
?
A function that would give you the position to truncate from would be 
shorter. But, I don't seem to be finding that function either. So, the 
above seems like a solution.

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


Re: [PHP] Using '

2004-09-22 Thread Juan Pablo Herrera
Hi!
I solved using adslashes in $html and replace ' with .

Thanks!!
Regards!

JP



 Just remember to make sure that the closing EOD; is flush with the left
 margin an that there are NO spaces and NO other characters to the left
 of it or PHP will give you a PARSE error


 On Wed, 22 Sep 2004 11:56:54 -0400, François Moreau
 [EMAIL PROTECTED] wrote:
 Hi Juan,
You might consider using the Heredoc syntax, as presented here :
 http://www.php.net/manual/en/
 language.types.string.php#language.types.string.syntax.heredoc

 Your code snippet would look like this and do exactly what you had
 intended :

 $html = EOD
HTML
YOUR HTML
/HTML
 EOD;

 François

 Le 04-09-22, à 11:55, Juan Pablo Herrera a écrit :



  Hi!
  i have:
  $html = '
   html
 MY HTML
   /html
   ';
  Inside of my html i used ', this produced a parse error, how can i
  solved
  it?.
  Regards,
  JP
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 



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



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

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



Re: [PHP] Split haystack at nth occurrence of needle?

2004-09-22 Thread Brian Dunning
I don't understand why explode won't work for you.
The explode solution is working. Thanks very much to everyone who 
replied with so much great information!

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


Re: [PHP] ASP guts needs help.

2004-09-22 Thread Andrew Kreps
On Wed, 22 Sep 2004 00:09:01 -0600, LW Ellis [EMAIL PROTECTED] wrote:
 I'm new to php, but am familar with ASP.
 I have this code to open and read a text file.
 What I need is to take out the 'while' and present the data one line at a
 time.
 I read up on fgetcsv, but we will be using one text file per record.
 I just need to format how it is displayed.

I'm afraid I'm a little fuzzy on what you're attempting to do.  Do you
have a text file with CSV data, and you're trying to split that data
into an array, of which you'd like each element displayed on a
separate line?

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



Re: [PHP] inserting timestamp into mysql field

2004-09-22 Thread Andrew Kreps
On Wed, 22 Sep 2004 09:29:21 +0100, Chris Dowell [EMAIL PROTECTED] wrote:
 That's not 100% correct
 
 If you have more than one TIMESTAMP field only the first (IIRC) will be
 filled with the current time - other TIMESTAMP fields will only be filed
 if you set them = NULL.
 

You're absolutely correct about that.  I just tested the behavior on
4.0.20.  Thanks for the caveat.

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



RE: [PHP] ASP guts needs help.

2004-09-22 Thread Daniel Purdy

[snip]

On Wed, 22 Sep 2004 00:09:01 -0600, LW Ellis [EMAIL PROTECTED]
wrote:
 I'm new to php, but am familar with ASP.
 I have this code to open and read a text file.
 What I need is to take out the 'while' and present the data one line 
 at a time. I read up on fgetcsv, but we will be using one text file 
 per record. I just need to format how it is displayed.

I'm afraid I'm a little fuzzy on what you're attempting to do.  Do you
have a text file with CSV data, and you're trying to split that data
into an array, of which you'd like each element displayed on a separate
line?

[/snip]
I'm also a little fuzzy on what you are attempting, but, it sounds to me
like you might wanna check out the fseek function.
http://www.php.net/fseek
HTH!

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



Re: [PHP] Split haystack at nth occurrence of needle?

2004-09-22 Thread Curt Zirzow
* Thus wrote Janet Valade:
 Brian Dunning wrote:
 
 Thanks Chris, that works great, but it's not doing what I want. I'm just 
 trying to get the position of the 3rd occurrence (for example) of 
 'br'. So I'm looking for a function that will return the value 19, 
 given the above example string.
 
 From your first post, you just want to remove everything after a 
 certain occurrence. I don't understand why explode won't work for you. 
 As in,
 
 ?
   $string = 'onebrtwobrthreebrfourbrfive';
   $nthPos = 4;
 
   $tmpArr = explode( 'br', $string );
   $newArr = array_slice($tmpArr,0,$nthPos-1);
   $shortString = implode('br',$newArr);

and the short version:

$shortString = implode('br', explode('br', $string, $nth));



Curt
-- 
The above comments may offend you. flame at will.

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



[PHP] php, mySQL query character problem

2004-09-22 Thread Victor C.
Hi,

I have a query to mysql basically saying:

 $query = select * from table1 where colum1 like '$email%';
//where $email is defined string.

When i  echo $query,  I get  the string : select * from table 1
where colum1 like 'testdata%'

If i copy paste the string into phpMyAdmin SQL, the query executes
successfully and returns one record.

However, when I just do$returnValue = QueryDatabase($query);
  echo
mysql_num_rows($returnValue);
I always get 0 for the # of records.

Does anyone know what causes this?

Also... the value i have for $email is from:
$email=explode(@,$emailAddress);

$email=$email[0];


Thanks,
Victor C.

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



RE: [PHP] php, mySQL query character problem

2004-09-22 Thread Jay Blanchard
[snip]

 $query = select * from table1 where colum1 like '$email%';


$returnValue = QueryDatabase($query);
  
echo mysql_num_rows($returnValue);
I always get 0 for the # of records.
[/snip]

You have not included the code from your QueryDatabase functionso we
would have to have a crystal ball to discern the answer

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



[PHP] Strange errors when PHP script called from CRON

2004-09-22 Thread Pablo Gosse
Hi folks.  I've written a CMS where I work, the publishing guts of which
is executed through a php script called from my crontab every minute.

Every so often (it's happened roughly 17 times since July 22) I get
parse errors in my log file when the scripts run into errors while
executing.

This is very strange, since the code in these files doesn't change, and
some of them are from the fairly ubiquitous ADODB class, and some of
them are from my own.

Below are the errors in my log file, and beneath each the code from the
corresponding line which throws the error.

Parse error: parse error in /u0/path/to/classes/adodb/adodb.inc.php on
line 3382
LINE 3382:  $ADODB_LASTDB = $db;

Parse error: parse error in /u0/path/to/classes/adodb/adodb.inc.php on
line 848
LINE 848:   } else if ($this-_queryID === true) {

Parse error: parse error in /u0/path/to/classes/adodb/adodb-time.inc.php
on line 748
LINE 748:   $dates .=
sprintf('%s%04d',($gmt0)?'+':'-',abs($gmt)/36); break;

Parse error: parse error, expecting `')'' in
/u0/path/to/classes/adodb/adodb-time.inc.php on line 850
LINE 850:   $_month_table_leaf =
array(,31,29,31,30,31,30,31,31,30,31,30,31);

Parse error: parse error, expecting `$' in
/u0/path/to/cmsutilDEV/monitor/cms.monitor.monitor_content.inc.php on
line 77
LINE 77:$commit == true ? $this-conn-CommitTrans() :
$this-conn-RollbackTrans();

Parse error: parse error in
/u0/path/to/cmsutilDEV/monitor/cms.monitor.monitor_content.inc.php on
line 520
LINE 520:   if ($rs-RecordCount() = 1)

Does anyone have any idea why I might be getting these errors?  The code
above, to me at least, doesn't look like it should be throwing parse
errors.

The script which is called by my crontab to start this process executes
every minute, so I find it very strange that I'm getting these sporadic
error messages.

Can any one shed any light on this for me?

Cheers and TIA,

Pablo

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



RE: [PHP] Strange errors when PHP script called from CRON

2004-09-22 Thread Jay Blanchard
[snip]
Does anyone have any idea why I might be getting these errors?  The code
above, to me at least, doesn't look like it should be throwing parse
errors.

The script which is called by my crontab to start this process executes
every minute, so I find it very strange that I'm getting these sporadic
error messages.

Can any one shed any light on this for me?
[/snip]

Perhaps. Could the data being utilized by the code occasionally have
characters that should be escaped, by aren't? Are you escaping all of
the escapable characters, especially quotes, both single and double? 

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



RE: [PHP] Strange errors when PHP script called from CRON

2004-09-22 Thread Pablo Gosse
Jay Blanchard wrote:
 [snip]
 Does anyone have any idea why I might be getting these errors?  The
 code above, to me at least, doesn't look like it should be throwing
 parse errors.  
 
 The script which is called by my crontab to start this process
 executes every minute, so I find it very strange that I'm getting
 these sporadic error messages.  
 
 Can any one shed any light on this for me?
 [/snip]
 
 Perhaps. Could the data being utilized by the code occasionally have
 characters that should be escaped, by aren't? Are you escaping all of
 the escapable characters, especially quotes, both single and double?  

That's what I was thinking initially, but all code that is submitted to
or extracted from the database is encoded using the translation table
from get_html_translation_table plus an additional translation which I
manually apply to replace #039; with \'.

Also, I'm reluctant to think that the problem lies here because once a
page has been scheduled to be published, it is not removed from this
schedule unless the owner of the page does so.

Basically, if a page is scheduled to be published, and some data in the
page caused the error, the error should show up indefinitely, or until
the person has removed the scheduled publishing of the page, since the
page will not be removed from the publishing schedule due to the error
causing the script to stop executing.

Also, if you take a look at the error below in particular,

Parse error: parse error, expecting `')'' in
/u0/path/to/classes/adodb/adodb-time.inc.php on line 850
LINE 850: $_month_table_leaf =
array(,31,29,31,30,31,30,31,31,30,31,30,31);

You'll see that this is a portion of code that utilizes no external data
whatsoever, and is actually in a file (adodb-time.inc.php) which is
never called by my script, but is called internally by ADODB.

In nearly four years of working with PHP, this is the first time I've
ever been completely stumped.

Any other ideas?

Cheers and TIA,

Pablo

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



Re: [PHP] Strange errors when PHP script called from CRON

2004-09-22 Thread Marek Kilimajer
Pablo Gosse wrote:
Jay Blanchard wrote:
[snip]
Does anyone have any idea why I might be getting these errors?  The
code above, to me at least, doesn't look like it should be throwing
parse errors.  

The script which is called by my crontab to start this process
executes every minute, so I find it very strange that I'm getting
these sporadic error messages.  

Can any one shed any light on this for me?
[/snip]
Perhaps. Could the data being utilized by the code occasionally have
characters that should be escaped, by aren't? Are you escaping all of
the escapable characters, especially quotes, both single and double?  

That's what I was thinking initially, but all code that is submitted to
or extracted from the database is encoded using the translation table
from get_html_translation_table plus an additional translation which I
manually apply to replace #039; with \'.
Also, I'm reluctant to think that the problem lies here because once a
page has been scheduled to be published, it is not removed from this
schedule unless the owner of the page does so.
Basically, if a page is scheduled to be published, and some data in the
page caused the error, the error should show up indefinitely, or until
the person has removed the scheduled publishing of the page, since the
page will not be removed from the publishing schedule due to the error
causing the script to stop executing.
Also, if you take a look at the error below in particular,
Parse error: parse error, expecting `')'' in
/u0/path/to/classes/adodb/adodb-time.inc.php on line 850
LINE 850: $_month_table_leaf =
array(,31,29,31,30,31,30,31,31,30,31,30,31);
You'll see that this is a portion of code that utilizes no external data
whatsoever, and is actually in a file (adodb-time.inc.php) which is
never called by my script, but is called internally by ADODB.
In nearly four years of working with PHP, this is the first time I've
ever been completely stumped.
Any other ideas?
Is any of the files updated at all? It could be a race condition, 
happened to me few times - I upload a file to the server, impatiently 
reload the page and get parse error. I reload once again and everything 
is fine.

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


Re: [PHP] Does PHP need another mailing list???

2004-09-22 Thread Kevin Waterson
This one time, at band camp, raditha dissanayake [EMAIL PROTECTED] wrote:


 I was refering to is php-general too *general* for advanced php5 users 
 not specifically at php 5.

No, list works just fine as it is with a mix of the new comer and advanced
users. No need to split in any way.

Kevin


-
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.

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



[PHP] Re: Strange errors when PHP script called from CRON

2004-09-22 Thread Greg Beaver
Pablo Gosse wrote:
The script which is called by my crontab to start this process executes
every minute, so I find it very strange that I'm getting these sporadic
error messages.
Can any one shed any light on this for me?
Does your crontab script use file locking to make sure that it isn't 
accessing a script at the same time as the webserver or another process?

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


Re: [PHP] php, mySQL query character problem

2004-09-22 Thread Curt Zirzow
* Thus wrote Victor C.:
 
 If i copy paste the string into phpMyAdmin SQL, the query executes
 successfully and returns one record.
 
 However, when I just do$returnValue = QueryDatabase($query);
   echo
 mysql_num_rows($returnValue);
 I always get 0 for the # of records.

What does QueryDatabase() do and return?

Curt
-- 
The above comments may offend you. flame at will.

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



Re: [PHP] Split haystack at nth occurrence of needle?

2004-09-22 Thread Curt Zirzow
* Thus wrote Curt Zirzow:
 
 $shortString = implode('br', explode('br', $string, $nth));

ignore this.

Curt
-- 
The above comments may offend you. flame at will.

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



[PHP] Cannot write data in session file

2004-09-22 Thread Bo Deng

I just move the web pages from windows to linux. But the session
variable doesn't work. And I found that in the \tmp directoy, it has
sess_(MD5) file,but with empty contents,just 0 byte.

BTW, I run a linux virtual host under IBM s390. the code works well in windows and 
other linux systems(not virtual host).
 
So how to fix it ?
 
Thank you!




-
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.

Re: [PHP] Does PHP need another mailing list???

2004-09-22 Thread Jason Wong
On Thursday 23 September 2004 03:41, Kevin Waterson wrote:

 No, list works just fine as it is with a mix of the new comer and advanced
 users. No need to split in any way.

I suggest adding another two lists (at least), one for mysql and one for 
javascript ;-)

-- 
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 mean you didn't *know* she was off making lots of little phone companies?
*/

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



RE: [PHP] Does PHP need another mailing list???

2004-09-22 Thread Jay Blanchard
[snip]
 No, list works just fine as it is with a mix of the new comer and
advanced
 users. No need to split in any way.

I suggest adding another two lists (at least), one for mysql and one for

javascript ;-)
[/snip]

Three...Apache

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



Re: [PHP] Does PHP need another mailing list???

2004-09-22 Thread Greg Donald
On Thu, 23 Sep 2004 04:23:18 +0800, Jason Wong [EMAIL PROTECTED] wrote:
 I suggest adding another two lists (at least), one for mysql and one for
 javascript ;-)

php-db exists already.

I don't think anyone would subscribe to php-js, except peeps with questions.


-- 
Greg Donald
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] Does PHP need another mailing list???

2004-09-22 Thread John Nichel
Jay Blanchard wrote:
[snip]
No, list works just fine as it is with a mix of the new comer and
advanced
users. No need to split in any way.

I suggest adding another two lists (at least), one for mysql and one for
javascript ;-)
[/snip]
Three...Apache
Four...Just for flames. ;)
--
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] Does PHP need another mailing list???

2004-09-22 Thread Jay Blanchard
[snip]
On Thu, 23 Sep 2004 04:23:18 +0800, Jason Wong
[EMAIL PROTECTED] wrote:
 I suggest adding another two lists (at least), one for mysql and one
for
 javascript ;-)

php-db exists already.
[/snip]

That's too general, don't you think? :7)

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



RE: [PHP] Cannot write data in session file

2004-09-22 Thread Chris Gregors
1. logon to the linux image.
2. determine the userid that the webserver runs as (for apache, look in httpd.conf)
3. su to that user
4. cd /tmp.
5. touch temp_file.

If the touch works, then contact your sysadm
If the touch doesn't work, contact your sysadm to grant write access to /tmp for the 
user.

-Original Message-
From: Bo Deng [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 22, 2004 12:24 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Cannot write data in session file



I just move the web pages from windows to linux. But the session variable doesn't 
work. And I found that in the \tmp directoy, it has
sess_(MD5) file,but with empty contents,just 0 byte.

BTW, I run a linux virtual host under IBM s390. the code works well in windows and 
other linux systems(not virtual host).
 
So how to fix it ?
 
Thank you!




-
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.

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



Re: [PHP] Does PHP need another mailing list???

2004-09-22 Thread Greg Donald
On Wed, 22 Sep 2004 15:26:01 -0500, Jay Blanchard
[EMAIL PROTECTED] wrote:
 Three...Apache

php-install should cover that.

I think php-oo would be nice however.


-- 
Greg Donald
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] menu mouseover using php and javascript

2004-09-22 Thread Jay Blanchard
[snip]
Does anyone have an idea how I can get the text portion to also use my
variable?
[/snip]

Output the javascript with PHP

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



  1   2   >