[PHP] Setting paths in PHP

2001-05-10 Thread Johan

My question: how do you set a path using php or html?
I need it for the following code:

index.php -

---


data.htm --


Download it now!


---

The PHP includes the data.htm file in the page generated by index.php, but
the link DOWNLOAD.ZIP won't work because that file is in the DATA directory.
How can I set the path to DATA - and after reading the file, set the path
back to the directory where index.php is located?
I'm running Linux.

Thanks in advance, Johan




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




Re: [PHP] Setting paths in PHP

2001-05-10 Thread Johan

Tnx for your help,

Johan




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




[PHP] Re: php_xmldom.dll

2001-12-04 Thread Johan

Antwnhs T. wrote:

> I have a problem with this dll, the dll exists on my hd and php does not
> load it.
> I have win2k pro with iis5, has anyone any kind of solutions ?

Do you remeber to include it in your php.ini file?

Regards,

Johan

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




[PHP] Re: mail function

2001-12-05 Thread Johan

> Is it possible to use php's mail function to send an html formated email
> (one of your pages or a newsletter, whatever...)?  If so, how?

yes...

Make a header called etc.

Content-type: text/html

Regards,

Johan

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




[PHP] Re: HOW to download PHP files without the use of a FTP client

2001-12-07 Thread Johan

> i hav e big problem i need to download some php files without the use of a
> FTP client or other .
> 
> so if you know a solution to my problem please reply

Do you have possibility to use the PHP FTP functions? Or do you not havr 
ftp access??

regards,
Johan

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




[PHP] Re: Remove carriage returns

2001-12-07 Thread Johan

Royw wrote:

> I have a "memo" type field in a form and I am looking for the PHP command
> to strip the carriage returns from the field before inserting into a
> database.

addslashes();
htmlentities(); 

??

Regards,

Johan

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




[PHP] Re: Image problem

2001-12-07 Thread Johan

> I've instaled and cofigured php4 on WinNT with Apache Web server.
> I can't use any fuction of Image manipulation, 'cause I get this error
> message: ImageGif: No GIF support in this PHP build
> In phpinfo() is listed that: gd lib.> enabled, zlib lib.> enabled.
> What do I still miss there?

In the newest version of GD library (think it since about 1.3 or something) 
does support GIF, because GIF is a commerial image format.

Use PNG or JPEG instead. That much better, or find a version with GIF 
support.

You can see what Image formats you GD can use by make a file with follow 
content:


:o)

Regards,

Johan

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




[PHP] Inconsistency session ?

2001-01-30 Thread johan

Dear all,
I got problem with session..
at first script is executed, (which we put session_start at there) 
we got cookies PHPSESSID, and I track it in directory /tmp, and I see it.
at second script is executed (which we put session_start again), we register
some variabel session, and I track it in directory /tmp, there is some
variable stored in file /tmp/sess_xxx
at third script is executed (which we put session_start again), I got new
cookies (new PHPSESSID), and then we lose session variable that registered with
previous session. Why this is happen ?
I develop my application in Mandrake distribution.
We got no problem (with the same script) at Redhat distribution, after I get
first PHPSESSID, I don't got any new PHPSESSID until i close the browser.
Any experience with my problem ?

Best Regards
Johan
-- 
 -'-  
 (o o) 
-ooO--(_)--Ooo-
  (  )/  \( )( ) (  ) ( \( )  Visit us at http://www.pinguind.co.id
 __)(( () ))__(  /__\  )  (   Feel free to contact me at ICQ  #47240718   
(___/ \__/(_)(_)(_)(_)(_)\_) email:[EMAIL PROTECTED]  
---

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




[PHP] mailing with SMTP server requiring authentication

2003-02-02 Thread Johan Köhne
Is it possible and if so, how to send emails through SMTP servers that require 
authentication (logging in)?

Thanks in advance


[PHP] Sort locale problem

2003-06-14 Thread Johan Grönvall
Hi!

I'm trying to sort an array with strings containing swedish characters.
However, the sort order is wrong.

The following code produces "abäåö" while it should be "abåäö".

$list = array("ö", "ä", "a","å","b");
setlocale("LC_ALL","se_SE.ISO8859-1");
usort($list, 'strcoll');

for($i=0;$ihttp://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] method chaining

2002-11-11 Thread Johan Ohlin
If I have understood correctly what you want to do then this will do fine...

$foo->${$foo->get("bar")}->getBaz();

/ Johan

- Original Message -
From: "Terry McBride" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 11, 2002 4:53 PM
Subject: [PHP] method chaining


> Hello,
>
> I have a question about php and OO.  I want to chain methods together
having
> them performed on the results of the following method.  Meaning something
> like $foo->get("bar")->getBaz().
>
> I get the following error from the script bellow.
> Parse error: parse error, unexpected T_OBJECT_OPERATOR, expecting ',' or
';'
> in /usr/local/apache/php/testchain.php on line 47
>
> Anybody know why I can't do this?  Anyway to make it it one statement
> instead of $tmp = $foo->get("bar"); $tmp->getBaz(); -- lame --?
> Is their a config setting or something?
>
> Thanks in advance,
> Terry
>
> 
> class Foo
> {
> var $vector = array();
> function Foo()
> {}
>
> function put($name, $value)
> {
> $this->vector[$name] = $value;
> return $this->vector[$name];
> }
>
> function get($name)
> {
> return $this->vector[$name];
> }
>
> }
>
> class Bar
> {
> var $baz = "";
>
> function Bar() {}
>
> function setBaz($value)
> {
> $this->baz = $value;
> return $this->baz;
> }
> function getBaz()
> {
> return $this->baz;
> }
> }
>
> $bar = new Bar();
> $bar->setBaz("test succeeded");
>
> $foo = new Foo();
> $foo->put("bar", $bar);
>
> echo $foo->get("bar")->getBaz(), "";
>
> ?>
>
>
> --
> 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] [notice] child pid 666 exit signal Segmentation fault (11)

2001-01-13 Thread Johan Björk

My Apache 1.3.12 server with PHP 4.0.4 and MySQL 3.23.27, occationally spits
out a Segmentation fault in the error_log. I'm not entirely sure which page
is being loaded at the time, and I'm not sure of what exactly is being done,
so I thought I'd try to do some tracing with gdb, which I have never ever
used before this date.

Can someone read out any information from this output I've struggled hard to
gather? :-) To me, it seems to be a problem with memory allocation or
something similar, but I'm not sure why since the scripts on the actual
server is not doing anything special really.

I'm running a RedHat 7.0 installation on a 1 ghz Intel box with 512 mb of
ram. Total memory usage is not high. Other servers I have with a much higher
load and also running PHP have never had this problem.

So what does this stuff mean now:

Attempt #1:
=
(gdb) set args -X -f /home/httpd/conf/httpd.conf
(gdb) r
Starting program: /home/httpd/bin/httpd -X -f /home/httpd/conf/httpd.conf

Program received signal SIGSEGV, Segmentation fault.
0x80ef78d in _efree (ptr=0x829a7e0) at zend_alloc.c:212
212 REMOVE_POINTER_FROM_LIST(p);


Attempt #2:
=
(gdb) set args -X -f /home/httpd/conf/httpd.conf
(gdb) r
Starting program: /home/httpd/bin/httpd -X -f /home/httpd/conf/httpd.conf

Program received signal SIGSEGV, Segmentation fault.
0x401ae964 in chunk_alloc (ar_ptr=0x40251ce0, nb=16) at malloc.c:2770
2770malloc.c: No such file or directory.
(gdb) BT
#0  0x401ae964 in chunk_alloc (ar_ptr=0x40251ce0, nb=16) at malloc.c:2770
#1  0x401ae7e6 in __libc_malloc (bytes=8) at malloc.c:2703
#2  0x80eeb88 in virtual_file_ex (state=0xbfff9158, path=0x82dcef4
"header.html", verify_path=0) at tsrm_virtual_cwd.c:307
#3  0x8089842 in expand_filepath (filepath=0x82dcef4 "header.html",
real_path=0x0) at fopen-wrappers.c:977
#4  0x8088370 in php_fopen_and_set_opened_path (path=0x82dcef4
"header.html", mode=0x81b5183 "rb", opened_path=0xbfffb398)
at fopen-wrappers.c:248
#5  0x808881a in php_fopen_with_path (filename=0x82dcef4 "header.html",
mode=0x81b5183 "rb", path=0x0,
opened_path=0xbfffb398) at fopen-wrappers.c:399
#6  0x8089647 in php_fopen_url_wrapper (path=0x82dcef4 "header.html",
mode=0x81b5183 "rb", options=1, issock=0xbfffb2a4,
socketd=0xbfffb2a8, opened_path=0xbfffb398) at fopen-wrappers.c:899
#7  0x80851ca in php_fopen_wrapper_for_zend (filename=0x82dcef4
"header.html", opened_path=0xbfffb398) at main.c:493
#8  0x81013c6 in open_file_for_scanning (file_handle=0xbfffb390) at
zend-scanner.c:2830
#9  0x81014de in compile_file (file_handle=0xbfffb390, type=2) at
zend-scanner.c:2928
#10 0x810164a in compile_filename (type=2, filename=0x8335ff4) at
zend-scanner.c:2982
#11 0x8121dc0 in execute (op_array=0x830a51c) at ./zend_execute.c:2014
#12 0x80fae0d in zend_execute_scripts (type=8, file_count=3) at zend.c:717
#13 0x8085f5f in php_execute_script (primary_file=0xb790) at main.c:1200
#14 0x8104da0 in apache_php_module_main (r=0x82a90bc, display_source_mode=0)
at sapi_apache.c:89
#15 0x8083a70 in send_php ()
#16 0x8083aa5 in send_parsed_php ()
#17 0x812a1e9 in ap_invoke_handler ()
#18 0x813e39f in process_request_internal ()
#19 0x813e400 in ap_process_request ()
#20 0x813581d in child_main ()
#21 0x81359c8 in make_child ()
#22 0x8135b38 in startup_children ()
#23 0x8136176 in standalone_main ()
#24 0x81369b7 in main ()
#25 0x4014fb65 in __libc_start_main (main=0x8136610 , argc=4,
ubp_av=0xbb14, init=0x806afec <_init>,
fini=0x81af0ec <_fini>, rtld_fini=0x4000df24 <_dl_fini>,
stack_end=0xbb0c) at ../sysdeps/generic/libc-start.c:111





---
Johan Björk




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




[PHP] Authenication with windows NT

2001-01-22 Thread Johan Andersson

Hi,

I wonder if someone have tried to authenticate with the NT user database with PHP and 
Apache?
I know it's very simple with IIS, but is it possible to do the same thing with Apache?



R,
Mr Johan Andersson
Consultant @ Qbranch.se



[PHP] ftp_rawlist doesnt take directories with spaces?

2002-02-01 Thread Johan Köhne

it seems ftp_rawlist doesnt take directories with spaces for me. does anyone
have any experience with this?

johan kohne



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




[PHP] PHP parsing XML from Shoutcast

2002-05-19 Thread Johan Ekström

Anyone that has knowledge about this program, regarding it's XML output and
php fetching that info and placing it on a php-page for user's to view?





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




[PHP] Shoutcast

2002-05-19 Thread Johan Ekström

Anyone that has knowledge about this program, regarding it's XML output and
php fetching that info and placing it on a php-page for user's to view?



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




[PHP] Re: Installing PHP 4.2.1

2002-05-20 Thread Johan Ekström

This is what you must do.

  Copy Part
^^

copy php4ts.dll to c:\winnt\system32\
copy php4sapi.dll to c:\winnt\system32\
if you want any extensions, copy them to to c:\winnt\system32\

  configuration part
^^^
 in php.ini
¨
edit doc_root like : c:/Inetpub/wwwroot
edit extension_dir like : c:/winnt/system32
then remove the ";" infront of every extension you would like to have.

  now, in iis5.0

don't use it as a "filter"
use it as an script/executable in the home flick, where you set document/web
root.

add "c:\winnt\system32\php4sapi.dll" and, fileextension, ofcourse ".php"


i hope i make sence... good luck.



"Ryan Conover" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am having trouble installing PHP 4.2.1 on Win2K/IIS5 as an ISAPI Module.
> I copied php.ini file with my config to the winnnt folder, and set the the
> app mappings and Isapi filters to C:\PHP\SAPI\php4isapi.dll, but the
module
> does not read any of the changes in the php.ini file.  How can I get
php.ini
> settings to be read?
>
> Ryan Conover
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> http://www.pitt.edu/~rscst25/
>
>



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




[PHP] Re: Installing PHP 4.2.1

2002-05-20 Thread Johan Ekström

This is what you must do.

  Copy Part
^^

copy php4ts.dll to c:\winnt\system32\
copy php4sapi.dll to c:\winnt\system32\
if you want any extensions, copy them to to c:\winnt\system32\

  configuration part
^^^
 in php.ini
¨
edit doc_root like : c:/Inetpub/wwwroot
edit extension_dir like : c:/winnt/system32
then remove the ";" infront of every extension you would like to have.

  now, in iis5.0

don't use it as a "filter"
use it as an script/executable in the home flick, where you set document/web
root.

add "c:\winnt\system32\php4sapi.dll" and, fileextension, ofcourse ".php"


i hope i make sence... good luck.



"Ryan Conover" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am having trouble installing PHP 4.2.1 on Win2K/IIS5 as an ISAPI Module.
> I copied php.ini file with my config to the winnnt folder, and set the the
> app mappings and Isapi filters to C:\PHP\SAPI\php4isapi.dll, but the
module
> does not read any of the changes in the php.ini file.  How can I get
php.ini
> settings to be read?
>
> Ryan Conover
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> http://www.pitt.edu/~rscst25/
>
>



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




[PHP] Problem : track_vars stopped working.

2002-05-22 Thread Johan Ekström

Okay, mystery to me, when I installed PHP 4.2.1 on Apache 2.0.35, the track_vars 
function, stopped working.

a simple command like, example :

 file : default.php
¨


then I type in the address in ie6, like : http://127.0.0.1/default.php?text=this

but it doesn't show anything. it becomes a blank page instead of echoing out "this".

Now, I thought track_vars was set to "Off" but in php.ini, it stood that it always was 
on.
So, now I'm stuck... I'm using the php4apache2.dll module, which I suppose may be the
problem, but I don't think they would have forgotten this function in that file.

Anyone got any idée's??? I kind of need that function to do multipages.
  johan ekström [EMAIL PROTECTED] 
http://www.dynamicduo.nu/ 




[PHP] Re: PHP 4.2.1 install

2002-05-22 Thread Johan Ekström

If you've installed php as a module, set it to "0" if as a cgi, "1"

"Ryan Conover" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> What do I set cgi_redirect var in the php.ini if I install php 4.2.1 under
> win2k/iis5.
>
> Ryan Conover
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> http://www.pitt.edu/~rscst25/
>
>



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




[PHP] Re: W2K SP2, PHP 4.2.1, IIS 5

2002-05-22 Thread Johan Ekström

This is what you must do.

  Copy Part
^^

copy php4ts.dll to c:\winnt\system32\
copy php4sapi.dll to c:\winnt\system32\
if you want any extensions, copy them to to c:\winnt\system32\

  configuration part
^^^
 in php.ini
¨
edit doc_root like : c:/Inetpub/wwwroot
edit extension_dir like : c:/winnt/system32
then remove the ";" infront of every extension you would like to have.

  now, in iis5.0

don't use it as a "filter"
use it as an script/executable in the home flick, where you set document/web
root.

add "c:\winnt\system32\php4sapi.dll" and, fileextension, ofcourse ".php"


i hope i make sence... good luck.

"Joshua E Minnie" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hey all,
> I have a problem, that I can't seem to find the answer to.  I have
> checked the archives and the website, but to no avail.  I have installed
PHP
> 4.2.1 on my local machine with IIS running W2K Pro.  When I run php -i, I
> get the html output expected.  But when I try to open the simple php
script
>
>phpinfo();
> ?>
>
> all I get is the script written directly to the browser as text.  I can't
> figure out why it is not going through php.exe.  Any help would be greatly
> appreciated.
>
> -josh
>
>



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




SV: [PHP] Installing PHP with windows

2001-11-21 Thread Johan Nilsson

no you dont have to install linux, apache works really fine under windows

read more at http://httpd.apache.org/docs/windows.html

good luck

/johan


-Ursprungligt meddelande-
Från: Rob Bennion [mailto:[EMAIL PROTECTED]]
Skickat: Wednesday, November 21, 2001 13:05
Till: [EMAIL PROTECTED]
Ämne: Re: [PHP] Installing PHP with windows


Richard,
I have got to admit I don't really understand much about servers and their
software. What I want to do is to be able to create and test php pages
'offline' like I currently do with my asp pages using PWS.

Would I be able to install apache with my windows set up or would I have to
install linux on the machine?

Thanks

Rob

"Richard S. Crawford" wrote:

> You can download the win32 PHP binaries from www.php.net.  I know it works
> because I've got it running on my win2k box.  But I'm also running Apache
> so I don't know if it will work with PWS.  I'd be interested in knowing.
>
> If it doesn't work with PWS, why not just install Apache?  It's free and
> much, much more secure than PWS.
>
> At 12:55 PM 11/21/2001, Rob Bennion wrote:
> >Hi
> >I want to try out PHP and wanted to know if it is possible to install it
> >on a windows machine and use it with personal web server.
> >
> >Any help would be appreciated.
> >
> >thanks
> >
> >Rob
>
> Sliante,
> Richard S. Crawford
>
> http://www.mossroot.com
> AIM: Buffalo2K   ICQ: 11646404  Y!: rscrawford
> MSN: [EMAIL PROTECTED]
>
> "It is only with the heart that we see rightly; what is essential is
> invisible to the eye."  --Antoine de Saint Exupéry
>
> "Push the button, Max!"


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


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




[PHP] Install problem

2001-04-09 Thread Johan Barelds

Hi all,


I installed the following php rpm's  from the SuSe distribution v7.0:
mod_php-3.0.16-52
mod_php4-4.0.0-31
I already had installed apache (apache-1.3.12.97)

After i installed the php rpm my apache webserver won't startup anymore.
in the logfile from apache i found the following messages:

PHP Warning:  Function registration failed - duplicate name - define in
Unknown on line 0
PHP Warning:  Function registration failed - duplicate name - defined in
Unknown on line 0
PHP Warning:  Function registration failed - duplicate name - each in Unknown
on line 0
PHP Warning:  Function registration failed - duplicate name - strlen in
Unknown on line 0
PHP Warning:  Function registration failed - duplicate name - strcmp in
Unknown on line 0
PHP Warning:  Function registration failed - duplicate name - strcasecmp in
Unknown on line 0
PHP Warning:  Function registration failed - duplicate name - error_reporting
in Unknown on line 0
PHP Warning:  Function registration failed - duplicate name - leak in Unknown
on line 0
PHP Warning:  Function registration failed - duplicate name - function_exists
in Unknown on line 0
PHP Warning:  Basic Functions:  Unable to register functions, unable to load
in Unknown on line 0

Does anyone has a clue what is causing this problem and more interesting: how
to solve it :-)

Thanks in advance for your reply!

Gretings,
Johan Barelds

---

-- 
Met vriendelijke groet,

Johan Barelds

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




RE: [PHP] Splitting Text

2001-08-06 Thread Alfredeen, Johan

Jord,
  I would accomplish this through SQL. You could use SELECT LEFT(mycolumn,x)
FROM mytable WHERE ...
and then display that along with a link to a page where you select the whole
string on that particular article ID. In fact, I do this exact thing on my
site.

Or you could read the whole string into an array, and use the PHP function
to retrieve the substring you want. I prefer the first option however.

Good luck,

Johan Alfredeen
PongWorld.com
www.pongworld.com

-Original Message-
From: Jordan Elver [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 06, 2001 3:20 PM
To: PHP General Mailing List
Subject: [PHP] Splitting Text


Hi, 
Can anyone give some pointers for my problem.
I want to pull articles out of a db and then show the first x number of
words 
with a read more link to the rest of the article. 

Could someone point me in the right direction. I've seen a code snippet for 
this, but now I can't find it :-(

TIA,

Jord

-- 
Jordan Elver
http://www.jordanelver.co.uk

Oops, my brain just hit a bad sector!

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

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




RE: [PHP] selecting words

2001-08-07 Thread Alfredeen, Johan

Jamie,
  There was a post earlier very similar to this. If you have a database, you
could use SELECT LEFT(mycolumn, 100) FROM mytable WHERE ...

Without a db, you can use the PHP substring function:

substr()

Hope this helps,

Johan Alfredeen
www.pongworld.com


-Original Message-
From: Jamie Saunders [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 3:53 PM
To: [EMAIL PROTECTED]
Subject: [PHP] selecting words


Hi,

What I'd like to do is take a string (paragraph) of text consisting of say
500 words and display only the first 100 words.  Is there a function able to
do this?

Thanks.

Jamie



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

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




RE: [PHP] Select

2001-08-14 Thread Alfredeen, Johan

Jeremy,
  The reason you are only getting the first value is because you are only
retrieving the first value and assigning it to $data. You need to step
through the result and do something with it. For example,

if ($row = mysql_fetch_array($result)) {
do  {
$data1 = $row["mycolumn1"];
$data2 = $row["mycolumn2"];
} while ($row = mysql_fetch_array($result));
// more code
}

Alternatively, you could insert the values into a multidimensional array
inside the loop, so you don't have to hardcode the columns. It's up to you.

Johan Alfredeen
pongworld.com


-Original Message-
From: Jeremy Morano [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2001 8:53 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Select


Hi,

I'm having a problem with my Select statement. This is what i'm doing:



$connection = @mysql_connect("l", "c", "c") or die("Couldn't connect.");

$db = @mysql_select_db($db_name, $connection) or die("Couldn't select
database.");

$sql =" SELECT *
FROM table_1
";

$result = @mysql_query($sql,$connection) or die("Couldn't execute query.");

$data=mysql_fetch_row($result);
$count=$data[0];

echo   $count;



Yet the only result I get is the first value of the first
column.


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

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




RE: [PHP] Looking for link system

2001-08-14 Thread Alfredeen, Johan

Search 
http://sourceforge.net/ and

http://freshmeat.net/

Good luck,

Johan Alfredeen
PongWorld.com


-Original Message-
From: Thomas Deliduka [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2001 9:20 AM
To: PHP List
Subject: [PHP] Looking for link system


I'm looking for a yahoo-style link system done in PHP.

Anyone know if a good one exists out there and where I can find it?

-- 

Thomas Deliduka
IT Manager
 -
New Eve Media
The Solution To Your Internet Angst
http://www.neweve.com/



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

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




RE: [PHP] insertion question

2001-08-15 Thread Alfredeen, Johan

My experience, at least from Oracle and SQLServer, is that very large tables
(many millions of records) is not really a problem as long as you design and
index well. Where you'll run into problems is when you try to join 2 very
large tables together on the fly. This is where you'll need to do prejoins
or look into the whole db wharehouse/OLAP design methodology.

So I recommend you use one large table with 3 columns (or 4 if you need the
source file info or some surrogate key). This will be a much sleeker and
flexible db design, and it sounds like you will not be doing any joins
between 2 or more large tables any way.

Johan Alfredeen
PongWorld.com



-Original Message-
From: Pétur Björn Thorsteinsson
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2001 11:49 AM
To: [EMAIL PROTECTED]
Subject: [PHP] insertion question


I have to store a whole lot of text files into a database, each one
containing 3 columns containing numbers and about 2500 lines. I was
wondering if anyone knew which would be the best way to store these files,
having one big table with each row containing the contents of the files, or
making one table for each file and inserting each line of the file into its
respective row in the database. The database will probably become pretty
big and I'm looking for the option that won't slow it down too much.

-petur


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

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




RE: [PHP] weird array behaviour

2001-08-15 Thread Alfredeen, Johan

Nick,
  I also have noticed "weird" behavior with multi (or 2D) arrays. Read more
on the manual board about arrays. However, I have finally figured out
something that works. Be careful of you you define the subarray, assign
values, and read the array. Here's what works for me:

Creating: (you could also use array_push(), but I don't think that is
supported by PHP3)

$myarray = array();
$myarray[] = array();

Assigning:

$myarray[$i][$j] = "some value";
(j can be blank or i and j can be hardcoded integers).

Reading (this was the most tricky for me):
returning $myarray[$i][$j] didn't seem to work (although the manual says it
should). It seems to work when $i and $j are hardcoded integers,
ie $myarray[0][1]

When $i and $j must be variables like your $key and $value, I finally went
with nested for loops (this works):

function print_array2D($array) {
   if(gettype($array)=="array") {
$maxi = count($array) - 1;
reset($array);

for ($i=0; $i<=$maxi; $i++) {
echo "$i: ";
$subarray = $array[$i];

for ($j=0; $j<2; $j++) {
echo "$subarray[$j] ";
}

    echo "";
}
   }
   else {
echo $array;
   }
}

Johan



-Original Message-
From: Nick Davies [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 15, 2001 9:33 AM
To: [EMAIL PROTECTED]
Subject: [PHP] weird array behaviour



I have a function which returns a mulit-dimensional array, but the array
which is returned doesn't "work" for some reason :/

If i print the array within the function using

while (list($key) = each($myArray)) {
while (list($key2, $value2) = each($myArray[$key])) {
print $key . " : " . $key . " : " . $value;
}
}

it works fine but doing the same thing after the array has been returned
jus yields -- Warning:  Variable passed to each() is not an array or
object in ... refering to $myArray[$key];

even though if i print $myArray[$key] it tells me that it's an Array :/

Thanks.

Nick.


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

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




[PHP] Zend Optimizer

2001-08-16 Thread Alfredeen, Johan

Ok, I've searched the archives and even contacted the Zend staff on this
one, and I'm still confused. I also posted this question at the Zend
Optimizer Forum but have not received an answer. I'm hoping one of you has
some idea of how the Zend Optimizer works and can explain it. My webhost
offers PHP 4 on Linux/Apache with the Zend Optimizer (v0.99) Engine (v1.0.3)
and I have checked phpinfo() to make sure it's installed and running. I
would like to optimize a particular function that generates a graph image on
the fly. What do I need to do make use of the Zend Optimizer? Is it used
automatically or do I first need to compile the code into a binary file? If
someone knows a great source of info on this (other than www.zend.com), that
would be helpful too.

Thanks,
Johan Alfredeen


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




RE: [PHP] MySQL substrings?

2001-08-20 Thread Alfredeen, Johan

This is actually not so difficult. Just download the mySQL documentation
(from mysql.org or .com I believe is where I got it) and search the function
list.

Johan Alfredeen


-Original Message-
From: Tom Carter [mailto:[EMAIL PROTECTED]]
Sent: Sunday, August 19, 2001 8:53 AM
To: Chris Lambert; [EMAIL PROTECTED]
Subject: Re: [PHP] MySQL substrings?


very hard obviously.. I've looked quite a bit before to no avail! I tried
guessing it, obviously stupidity prevailed

(note to self.. go back and use substring function instead)
- Original Message -
From: "Chris Lambert" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 19, 2001 3:48 PM
Subject: Re: [PHP] MySQL substrings?


> There is a SUBSTRING() function, its just hard to find with their search
> system.
>
> /* Chris Lambert, CTO - [EMAIL PROTECTED]
> WhiteCrown Networks - More Than White Hats
> Web Application Security - www.whitecrown.net
> */
>
> - Original Message -
> From: Tom Carter <[EMAIL PROTECTED]>
> To: Seb Frost <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Sunday, August 19, 2001 10:32 AM
> Subject: Re: [PHP] MySQL substrings?
>
>
> | You can achieve the same effect by using left and right
> | - Original Message -
> | From: "Seb Frost" <[EMAIL PROTECTED]>
> | To: <[EMAIL PROTECTED]>
> | Sent: Sunday, August 19, 2001 3:12 PM
> | Subject: [PHP] MySQL substrings?
> |
> |
> | > This is thew sort of thing I want:
> | >
> | > SELECT * FROM table ORDER BY substr(field,5,6)
> | >
> | > but I don't know the correct function, if there is one, or how to
> | implement
> | > it.
> | >
> | > cheers,
> | >
> | > - seb
> | >
> | > -Original Message-
> | > From: Michael [mailto:[EMAIL PROTECTED]]
> | > Sent: 19 August 2001 12:51
> | > To: [EMAIL PROTECTED]
> | > Subject: [PHP] Re: transaction
> | >
> | >
> | > Nafiseh Saberi wrote:
> | > >
> | > > hi.
> | > > in large database with php,postgres
> | > > and when in each time come many request ,
> | > > how do we implement transactions??
> | >
> | > > nafiseh.
> | >
> | > If you are wanting to run several queries in the one script though the
> | > one transaction -
> | > you'll need to send a begin(as a query) and execute it - then to the
> | > same connection send all your other queries as normal, and follow it
up
> | > with a commit.
> | >
> | > --
> | > PHP General Mailing List (http://www.php.net/)
> | > To unsubscribe, e-mail: [EMAIL PROTECTED]
> | > For additional commands, e-mail: [EMAIL PROTECTED]
> | > To contact the list administrators, e-mail:
[EMAIL PROTECTED]
> | >
> | >
> | > --
> | > PHP General Mailing List (http://www.php.net/)
> | > To unsubscribe, e-mail: [EMAIL PROTECTED]
> | > For additional commands, e-mail: [EMAIL PROTECTED]
> | > To contact the list administrators, e-mail:
[EMAIL PROTECTED]
> | >
> |
> |
> | --
> | PHP General Mailing List (http://www.php.net/)
> | To unsubscribe, e-mail: [EMAIL PROTECTED]
> | For additional commands, e-mail: [EMAIL PROTECTED]
> | To contact the list administrators, e-mail: [EMAIL PROTECTED]
> |
> |
> |
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


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

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




RE: [PHP] php query for mysql table

2001-08-20 Thread Alfredeen, Johan

Wolfgang,
Use LIKE '%life%' as in

SELECT somecolumn FROM mytable WHERE LOWER(mycolumn) LIKE '%life%'

Don't forget to compare same case strings.

Johan Alfredeen
www.pongworld.com


>From mySQL manual:
mysql> SELECT * FROM tbl_name WHERE set_col LIKE '%value%';
mysql> SELECT * FROM tbl_name WHERE FIND_IN_SET('value',set_col)>0;



-Original Message-
From: Wolfgang Schneider [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 20, 2001 4:22 AM
To: php-general
Subject: [PHP] php query for mysql table


Hi

I am a newbie to php + mysql and wanted to ask for some help on a
particular item which I can't seem to find "the right key" in the
documentation.  I am trying to set up a simple Q&A system with an entry
page where one can select to either have all questions & answers from a
mysql database displayed or else search with a text field for only
those questions which contain a certain word(s).

Can someone tell me how to set in a query when trying to find records
in a mysql table that have a certain word or perhaps 2 or 3 words
(among others) ...? 

 I know about using SELECT and WHERE in order to find records which
match *exactly*, but am looking for something a bit different ...

Example:
The values of 3 records for the "question" field of the database might
be the following:

[1] How do you deal with anger?
[2] Ever been full of anger in your life?
[3] Is life always easy?

How can I set a PHP query with SELECT and WHERE to express the
following:

Which questions contain the word "life"? That is, have someone search
the database in the "question" field for records where the word "life"
is used as part of the question ...  The result then should return the
records 2 & 3 above

Any help is greatly appreciated. Thanks mucho.
God bless you with His grace and peace 
Wolfgang 

Looking for Biblical information? COME AND SEE! 
-- ONLINE Courses: http://classes.bibelcenter.de ... NEW!
-- BibelCenter: http://www.bibelcenter.de 
-- Bookstore: http://www.worthy.net/BibelCenter/ 




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

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




RE: [PHP] Adding records to a MySql database

2001-08-20 Thread Alfredeen, Johan

Read in the mySQL manual at
/mysql_manual_split/manual-split/manual_Reference.html#CREATE_TABLE

etc

ie.

CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)]
[table_options] [select_statement]

ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec ...]

and more ...

Johan

-Original Message-
From: Dave.O [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 17, 2001 4:17 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Adding records to a MySql database


I am new to MySql but wanting to use PHP to update and maintain a database.
I thought I might use MySql.

I have installed MySql, and in PHP have created a database called 'mydir'. I
am trying to find php functions to add new records/fields to the database,
but all I can find are functions to query and get information from a
database.

Can anyone help or point me into the direction.

Thanks

Dave



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

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




RE: [PHP] Adding records to a MySql database

2001-08-20 Thread Alfredeen, Johan

INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
[INTO] tbl_name [(col_name,...)]
VALUES (expression,...),(...),...
or  INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
[INTO] tbl_name [(col_name,...)]
SELECT ...
or  INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
[INTO] tbl_name
SET col_name=expression, col_name=expression, ...


-Original Message-
From: Dave.O [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 17, 2001 5:41 PM
To: Martín Marqués
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Adding records to a MySql database


I was looking for the command something like mysql_insert or something, just
found dba_insert() is this it ?!?

- Original Message -
From: "Martín Marqués" <[EMAIL PROTECTED]>
To: "Dave.O" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, August 18, 2001 12:23 AM
Subject: Re: [PHP] Adding records to a MySql database


> On Vie 17 Ago 2001 20:14, Dave.O wrote:
> > I have read the documentation already.
> >
> > I am trying to create a directory, which information can be added and
> > maintained through a the web browser.  I thought that using a MySql
> > database would be a good idea rather than writing it all to a file.  You
> > saying that MySql is a waste of time for this ?
> >
> > I thought that PHP can be used to add records etc and query databases
for
> > this
>
> You said that all you found were functions to query information. Thats all
> you need with an SQL database.
> The main SQL query commands are: SELECT, UPDATE, DELETE and INSERT. With
> those 4 comands you can read, insert and modify (also delete) the
information
> on your database.
>
> Hope you understand know.
>
> Saludos... :-)
>
> --
> Porqué usar una base de datos relacional cualquiera,
> si podés usar PostgreSQL?
> -
> Martín Marqués  |[EMAIL PROTECTED]
> Programador, Administrador, DBA |   Centro de Telematica
>Universidad Nacional
> del Litoral
> -
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


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

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




[PHP] PHP Security

2001-08-31 Thread Alfredeen, Johan

I am looking for a good, practical tutorial on what I should be doing as a
developer to create a secure web site (PHP related). I have looked in my PHP
text and searched the web, but haven't found anything real useful. I am not
interested in Apache or OS security, as this is -hopefully- taken care of by
my webhost. So if you know of a good guide, online or off, please
contribute.

Thanks,

Johan
PongWorld.com


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




RE: [PHP] PHP Security

2001-08-31 Thread Alfredeen, Johan

Thanks for the tip. This is what I am talking about. Even with an error like
the one you mention below, preferably the page should die nicely and not
output a bunch of secret info or other stuff to the client. I am generally
careful to prevent that from happening in all my dealings with my mySQL db
by checking all the db connections, results, and things, and killing the
execution if there was some error. This works well. But I am sure I have not
covered every possibility.

I am mainly looking for a list of links or textbooks that outlines some of
these things. 

Johan


-Original Message-
From: Seb Frost [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 31, 2001 9:57 AM
To: Alfredeen, Johan; [EMAIL PROTECTED]
Subject: RE: [PHP] PHP Security


Great question - I'd love to know too.

I can give you one hint.  Make sure that you validate any variables passed
in the url.  I had a script that should take an integer, and realised if
someone put in a fraction or text then the script output errors to the html
page showing file and directory names that I wanted hidden.

To solve this I used:

function SecureInt($var,$default)
{
if (($var!=0) && ($var*1!=0) && is_int($var*1))
{
$var=$var*1;
//echo "is int";
}
else
{
$var=$default;
//echo "is not int";
}
return($var);
}

$intvar = SecureInt($intvar,1);


- seb

-----Original Message-
From: Alfredeen, Johan [mailto:[EMAIL PROTECTED]]
Sent: 31 August 2001 15:54
To: [EMAIL PROTECTED]
Subject: [PHP] PHP Security


I am looking for a good, practical tutorial on what I should be doing as a
developer to create a secure web site (PHP related). I have looked in my PHP
text and searched the web, but haven't found anything real useful. I am not
interested in Apache or OS security, as this is -hopefully- taken care of by
my webhost. So if you know of a good guide, online or off, please
contribute.

Thanks,

Johan
PongWorld.com


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001

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




RE: [PHP] array search

2001-08-31 Thread Alfredeen, Johan

Joseph,
 The below postings are what you're looking for. Hopefully the in_array PHP
function uses a smart search algorithm and doesn't go through the entire
array. If you store your values in a db you can make use of an index on the
column, or you could write your own search algorithm that uses a btree or
some other type of search methodology.

Johan


-Original Message-
From: Papp Gyozo [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 31, 2001 10:02 AM
To: Joseph Bannon; PHP (E-mail)
Subject: Re: [PHP] array search


yes, in_array($person, $people)!

however, you may take a look into the manual.
- Original Message -
From: Joseph Bannon <[EMAIL PROTECTED]>
To: PHP (E-mail) <[EMAIL PROTECTED]>
Sent: Friday, August 31, 2001 5:40 PM
Subject: [PHP] array search


> I have an array of names, like below...
>
> $people = array("Jim","John","JP");
>
> Is there a way in an IF statement to see if someone's name is in the
array?
> Like...
>
> if ($people =~ $person) { }
>
> I don't want to have to create a foreach loop to go through the array to
see
> if that person is there.
>
> Joseph
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



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

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




RE: [PHP] RE: [PHP-WIN] Can PHP and Java work together?

2001-08-31 Thread Alfredeen, Johan

Jack,
  My apologies. Disregard my earlier example - it only works because the PHP
variable is "passed" to the javascript variable during onLoad when
everything is executed. But in your case, the page has already been sent to
the client and PHP can only be called by calling the server again.

Johan


> > -Original Message-
> > From: Jack [mailto:[EMAIL PROTECTED]]
> > Sent: August 31, 2001 2:13 AM
> > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: [PHP-WIN] Can PHP and Java work together?
> >
> >
> > Dear all
> > I want to ask if i want to perform two task after the user had click a
> > button,
> > 1 is the task perform by PHP
> > 2 is the task perform by JavaScript
> > is it possible to do so?
> >
> > I'm actually fresh on JavaScript, before i would call the
> JavaScript, what
> > should i do first or what should i set before though?
> >
> > Thx
> > Jack
> > [EMAIL PROTECTED]
> >
> >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >


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

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




RE: [PHP] Assign multiple variables from mysql_fetch_row() call

2001-09-04 Thread Alfredeen, Johan

You can use a while loop. Ie: (where $row is the result of a sql query)

if ($row = mysql_fetch_array($result)) {
do  {
$var1 = $row["column1"];
$var2 = $row["column2"];
$var2 = $row["column3"];
} while ($row = mysql_fetch_array($result));
}

Johan
Which World? PongWorld
www.pongworld.com


-Original Message-
From: Egan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 04, 2001 3:30 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Assign multiple variables from mysql_fetch_row() call


In perl I can say something like:

   ($var1, $var2) = $sqh->fetchrow_array()


to assign column values to more than one variable at a time.  So I
tried similar syntax with PHP:


($var1, $var2) = mysql_fetch_row($sqh);


but could not seem to work it out.

I know you can do this with a temporary array, and then take values
out of the array.  But it would be nice to omit the temporary array.

Is it possible?


Egan




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

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




RE: [PHP] Can PHP and Java work together?

2001-08-31 Thread Alfredeen, Johan

Jack,
 Yes this is possible. I assume you want to use a javascript onClick event
function. Then in your javasript code, just execute your PHP code. You can
run PHP code within a javascript block. For example, on my site I assign a
javascript variable to the value held in a PHP variable like this:

var jstitle = ;

Good luck,

Johan
Which World?
www.pongworld.com


-Original Message-
From: Jack [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 31, 2001 2:13 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] Can PHP and Java work together?


Dear all
I want to ask if i want to perform two task after the user had click a
button,
1 is the task perform by PHP
2 is the task perform by JavaScript
is it possible to do so?

I'm actually fresh on JavaScript, before i would call the JavaScript, what
should i do first or what should i set before though?

Thx
Jack
[EMAIL PROTECTED]



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

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




RE: [PHP] Variable naming

2001-09-25 Thread Alfredeen, Johan

Read this
http://www.php.net/manual/en/language.variables.variable.php

Johan
www.pongworld.com
php tt

-Original Message-
From: Fábio Migliorini [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 25, 2001 12:28 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Variable naming


$id = 1;
$sql_1 = "hey";
$vname = "sql_".$id;
echo $$vname;
--
Fábio Migliorini
http://www.atua.com.br
[EMAIL PROTECTED]
UIN: 42729458
Linux User: 175409
- Original Message -
From: "Kyle Moore" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 25, 2001 1:15 PM
Subject: [PHP] Variable naming


> I want to use the value of a variable in a variable name. For instance:
>
> $id = 1;
> $sql_$id = "hey"; //set variable $sql_1 to hey
> print $sql_1; //should print hey
>
> I have looked high and low on how to do this. My first idea was eval but
> I can't seem to get that to work in this instance. Any ideas? I'm sure
> it is possible and easy but I just can't figure out how to do this in
> php.
>
> Thanks
>
> --
> Kyle
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


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

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




RE: [PHP] PHP & MySQL

2001-10-02 Thread Alfredeen, Johan

I'm a little confused over why you would display the same flavor more than
once for a single item. But ok. Have you thought about populating an array
with the flavors and then retrieving flavors from the array however many
times you need to in an if statement. Maybe it would be easier to comment if
we could see a sample page.

Johan

-Original Message-
From: Brian Lee [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 02, 2001 12:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP & MySQL


OK,

I am working on my first shopping cart using PHP and MySQL and I am having a

few problems.

The first problems is I need to bring out of a database a group of Jam 
flavors. I can do that but when certain items come up there needs to be the 
same flavors but repeated mutiple times and I am not sure how to get that to

work. I also am having a problem adding mutiple flavors to my cookies for 
check out later

Here is the code to bring the flavor selection up once. What I need is to 
figure out a way to bring it up 3,4,5 times depending on which item is 
clicked.








">




that will bring up the set of flavors once i need to be able to bring it up 
more than once but keep it in the same format and set it to a cookie.

Any help would be great. The project is already overdue so I am sort of a 
hurry.

-Brian

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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

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




[PHP] MySQL tables are read-only

2001-10-04 Thread Alfredeen, Johan

My webhost recently migrated my site over to a new server and IP. Everything
looks ok, except that all my MySQL tables now are read-only (at least that's
the error I get when trying to delete or insert records). How do I change
the tables back to write? Can I switch individual tables to write or is
there a setting to set the whole db instance to write?

I am using MySQL 3.23.32 and phpAdmin 2.2.0rc3. I appreciate your help.

Johan Alfredeen
www.pongworld.com


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




Re: [PHP] Ide help needed

2007-04-03 Thread Johan Martin

On 4/3/07, clive <[EMAIL PROTECTED]> wrote:



> Does anyone knows any IDE for PHP like VisualStudio.net?



Second the use of eclipse. Look at easyeclipse.org - they have all the
necessary plug-ins and add-ons in easy an easy to install package. Packages
available for Linux, Mac and Windows. Includes tools for Smarty, database
editing and html editing.


Re: [PHP] Re: htmlentities

2011-09-14 Thread Johan Lidström
On 13 September 2011 23:01, Shawn McKenzie  wrote:

> On 09/13/2011 01:38 PM, Ron Piggott wrote:
> >
> > Is there a way to only change accented characters and not HTML (Example:
> )
> >
> > The syntax
> >
> > echo htmlentities(
> stripslashes(mysql_result($whats_new_result,0,"message")) ) . "\r\n";
> >
> > is doing everything (as I expect).  I store breaking news within the
> database as HTML formatted text.  I am trying to see if a work around is
> available?  Do I need to do a variety of search / replace to convert the
> noted characters above back after htmlentities ?
> >
> > (I am just starting to get use to accented letters.)
> >
> > Thanks a lot for your help.
> >
> > Ron
> >
> > The Verse of the Day
> > “Encouragement from God’s Word”
> > http://www.TheVerseOfTheDay.info
> >
>
> If it is meant to be HTML then why run htmlentities(), especially before
> storing it in the DB?
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Perhaps something like this might help you

$content =
htmlspecialchars_decode(htmlentities($content,ENT_NOQUOTES,"ISO-8859-1"),ENT_NOQUOTES);

or perhaps

$table_all  =
get_html_translation_table(HTML_ENTITIES,ENT_NOQUOTES,"ISO-8859-1");
$table_html = get_html_translation_table(HTML_SPECIALCHARS,ENT_NOQUOTES);
$table_nonhtml = array_diff_key($table_all,$table_html);
$content1 = strtr($content1,$table_nonhtml);
$content2 = strtr($content2,$table_nonhtml);

if using it multiple times.

-- 
"It is not possible to simultaneously understand and appreciate the Intel
architecture" --Ben Scott


Re: [PHP] What would you like to see in most in a text editor?

2011-09-14 Thread Johan Lidström
On 13 September 2011 21:56, Brad Huskins  wrote:

> Hello all you php coders out there,
>
> I'm doing an Open Source text editor (just a hobby) that's designed for PHP
> developers and is accessible through the web. This has been stewing for a
> while, and has gotten to the point where I can use it for my own work. I
> would like any feedback on things that people really like/dislike about
> their current editors, as I believe some of these things could be resolved
> in mine.
>
> I currently have username/password protection (with Salted-Hash passwords),
> a file-system browser, file loading/saving, and syntax highlighting -- and
> these things seem to work reasonably well. As well, most things about the
> editor are scriptable with JavaScript. This would seem to imply that in a
> few weeks I would have something useful. So I would like to get some
> feedback on what features people would most want, since I am still at a very
> flexible stage in development.
>
> If you would like to see what I have, you can go to un1tware.wordpress.com.
> You can also peruse the code at github.com/bhus/scriptr. In particular,
> the README on github gives a little bit better rationality for why something
> like this might be useful, and how things are currently structured.
>
> --Brad
>
> [ Yes, this is based on the layout of Linus' original post to
> comp.os.minix. ]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Refactoring (that is, changing the name or arguments of variables or
functions and have all references to that variable or function
changed accordingly) would be nice to see in an online editor. ^_^

-- 
"It is not possible to simultaneously understand and appreciate the Intel
architecture" --Ben Scott


Re: [PHP] lost return value during a static call

2011-09-16 Thread Johan Lidström
On 15 September 2011 15:57, Robert Williams  wrote:

>
> On Sep 15, 2011, at 6:03, "chamila gayan"  wrote:
>
> > when it goes through 2 static methods, at some point it stops returning
> > value to the calling method. (please see comments in-line).
>
> The getArray() method and the 'else' portion of the getChild() method both
> lack a return statement, so they're basically just tossing out whatever
> value they come up with.
>
> --
> Bob Williams
>
> Notice: This communication, including attachments, may contain information
> that is confidential. It constitutes non-public information intended to be
> conveyed only to the designated recipient(s). If the reader or recipient of
> this communication is not the intended recipient, an employee or agent of
> the intended recipient who is responsible for delivering it to the intended
> recipient, or if you believe that you have received this communication in
> error, please notify the sender immediately by return e-mail and promptly
> delete this e-mail, including attachments without reading or saving them in
> any manner. The unauthorized use, dissemination, distribution, or
> reproduction of this e-mail, including attachments, is prohibited and may be
> unlawful. If you have received this email in error, please notify us
> immediately by e-mail or telephone and delete the e-mail and the attachments
> (if any).
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Confirmed, putting a return statement on lines 16 and 26 yields the expected
result.

-- 
"It is not possible to simultaneously understand and appreciate the Intel
architecture" --Ben Scott


Re: [PHP] OOP slow -- am I an idiot?

2006-10-10 Thread Johan Martin


On 10 Oct 2006, at 4:14 PM, Chris de Vidal wrote:

I think perhaps I'm using classes and OOP incorrectly.  The last  
time I used them, they were slow.


I want to create a "customer" class which fetches its attributes  
from a MySQL database.  Something

like this pseudocode:

class customer
{
...
getName ($id)
{
$result = mysql_query ("SELECT name FROM customers WHERE id  
= '$id'");

return mysql_result ($result, 0);
}
getRevenue ($id,$department,$month,$year)
{
$result = mysql_query ("SELECT revenue FROM  
customer_revenue WHERE customer_id = '$id' AND

department = '$department' AND month = '$month' AND year = '$year'");
return mysql_result ($result, 0);
}
...
}



You should look into getting Professional PHP5 by Lecky-Thompson,  
Eide-Goodman, Nowicki and Cove from WROX. It's a good introduction to  
using PHP5 with design patterns to solve problems similar to yours.  
Plus, the knowledge can be applied to other object oriented  
programming languages, not just PHP5. It's also been out for a while  
so it may be in the sale section already.


The collection class in chapter 5 discusses a programming problem  
just like yours.



Johan Martin
Catenare LLC
534 Pacific Ave
San Francisco, CA. 94133

http://www.catenare.com

http://www.linkedin.com/in/catenare

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



Re: [PHP] Mac PHP & MySQL

2006-11-02 Thread Johan Martin


On 02 Nov 2006, at 5:11 PM, Ed Lazor wrote:

I'm trying to configure and compile PHP 5.  The configure is  
failing to find the MySQL UNIX socket.  Any ideas?


./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-zlib \
--with-mysql=/usr/local/mysql \
--with-mysql-socket=/tmp




I had a similar problem and downloaded the tar version of the Mac OS  
X Mysql Server. Pointed --with-mysql= to the libraries and that  
folder and it worked. Decided to compile my own because the packages  
always seem to lag behind the released versions of the software. Also  
need both postgresql and mysql support.


Johan Martin
Catenare LLC
534 Pacific Ave
San Francisco, CA. 94133

Phone: (415) 834-9802
Fax: (415) 294-4495
http://www.catenare.com

AOL: catenarellc
Yahoo: martin_johan
GTalk: [EMAIL PROTECTED]

FreeWorldDialup  :716798  - http://www.freeworlddialup.com/
Gizmo Project: 747-627-9132 - http://www.gizmoproject.com/

http://www.linkedin.com/in/catenare

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



Re: [PHP] CMS for Auto Parts

2006-04-24 Thread Johan Martin


On 23 Apr 2006, at 8:03 PM, John Hicks wrote:


CK wrote:
> Hi,
> On Apr 22, 2006, at 1:26 PM, John Hicks wrote:
>
>> CK wrote:
>>> Hi,
>>> I've been commissioned to design a web application for auto parts
>>> sales. The Flash Front end will communicate with a MySQL DB via  
PHP.

>>> In addition, PHP/XML should be used with a client-side Web GUI to
>>> upload images, part no., descriptions and inventory into the DB; a
>>> Product Management System.
>>>
>> I am curious as to how you plan to using XML for the client's back
>> end? (I don't see any reason to use it.)
>
> Using XML to keep an "inventory" dynamically, was the thought.  
The XML

> file would be updated with each entry, then could be imported into a
> spreadsheet.
>

If you are storing your inventory in an XML document, then what are  
you using the MySQL database for?


>>> After "Googling" the returned queries have been slim, any leads on
>>> more specific examples?

What specifically are you looking for and how are you googling for it?

--John

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





You may want to look into openlaszlo. http://www.openlaszlo.org/  You  
can use it to provide the Internet front-end and use PHP for the back- 
end. Also, now has the option for either DHTML or Flash on the client  
side.





Johan Martin
Catenare LLC

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



Re: [PHP] New install platform

2006-06-25 Thread Johan Martin


On 25 Jun 2006, at 4:08 PM, Grae Wolfe - PHP wrote:

  It has become evident that I need some form of local testing  
environment

so that I can figure out what is wrong with one of my $sql statements.
  Can anyone tell me what the easiest platform is to set up a PHP/ 
MySQL
system?  I have a PC and a Mac on OS X, and with the use of  
VirtualPC I have

the ability to load most flavors of Linux as well.
  I hate to have to go through this to test a single error, but if  
anyone

can help with this, I would truly appreciate it.


http://www.apachefriends.org/en/xampp.html
They have complete php/apache/mysql packages for Windows, Mac OS X  
and Linux.



Johan Martin
Catenare LLC
534 Pacific Ave
San Francisco, CA. 94133

Mailing Address:
268 Bush Street #2826
San Francisco, Ca. 94104

Phone: (415) 834-9802
Fax: (415) 294-4495
http://www.catenare.com

AOL: catenarellc
Yahoo: martin_johan
GTalk: [EMAIL PROTECTED]

FreeWorldDialup  :716798  - http://www.freeworlddialup.com/
Gizmo Project: 747-627-9132 - http://www.gizmoproject.com/

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



[PHP] Apache crashes on windows XP / PHP & MySQL

2004-02-14 Thread Johan Kok
I have the following software:

1. Apache 2.0.48 (tried with and without SSL)
2. PHP - Latest version
3. MySQL - latest version
Running on Microsoft XP

The problem that I have is that when accessing MySQL with PHP cause 
Apache to crash, restart, crash etc

Could anybody help me please?

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


[PHP] newbie question ; calling php script with parrameters from html

2005-02-02 Thread Sagaert Johan
can i use this kind of construction in my html code ?

Select high


if yes , how do i retrieve the passed string in the php code

Johan

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



[PHP] str_replace weird output

2005-06-02 Thread Johan . Barbier
Hello guys :-)

I have a question. I have been using str_replace() quite a lot of times, 
and never encountered any issue. But this time, something weird happened, 
and I am wondering wether, in fact, I have never really understood how 
this function worked, or if there is some kind of bug.

If I do that :

';
?>

No prob, the output is the one I would have expected : cde

But if I do that :

' ;
?>

The result is : ih

Why ? 
It seems to me that str_replace is messing up a litlle bit if there are 
identical values in both replacement and search arrays.
Or am I missing something ?

Thanks a lot :-)

Johan

[PHP] code generation

2005-08-03 Thread Johan Grobler
is there a way to limit the time a website is available in php?, if you want to 
have a database driven website but you would only like it to be active for 6 
months for instance, i'm doing a project at univirsity and this is part of the 
specs, but i cant think of a good way how to do it...

Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Peninsula University of
Technology or the sender of this e-mail be liable to any party for
any direct, indirect, special or other consequential damages for any
use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



Re: [PHP] code generation

2005-08-04 Thread Johan Grobler
yes sorry about that, i was going to ask about code generation but then 
rephrased the question without changing the subject...

thanx for the responses, i thought of that but wouldn't changing the system 
date on your machine be a way of getting around that?

>>> Jochem Maas <[EMAIL PROTECTED]> 08/04/05 9:34 AM >>>
btw - what has 'code generation' got to do with the question?
a oneliner to check 2 dates is not considered code generation -
I'd call it 'writing a oneliner' or something similiar :-)

[EMAIL PROTECTED] wrote:
> Couldn't you use a date check with date()?
> 
> if(todays date < end date)
> {
> load the site
> }
> else
> {
> the site has expired
> }
> 

indeed, also checkout time(), mktime(), strtotime() etc.
also ...

if ($timeIsUp) {
// delete site files
exit;
}

// show the site...

> Andrew Darrow
> Kronos1 Productions
> www.pudlz.com
> 
> 
> - Original Message - 
> From: "Johan Grobler" <[EMAIL PROTECTED]>
> To: 
> Sent: Wednesday, August 03, 2005 11:04 PM
> Subject: [PHP] code generation
> 
> 
> is there a way to limit the time a website is available in php?, if you want
> to have a database driven website but you would only like it to be active
> for 6 months for instance, i'm doing a project at univirsity and this is
> part of the specs, but i cant think of a good way how to do it...
> 
> Disclaimer
> This e-mail transmission contains confidential information,
> which is the property of the sender.
> The information in this e-mail or attachments thereto is
> intended for the attention and use only of the addressee.
> Should you have received this e-mail in error, please delete
> and destroy it and any attachments thereto immediately.
> Under no circumstances will the Cape Peninsula University of
> Technology or the sender of this e-mail be liable to any party for
> any direct, indirect, special or other consequential damages for any
> use of this e-mail.
> For the detailed e-mail disclaimer please refer to
> http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
> 



Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Peninsula University of
Technology or the sender of this e-mail be liable to any party for
any direct, indirect, special or other consequential damages for any
use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



[PHP] Problem with Javascript:...submit()

2005-10-12 Thread Johan Grobler
while ($row = mysql_fetch_array($sql_result))
{
echo"

".$row['LITERATURE_title']." - ".$row['res_fname']." ".$row['res_lname']."
...

Everything works as long as $row['LITERATURE_title'] is one word, see this 
variable contains the names of books, and if the books name is "Heaven" for 
instance it works fine but as soon as the title is something like "PHP for 
Dummies" it doesnt work and i get a error on page message, I tried using 
numbers as the form name but then the same thing happens.

Any ways around this?

thanx

Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Peninsula University of
Technology or the sender of this e-mail be liable to any party for
any direct, indirect, special or other consequential damages for any
use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



Re: [PHP] Help with mysql_query and INSERT INTO

2006-02-05 Thread Johan Martin


On Saturday, Feb 4, 2006, at 07:22 America/Los_Angeles, Colin Davis 
wrote:


I need to insert a new record into a MySQL table which has an 
auto_increment
field Ref as the primary index.  When I have inserted the new record, 
I need

to get the new Ref value in order to name some files to relate to the
record.  At the moment I have to do a SELECT command and search for 
another

field (Title) which might not be unique.

Is there another way that I get the Ref back after an INSERT?

When I use mysql_query with INSERT INTO it only returns true or false,
rather than the row.  The PHP manual says:

Return Values
For SELECT, SHOW, DESCRIBE or EXPLAIN statements, mysql_query() 
returns a

resource on success, or FALSE on error.
For other type of SQL statements, UPDATE, DELETE, DROP, etc, 
mysql_query()

returns TRUE on success or FALSE on error.

Regards
Colin Davis



http://www.php.net/manual/en/function.mysql-insert-id.php
This will give you the record id of the last record inserted (or 
created).





Johan Martin
Catenare LLC
534 Pacific Ave
San Francisco, CA. 94133
Phone: (415) 834-9802
Fax: (415) 294-4495
http://www.catenare.com

AOL: catenarellc
Yahoo: martin_johan
MSN: [EMAIL PROTECTED]
GTalk: [EMAIL PROTECTED]

FWD: 716798

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



Re: [PHP] Newbie needs help

2002-07-24 Thread Johan Holst Nielsen



Neil Freeman wrote:
> mysql_db_query has been depreciated since PHP 4.0.6
> 

Yep.. but thats not the only different...

mysql_db_query() have an extra parameter that is what Database you want 
to execute your query in...

mysql_query() just use the database you have selected with f.ex. 
mysql_select_db()

But do NOT use mysql_db_query...

Regards,

Johan


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




[PHP] Find DPI ing image?

2002-09-12 Thread Johan Holst Nielsen

Hi people...

Anyone know a class or a solution so I can find the DPI (dot per inch) 
of an image?

getImageSize do not help me? Any other solutions?

Regards,

Johan


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




[PHP] Re: Using '/' instead of '?' in url querystring

2002-10-07 Thread Johan Holst Nielsen

> When sending variables this is the normal way to do it:
> /foo.php?id=12
> 
> But I have read that the following URL should work:
> /foo.php/12/
> 
> and then fetch the id in this way:
> $id = ereg_replace('[^0-9]', '', $PATH_INFO);
> 
> I have even seen it in function but the problem is that I can't get it to
> work on my local apache server.
> When I try to write /foo.php/12/ I get a '500 Internal Server Error' and in
> the apache error-log I can read that 'Premature end of script headers:
> c:/php/php.exe'. Does anyone know what could cause this error and why the
> url isn't working??

Try mod_rewrite to apache...
http://httpd.apache.org/docs/mod/mod_rewrite.html
Else try http://www.phpbuilder.com/columns/tim2526.php3

Regards,
Johan


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




[PHP] PHP and Apache2?

2002-07-10 Thread Johan Holst Nielsen

Hi,

Anyone know how long the developers is from a finale release that 
support Apache 2?

Please advice!

Regards,

Johan


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




[PHP] Re: cookie ?

2002-07-10 Thread Johan Holst Nielsen

> (yes it's me again)
> i've got an other problem.
> i've got an login system, and it has to put an cookie, but it seems he 
> doesn't do it.
> is it an php.ini problem ??

Dont think it a php.ini file.

First of all. Remember to set the cookie before any other headers is 
sent to the browser.

Do you remember to reload the page after the cookie is sent? (some 
browser cant see the cookie at the page it sent but first after it have 
been reloaded!).

Else? Please post an URL to your source, or post some sources here!

Are your sure about your browser settings? Do your denied websites to 
set cookies?

mvh
Johan



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




[PHP] Re: cookie ?

2002-07-10 Thread Johan Holst Nielsen

 > it's not the browser or what so ever,
 > i installed php 4.2.1. with apache 1.3.24 on a Redhat 7.1 server.
 >
 > but becuas for some kind a reason it wont work :(
 >
 > any body got an idea ??

try to get the cookie witgh

$_COOKIE["cookiename"];

if you have register_globals = off!

Regards,
Johan


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




Re: [PHP] Re: cookie ?

2002-07-10 Thread Johan Holst Nielsen

>> Do you remember to reload the page after the cookie is sent? (some 
>> browser cant see the cookie at the page it sent but first after it 
>> have been reloaded!).
> 
> 
> Actualy this is not browser issue but PHP issue

Aah, sorry... but it doesn't matter in this case, it could be one of the 
errors? :)

mvh
Johan


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




[PHP] Re: cookie ( still not working )

2002-07-10 Thread Johan Holst Nielsen

> my cookie problem is still not solved :(
> my browser settings are correct, and the script has worked.
> but sins i now installed php 4.2.1 with apache 1.3.24 it doesn't work :(
> does any one have an solution ??
> thnx in advance,


Sure about your register_globals = off?

please show us the source, or a link to at phps file...
And a link to a phpinfo() file?

I cant help you without further information!

Regards,
Johan


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




[PHP] Re: Newbie Logical opertaor question

2002-07-11 Thread Johan Holst Nielsen



Rw wrote:
> I have been trying this to no avail.
> 
> Tryng to say the equivalent of:
> 
> IF  (var1 = 1 AND var2 = "a" or "b" or "c")
> 
> i.e. yield true if 1 and a
> OR
> 1 and b
> OR 1 and c

I would do something like this:

$CheckArr = array("a", "b", "c");
if($var1 == 1 && in_array($CheckArr, $var2)) {
  .
}

Regards,
Johan


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




[PHP] Re: 1 Form, 2 Submit-Buttons

2002-07-11 Thread Johan Holst Nielsen

> Hello! I want to make a form (a wizard) which has 2 Submit-Buttons (Back
> & Next). The buttons should be images. How can I make php see, which
> button has been pressed?



" method="post">





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




[PHP] Re: 1 Form, 2 Submit-Buttons

2002-07-11 Thread Johan Holst Nielsen



Johan Holst Nielsen wrote:
>> Hello! I want to make a form (a wizard) which has 2 Submit-Buttons (Back
>> & Next). The buttons should be images. How can I make php see, which
>> button has been pressed?
> 
> 
> 
>  if(isset($_POST["submit_back"])) {
> //go back
> }
> else {
> //go forward
> }
> ?>
> " method="post">
> 
> 
> 
> 

Oooh sorry... offcouse
http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] mysql error or PHP

2002-07-15 Thread Johan Holst Nielsen



Justin French wrote:
> try add_slashes($string) before inserting into the database, or turn on
> magic quotes in php.ini

Or
Mysql_Escape_String()
http://www.php.net/manual/en/function.mysql-escape-string.php

Or
Mysql_Real_Escape_String()
http://www.php.net/manual/en/function.mysql-real-escape-string.php

Regards,
Johan


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





[PHP] Re: How to Detect File in a Specifc Directory on Window Env?

2002-07-19 Thread Johan Holst Nielsen

>  //DATEFORMAT MMDD
> if($dir=@opendir("/yourdirwithpdf")) {
>   echo "Found following files:"
>   while(($file=readdir($dir))!==false) {
> if(ereg("^[a-zA-Z0-9]+\.$INPUTDATE\.pdf")) {
>   echo ''.$file.'<\n>';
> }
>   }
> }
> ?>

UPS

if(ereg("^[a-zA-Z0-9]+\.$INPUTDATE\.pdf", $file))

The ereg line should look like this :)

Regards,
Johan


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




[PHP] Re: How to Detect File in a Specifc Directory on Window Env?

2002-07-19 Thread Johan Holst Nielsen



Johan Holst Nielsen wrote:
>> > //DATEFORMAT MMDD
>> if($dir=@opendir("/yourdirwithpdf")) {
>>   echo "Found following files:"
>>   while(($file=readdir($dir))!==false) {
>> if(ereg("^[a-zA-Z0-9]+\.$INPUTDATE\.pdf")) {
>>   echo ''.$file.'<\n>';
>> }
>>   }
>> }
>> ?>
> 
> 
> UPS
> 
> if(ereg("^[a-zA-Z0-9]+\.$INPUTDATE\.pdf", $file))
> 
> The ereg line should look like this :)
> 

Wow, I also forgot to close the dir handle!
Well I will let you do that :)

Regards,
Johan


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




[PHP] Re: How to Detect File in a Specifc Directory on Window Env?

2002-07-19 Thread Johan Holst Nielsen



Jack wrote:
> Dear all
> I had a folder which contains a lot of pdf file, the name format of the pdf
> files are : x.dateformat.pdf (eg : abcdefg.20020718.pdf).
> Now i want to use the php script to detect what files it got in a specific
> folder.
> i want to make a user input form which will let user to input the date and
> then i will look for the pdf report from this specific folder base on the
> Date given!
> 
> I think one of the quickest way is to ask php to check the filename from
> "Right to Left" which is the Date format!
> 
> But i don't know which php function will perform this task (Check filename
> from Right to Left).
> 
> If you have any other suggestion, pls help me!

I think I would do something like this:

'.$file.'<\n>';
 }
   }
}
?>

Regards,
Johan


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




Re: [PHP] Question

2001-01-12 Thread Johan Holst Nielsen

>Is there a way in PHP to get the size of a directory? (so I can see how much disk 
>space my >users are using in their home directory).

>Can someone also tell me what the PHP General list is exactly. Is it run by PHP folk 
>only? Can >I subscribe to this list somewhere and maybe help someone else out for a 
>change?

Yes! Try to see this, it isn't tested, just maked out of memory!


  
  

  


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




Re: [PHP] Question

2001-01-12 Thread Johan Holst Nielsen

> you probably meant $totalfilesize += filesize($files);

Offcause. Sorry just think I'm a bit tired ;o). But the rest should work?

With Best Regards

Johan


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




Re: [PHP] graphic problem...

2001-01-13 Thread Johan Holst Nielsen

GD library only support PNG 256 color your PNG have more colors!

With Best Regards

Johan


- Original Message - 
From: "Georg Buschbeck" <[EMAIL PROTECTED]>
To: "PHP-Liste (general)" <[EMAIL PROTECTED]>
Sent: Saturday, January 13, 2001 7:10 PM
Subject: [PHP] graphic problem... 


i have a problem with the quality of the output picture...
you can have a look yourself..
http://tooltime.dyndns.org/~georg/test/
this is the code that creates the pic...:


so as you can see the pictures isn't modified.

my system:
linux-box: 2.2.18
i the jpeg/png/gd/tiff libaries installed

thankx
georg



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




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




SV: [PHP] round up number

2001-03-14 Thread Johan Holst Nielsen

>How do I round up a lot of decimal number like 10.232656898 to be 10.23 ?
Should I use this?
>$num = 10.26564787;
>$Rnum = round($num);
>What would be the function I am looking for and how?


Try:
$num = 10.26564787;
$Rnum = round($num, 2);

/Johan


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




SV: [PHP] Linking Libraries ...

2001-03-14 Thread Johan Holst Nielsen

>I have a hosting account that provides PHP, but it hasn't been compiled
with
>the IMAP libraries, and I really need these functions. Is there any way to
>link the IMAP lib locally (ie: without root permissions)? I've used Perl
>before and know that similar is possible.

No, you have to compile PHP with the IMAP library! Try to contact your
provider an ask if they could install the library!

/Johan


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




[PHP] Newbie - treestructure

2001-04-19 Thread Johan Evers Petersen

I'm Newbie - sorry if this is the wrong list! 

I'm trying to print this treestructure I've made, but it doesn't seem to print more 
than the first level. The
 subtree array of the children is empty, perhaps because I do not
use the correct reference passing? 

Thank you for helping me out. 

This is the code:
id = $id;
$this->data = $data;
$this->level = $level;
$this->subtree = array();
}   function add($currentNode)
{
//This function is used to add a TreeNode, $currentNode to the subtree
print "parent: ". $this->id ." New node: ". $currentNode->id ."";
$this->subtree[] = $currentNode;
}   function output()
{
for ($i=0;$isubtree);$i++)
{
$tree =& $this->subtree[$i];
if (is_object($tree))
print "ID: ".$tree->id."";
print "Count: ".count($tree->subtree)."";
$tree->output();
} /*foreach ($this->subtree as $tree) //Skal være en while 
løkke, da $tree->subtree er tomt.
{
if (is_object($tree))
   print "ID: ".$tree->id."";
   $tree->output();
}
*/
}
} //Initialize
$treetop = new TreeNode(0, 0, -1);  // You have to have a start position
$nodehash = array();// This is only used to find the 
parents //Make the query
$sql = "SELECT * FROM page_table WHERE visible=1 ORDER BY id, title";
$query = new query($database, $sql); while ($obj = $query->getobj())
{
if($obj->parent_id > 0){//If the node is not on the toplevel
$parent =& $nodehash["id_$obj->parent_id"]; //Finds the 
parent in the $nodehash
}
else
{
$parent =& $treetop;//If the node is on 
the toplevel then the parent is $treetop
}
$level = $parent->level + 1;//The tree level of $currentNode is of 
course one more than the $parent (level
 is not stored in db)   //when we have found the level of $currentnode we are ready to 
construct the $currentNode using the parameters
 from the database and the $level
$currentNode = new TreeNode($obj->id, $obj, $level);
$nodehash["id_$obj->id"] = $currentNode; //Insert the $currentNode 
into the $nodehash so we can find it again
 if it has any children
$parent->add($currentNode); //Use the add function of the $parent to 
put $currentNode into $parent's subtree

} //Something has to be printed out...
$treetop->output(); 
?>


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




[PHP] Treestructure

2001-04-19 Thread Johan Evers Petersen

I'm Newbie - sorry if this is the wrong list!

I'm trying to print this treestructure I've made, but it doesn't seem to
print more than the first level. The
 subtree array of the children is empty, perhaps because I do not
use the correct reference passing?

Thank you for helping me out.
This is the code:
id = $id;
  $this->data = $data;
  $this->level = $level;
  $this->subtree = array();
 }  function add($currentNode)
 {
  //This function is used to add a TreeNode, $currentNode to the subtree
  print "parent: ". $this->id ." New node: ". $currentNode->id ."";
  $this->subtree[] = $currentNode;
 }  function output()
 {
  for ($i=0;$isubtree);$i++)
  {
   $tree =& $this->subtree[$i];
  if (is_object($tree))
   print "ID: ".$tree->id."";
  print "Count: ".count($tree->subtree)."";
  $tree->output();
  } /*  foreach ($this->subtree as $tree) //Skal være en while løkke, da
$tree->subtree er tomt.
  {
  if (is_object($tree))
  print "ID: ".$tree->id."";
 $tree->output();
  }
*/
 }
} //Initialize
$treetop = new TreeNode(0, 0, -1);  // You have to have a start position
$nodehash = array();// This is only used to find the parents //Make the
query
$sql = "SELECT * FROM page_table WHERE visible=1 ORDER BY id, title";
$query = new query($database, $sql); while ($obj = $query->getobj())
{
  if($obj->parent_id > 0){ //If the node is not on the toplevel
   $parent =& $nodehash["id_$obj->parent_id"]; //Finds the parent in the
$nodehash
  }
  else
  {
   $parent =& $treetop;   //If the node is on the toplevel then the parent
is $treetop
  }
  $level = $parent->level + 1; //The tree level of $currentNode is of course
one more than the $parent (level
 is not stored in db)  //when we have found the level of $currentnode we are
ready to construct the
 $currentNode using the parameters
 from the database and the $level
  $currentNode = new TreeNode($obj->id, $obj, $level);
  $nodehash["id_$obj->id"] = $currentNode; //Insert the $currentNode into
the $nodehash so we can find it again
 if it has any children
  $parent->add($currentNode); //Use the add function of the $parent to put
$currentNode into $parent's subtree
}

//Something has to be printed out...
$treetop->output();
?>



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




Re: [PHP] Treestructure

2001-04-20 Thread Johan Evers Petersen

Yes thx, but it seems that my tree is build allright, I just can't get it
out on print...
I have in my add() function a printout and from this I believe that the tree
is build allright. All the treenodes are added to the correct subtree
arrays.

function add($currentNode)
{
//This function is used to add a TreeNode, $currentNode to the subtree
print "parent: ". $this->id ." New node: ". $currentNode->id ."";
$this->subtree[] = $currentNode;
}





""Chris Lee"" <[EMAIL PROTECTED]> wrote in message
9bo0a6$v92$[EMAIL PROTECTED]">news:9bo0a6$v92$[EMAIL PROTECTED]...
this is my make_tree() function like your make_node() I think


  function _make_tree($category_id)
  {
   global $database;

   static $padding = -1;

   foreach($database->select_array('', 'category', "WHERE category_parent =
$category_id ORDER BY category_name") as $pos => $result)
   {
$id = $result['category_id'];

$category_id[$id]   = $result['category_id'];
$category_parent[$id] = $result['category_parent'];
$category_name[$id]  = $result['category_name'];
   }

   $padding++;
   if (isset($category_id))
foreach ($category_id as $pos => $val)
{
 $this->category_id[$pos]   = $category_id[$pos];
 $this->category_parent[$pos]  = $category_parent[$pos];
 $this->category_name[$pos]= $category_name[$pos];
 $this->level[$pos]   = str_repeat(' ', $padding * 2);

 $this->_make_tree($category_id[$pos]);
}
   $padding--;
  }

all you need is three fields, the categories id, the categories parent, and
the categories name. recusion is tricky stuff :)


--

 Chris Lee
 [EMAIL PROTECTED]





""Johan Evers Petersen"" <[EMAIL PROTECTED]> wrote in message
9bnn77$524$[EMAIL PROTECTED]">news:9bnn77$524$[EMAIL PROTECTED]...
I'm Newbie - sorry if this is the wrong list!

I'm trying to print this treestructure I've made, but it doesn't seem to
print more than the first level. The
 subtree array of the children is empty, perhaps because I do not
use the correct reference passing?

Thank you for helping me out.
This is the code:
id = $id;
  $this->data = $data;
  $this->level = $level;
  $this->subtree = array();
 }  function add($currentNode)
 {
  //This function is used to add a TreeNode, $currentNode to the subtree
  print "parent: ". $this->id ." New node: ". $currentNode->id ."";
  $this->subtree[] = $currentNode;
 }  function output()
 {
  for ($i=0;$isubtree);$i++)
  {
   $tree =& $this->subtree[$i];
  if (is_object($tree))
   print "ID: ".$tree->id."";
  print "Count: ".count($tree->subtree)."";
  $tree->output();
  } /*  foreach ($this->subtree as $tree) //Skal være en while løkke, da
$tree->subtree er tomt.
  {
  if (is_object($tree))
  print "ID: ".$tree->id."";
 $tree->output();
  }
*/
 }
} //Initialize
$treetop = new TreeNode(0, 0, -1);  // You have to have a start position
$nodehash = array();// This is only used to find the parents //Make the
query
$sql = "SELECT * FROM page_table WHERE visible=1 ORDER BY id, title";
$query = new query($database, $sql); while ($obj = $query->getobj())
{
  if($obj->parent_id > 0){ //If the node is not on the toplevel
   $parent =& $nodehash["id_$obj->parent_id"]; //Finds the parent in the
$nodehash
  }
  else
  {
   $parent =& $treetop;   //If the node is on the toplevel then the parent
is $treetop
  }
  $level = $parent->level + 1; //The tree level of $currentNode is of course
one more than the $parent (level
 is not stored in db)  //when we have found the level of $currentnode we are
ready to construct the
 $currentNode using the parameters
 from the database and the $level
  $currentNode = new TreeNode($obj->id, $obj, $level);
  $nodehash["id_$obj->id"] = $currentNode; //Insert the $currentNode into
the $nodehash so we can find it again
 if it has any children
  $parent->add($currentNode); //Use the add function of the $parent to put
$currentNode into $parent's subtree
}

//Something has to be printed out...
$treetop->output();
?>



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



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




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




SV: [PHP] PHP Book?

2001-04-27 Thread Johan Holst Nielsen

> Hey everyone...
>
> I've been programming in perl for about 3 years now, i have installed php
> and have been working on it for about three weeks. I started by converting
> some of the programs I've written in Perl to PHP it seems its pretty
> similar to Perl and not very hard to learn for a perl programmer... but i
> need some reference book with some practical examples so i could work
> with... and probably something that gives me ideas on different types of
> programs and things that i could do in PHP... something that covers
> everything in PHP... and is NOT copied from the manual! :))
>
> I am sure most of you in this group have got some sort of a PHP
> book... can
> you please tell me out of your experience which ones are good for
> me to buy?

Try "Core PHP Programmning", it's have a lot of good stuff!

/Johan


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




[PHP] "Incorrect number of arguments"

2001-05-07 Thread Sverre Johan Tøvik

Hi,

Somewhere between versions 4.0.0 and 4.0.4pl1, php started generating 
warning messages whenever a function call don't supply all defined 
arguments. A quick google search revealed an answer on some mailing 
list, basically saying "it's a feature, not a bug". But, seeing as 
how this "feature" creates big headeaches for a lot of people (like 
us), is there any chance we might see an option to turn off this 
strict checking?


Regards,

Sverre Johan Toevik
-- 
 I speak for myself only! 
"to be yourself, in a world that tries, night and day, to make you just
like everybody else - is to fight the greatest battle there ever is to
fight, and never stop fighting" -- e.e. cummings

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




[PHP] Location Header

2001-05-10 Thread Johan Vikerskog (ECS)


> ok.
> I have this problem of mine which i dont know how to solve. therefor i use this 
>great mailing list.
> 
> Lets say i have a URL that looks something like this.
> 
> http://adam:9000//usr/local/test/test.html
> 
> and i want to change this with a PHP script to
> 
> http://adam.artwork.com:9000//user/local/test/test.html
> 
> Anyone got any tips for me on how to do this?
> Please help me with this.
> 
> //Johan

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




[PHP] Please help me with this.

2001-05-10 Thread Johan Vikerskog (ECS)

ok.
I have this problem of mine which i dont know how to solve. therefor i use this great 
mailing list.

Lets say i have a URL that looks something like below. This URL was generated from a 
program that starts netscape with this adress. This adress is of course wrong.

http://adam:9000//usr/local/test/test.html

I want to change it so it looks like below with simply starting another scripts that 
modifies the HTTP_REFERER so it adds the full computer name to the adress window.

I asked this one before but nobody answered. If it isnt possible to be done i can 
understand it but i atleast wants to know if it is possible. To do it.

http://adam.artwork.com:9000//user/local/test/test.html

Anyone got any tips for me on how to do this?
Please help me with this.

//Johan

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




[PHP] Hi!

2001-05-11 Thread Johan Vikerskog (ECS)

with the variable HTTP_REFERER you go to the previous page.
That means one page back in time.
But how do go two pages back?
Anyone have suggestions. Thanks for all the help you can give.

//Johan

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




RE: [PHP] Hi!

2001-05-11 Thread Johan Vikerskog (ECS)

Hi Ben.
I need the URL for two pages back to be saved as a variable.
I am going to format the adress for two pages back and redirect the user to the 
formatted URL.

Sounds weird but i really nead it.

-Original Message-
From: Ben Cairns [mailto:[EMAIL PROTECTED]]
Sent: den 11 maj 2001 10:10
To: Johan Vikerskog (ECS); php-general
Subject: RE: [PHP] Hi!


You can so this with JavaScript:

Go back Two Pages


-- Ben Cairns - Head Of Technical Operations
intasept.COM
Tel: 01332 365333
Fax: 01332 346010
E-Mail: [EMAIL PROTECTED]
Web: http://www.intasept.com

"MAKING sense of
the INFORMATION
TECHNOLOGY age
@ WORK.."

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




Re: [PHP] PHP4 and MySQL on Macintosh

2001-05-14 Thread Sverre Johan Tøvik

At 14:44 -0700 14-05-01, Andreas Pucko wrote:
>  Hi there,
>
>  does anybody know if it is possible to run these applications on MAC 0S?
>
>  Any experiences?

PHP4 is part of the commercial Apache-on-UNIX-on-MacOS implementation 
WebTen (from Tenon), but not MySQL. I'd rather recommend upgrading to 
Mac OS X - because it's a full-blown *nix, PHP4 and MySQL, and a 
bunch of other *nix stuff, is there. Actually, I think you can get 
them as "double-clickable" installer packages.


Sverre
-- 
 I speak for myself only! 
"to be yourself, in a world that tries, night and day, to make you just
like everybody else - is to fight the greatest battle there ever is to
fight, and never stop fighting" -- e.e. cummings

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




[PHP] a slight newbie question

2001-05-18 Thread Johan Vikerskog (ECS)




in this simple script(not for me).

What should i do to print out $result?


//Johan



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




[PHP] Won't save session ids?

2002-04-25 Thread Johan Holst Nielsen

Hi people,

I have a problem with my PHP scripts. I hope someone can help me?
I run PHP 4.0.6, Redhat 7.1

When i tries to set a session and then redirect to the next page, the
sessions is empty? Someone know how to solve this problem?

The script looks like this:

session_start();
session_register("accountsession");
session_register("accountemail");
$HTTP_SESSION_VARS["accountsession"] = $session;
$HTTP_SESSION_VARS["accountemail"] = $email;
header("Location: ./main.php");

 //The session and email variabel is from a output from a mysql query!!
And this works fine!

The mainpage tries to get the sessions.

session_start();
echo
"Email:".$HTTP_SESSION_VARS["accountemail"]."".$HTTP_SESSION_VARS["accountsession"];

But i just get a "Email:" without any content?

Please help me? Someone know whats wrong?

Best Regards,

Johan Holst Nielsen


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




Re: [PHP] Won't save session ids?

2002-04-26 Thread Johan Holst Nielsen



Kirk Johnson wrote:

> The coding style needs to match the register_globals setting in php.ini.
>
> register_globals on:
>
> $accountsession = $session;
> $accountemail = $email;
> session_register("accountsession");
> session_register("accountemail");

Oh, sorry... I have just tried so many ways... but this works!

Thank you very much :o)

Regards,
Johan


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




[PHP] Re: array question--help

2002-04-28 Thread Johan Holst Nielsen



Mark Pelillo wrote:

> I am a Newbie at PHP
>
> I am sure I am missing something small but...
>
> I am trying to create a form selection box which an alphabetically sort
> list of a unix group file.
>
> The group file has the format groupname::groupnumber:
>
> I have tried to create an array using the array=fgetcsv($fp, 30, ":")
> which does read each line of the file.  I have used this line in a while
> loop and also a for loop, but everytime I exit the loop, the array now
> has no information.
>
> I found if the change the line to be array[]=fgetcsv($fp, 30, ":") then
> I can exit the loops but now how do extract only the group names from
> the array and be able to sort them.
>
> Ideally what I would like to do is create an array where the keys =
> group number and value = groupname. I need to be able to natsort the
> values and display in the selection form box.

Well lets try


Please reply if this doesn't work?
By the way... if you got further problems, please tell us which version of
PHP you use.

Regards,

Johan Holst Nielsen
www.weknowthewayout.com


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




RE: [PHP] Timestamp math and format

2001-10-19 Thread Alfredeen Johan K

Thanks, That was just what I needed, ie:
SELECT DATE_FORMAT(DATE_SUB(insert_date, INTERVAL 2 HOUR), '%b %e (%r)')

Johan

> On 17-Oct-2001 Alfredeen Johan K wrote:
> > I store a timestamp in a database of when a record was 
> inserted. When I pull
> > it out, I format it like this SELECT 
> DATE_FORMAT(insert_date,'%b %e (%r)')
> > AS idate
> > 
> > Now I would like to subtract 2 hours from the hour part of 
> the timestamp.
> > What's the easiest way to do this, before or after the 
> formatting? In PHP or
> > mySQL function? Can someone give me some code of how they 
> would do this.
> > 
> 
> SELECT DATE_FORMAT(DATE_SUB(insert_date, INTERVAL 2 HOUR), 
> '%b %e (%r)')
> 
> Regards,
> -- 
> Don Read   [EMAIL PROTECTED]
> -- It is necessary for me to learn from others' mistakes. I 
>will not live long enough to make them all by myself.
> 



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




[PHP] "Database tags" ala Lasso

2001-10-29 Thread Sverre Johan Tøvik

Hi,

For the futurists around here: Is there any chance that php will 
include "database tags" ala Lasso? For those who don't know what I 
mean, here's an axample (not quite correct Lasso code, but it should 
get the point across):

[db select="somedb"]
[db query="sql"]



[record]


[PHP] Re: Controlling length of table data

2001-11-14 Thread Johan Holst Nielsen

> This is really a combination html/php question, I believe.  The problem is
> that I have a table that displays a field of text that can be several
> hundred bytes long.  If, however, someone holds down a key and produces
> 500
> letter 'x' the table data then distorts the table!  Since the length of
> the data needs to be several hundred bytes, is there someway to either
> control the table data width so that the length of a non breaking string
> of characters will not distort the table, or is there a php string
> function to break the sentence into words and then I'd have to build some
> logic to test the length?

Use wordwrap() ?

Regards,

Johan

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




[PHP] Re: Session help

2001-11-14 Thread Johan Holst Nielsen

> Start at index.html. It goes to postcard.php. When I click on submit in
> postcard.php, if I change any of the values in the form, the session
> values received in send_mail.php do not change. Anyone have an idea what
> I have done wrong now?
> 

Try to make a session_unregister(), and make session_register() again with 
the new values.

Think it will help you :o)

Regards,

Johan


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




[PHP] Re: mail() function

2001-11-14 Thread Johan Holst Nielsen

> $mailheaders = "From: \"Do Not Reply\"\r\nReply-To: Do Not Reply@Do Not
> Reply\n";
>  
> If I use the above headers it says from "Do Not [EMAIL PROTECTED]"
>  
> Does anyone know how to make it just say "Do Not Reply"?

You cant... but try making it like this:

$mailheaders = "FROM: Do Not Reply \nREPLY-TO: 
";

regards,

Johan

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




[PHP] Re: PHP + apache .htaccess

2001-11-14 Thread Johan Holst Nielsen

> After I research security issue from the web, I had found apache
> .htaccess which can solve
> my problem. What my problem is that, can .htaccess perform like a database
> system which
> can store users loginID and password, and also set those users have a
> expired time each ??

If you want to use .htaccess can you make some links like this, to the 
customers who is logged in:
http://username:[EMAIL PROTECTED]/secretfolder/

Regards,
Johan

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




[PHP] Re: PHP + apache .htaccess

2001-11-14 Thread Johan Holst Nielsen

> then, can .htaccess store the user expried date ?
> like Peter is not allowed to login after 2Feb 2001, Sam is expired after
> 11Nov 2002..

Yes and no. You just have to make a change in the .htaccess file.

> and also, is it possible to maintain the .htaccess automatically ?
> like I write a shell script and run it schedully to delete those expired
> entry ?

Yes it a possibility. Think you can make it with a simply fopen() fwrite(), 
with the cron daemon.

The other possibility is to make a folder outside webscope.
Then you can make a loginscript in mysql like:

 0) {
header("Content-type: you choose");
header("Content-length: filesize('/home/filename')");
header("Content-Disposotion: inline; filename=filename.tar.gz");
readfile("/home/filename");
}
else {
   echo "you are not allowed to download this file!":
}
?>
Regards,
Johan

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




[PHP] Re: I suck at regular expressions!

2001-11-14 Thread Johan Holst Nielsen

Richard S. Crawford wrote:

> I am trying to get the title of an html file... you know, the string
> between the < title > and < /title > tags...
> 
> Here is the function I've got so far:
> 
> function fileTitle($fileName) {
>  $myFile = fopen($fileName, "r");
>  $myText="";
>  while (!feof($myFile)) {
>  $myText .= fgets($myFile,255);
>  }
>  fclose($myFile);
>  if (eregi("(.+)",$myText,$theTitle)) return
> $theTitle[0];
>  else return "(No Title)";
> }

Try:
function getTitle($filename) {
   $fp = fopen($filename, "r");
$filecontent = fread($fp, filesize($filename));
if(eregi("(.+)", $content, $title_arr)) {
return 
addslashes(htmlspecialchars(trim(strip_tags($title_arr[1];
}
else {
return "(No Title)";
}
}


Regards,
Johan

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




  1   2   >