[PHP] Re: md arrays

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

Niklas

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

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

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


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

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

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

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

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

Niklas

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

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


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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

Niklas


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


Re: [PHP] turn on GD2 lib on php 4.3.4

2004-09-20 Thread Niklas Lampén
I vote for the first option. xD
Niklas
Jason Wong wrote:
On Monday 20 September 2004 10:11, Afan Pasalic wrote:

I have right now on my server php 4.3.4 without GD2 support. Actually,
doesn't have GD support at all (nothing on phpinfo(); ).
How can I turn it on? :)

You can try performing an erotic dance in front of it or you can read manual  
Image Functions.

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


[PHP] Re: Submitting info from a form to a db

2004-09-15 Thread Niklas Lampén
First:
Post the error code when you get one.
Second:
Split the code into pieces/rows to find errors.
-- CODE --
?
mysql_query(
  INSERT INTO `users`
  (
fullname,
email,
username,
password
  ) VALUES (
 ' . $_POST['fullname'] . ',
 ' . $_POST['email'] . ',
 ' . $_POST['username'] . ',
 ' . md5($_POST['password'] . '
  )
  );
?
-- END --
Easier to spot the error? md5() tag is not closed.
Niklas

Logan Moore wrote:
heres the code, but im getting an error
? mysql_query(INSERT INTO `users`(fullname, email, username, password)
VALUES ('.$_POST['fullname'].', '.$_POST['email'].',
'.$_POST['username'].', '.md5($_POST['password'].'));
?
This time I dont have a clue whats happening
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: prob parsing Url

2004-09-14 Thread Niklas Lampén
Urlencode() and urldecode() should help you out.
Niklas
Sagar C Nannapaneni wrote:
Hi folks..
I'm using a form to send data from one page to another.
one of the input fields in the form has a quotation mark 

Ex.: samsung 15 monitor
in the next page i cant get the text after the  symbol in the field.
I've tried both GET and POST methods.
what might b the problem
/sagar
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Simple Problem about forms and sending info to db

2004-09-14 Thread Niklas Lampén
First of all, I'd use something like this:
-- CODE --
?
if (!isset($_GET['action']) || trim($_GET['action']) == )
{
?
form./form
?
}
else if ($_GET['action'] == 'adduser')
{
?
Foo
?
}
?
-- END --
But the actual error is in the echo. You're having quotation marks 
inside it. You need to do it my way, or write the form like
?
echo form name=\myForm\.../form;
?


Niklas

Logan Moore wrote:
I am currently coding a cms. So far I have completed the security
login/password system but have now moved on to a new area of php. Uploading
info to a database.
This is the code as it stands now.
?php
  if($_GET[action] == ){echo
  form name=adduser method=post action=adduser.php?action=adduser
  table width=400 border=0 cellspacing=0 cellpadding=5
tr valign=top
  td width=50% align=rightFull Name:/td
  td width=50%input name=fullname type=text id=fullname/td
/tr
tr valign=top
  td height=50 align=rightEmail:/td
  tdinput name=email type=text id=email/td
/tr
tr valign=top
  td align=rightUserName:/td
  tdinput name=username type=text id=username/td
/tr
tr valign=top
  td align=rightPassword:/td
  tdinput name=password type=password id=password/td
/tr
tr align=center
  td colspan=2input type=submit name=Submit
value=Submit/td
  /tr
  /table
  /form
  ;}
  if($_GET[action] == adduser){echo Add User Function is still Under
Construction br as a result what you just did has had no effect}
  ?
I know there is something wrong as i get an error when I goto the page.
I want it to display the form, then when you click submit, goto the same
page except run the command to add the information from the form to the
database.
Also how do I put the information in the database.
Regards
Logan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] window size...

2003-04-04 Thread Niklas Lampén
No.


Niklas


-Original Message-
From: Deependra b. Tandukar [mailto:[EMAIL PROTECTED] 
Sent: 4. huhtikuuta 2003 12:45
To: Justin French; Diana Castillo; [EMAIL PROTECTED]
Subject: [PHP] window size...


Hi,

Is there anyway to define a fixed window size using PHP as we do with 
JavaScript?

Regards,
DT


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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] @getimagesize

2003-04-03 Thread Niklas Lampén
Check if file exists with file_exists().


Niklas


-Original Message-
From: Diana Castillo [mailto:[EMAIL PROTECTED] 
Sent: 3. huhtikuuta 2003 11:42
To: [EMAIL PROTECTED]
Subject: [PHP] @getimagesize


even though I use a @getimagesize , I still get the following Warning
when the image is not on the server.  I need to somehow not have the
warning come out when there is no image there.

Warning:
getimagesize(http://www.hotelresb2b.com/planos/PLHAHC019330.GIF)
[function.getimagesize]: failed to create stream: HTTP request failed!
HTTP/1.1 404 Not Found at
c:\inetpub\wwwroot\web\site\ReservationManager.php line 190.

I am using PHP Version 4.3.1
Thank you , Diana 

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] @getimagesize

2003-04-03 Thread Niklas Lampén
Check the error reporting level on your server.
I tried @getimagesize(http://www.hotelresb2b.com/planos/Pasdasda.gif;)
and I got no error at all. One thing you could try is if
fopen(http://file;, r) success, but I don't know if it gives you this
stream creating error as well. Remember to close the file right away, if
you use that! :)


Niklas


-Original Message-
From: Diana Castillo [mailto:[EMAIL PROTECTED] 
Sent: 3. huhtikuuta 2003 13:42
To: [EMAIL PROTECTED]
Subject: Re: [PHP] @getimagesize


according to the documentation on  php.net , This function will not work
on
remote files; the file to be examined must be accessible via the
server's
filesystem.

so it wont work for http

Niklas lampén [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Check if file exists with file_exists().


 Niklas


 -Original Message-
 From: Diana Castillo [mailto:[EMAIL PROTECTED]
 Sent: 3. huhtikuuta 2003 11:42
 To: [EMAIL PROTECTED]
 Subject: [PHP] @getimagesize


 even though I use a @getimagesize , I still get the following Warning
 when the image is not on the server.  I need to somehow not have the
 warning come out when there is no image there.

 Warning:
 getimagesize(http://www.hotelresb2b.com/planos/PLHAHC019330.GIF)
 [function.getimagesize]: failed to create stream: HTTP request failed!
 HTTP/1.1 404 Not Found at
 c:\inetpub\wwwroot\web\site\ReservationManager.php line 190.

 I am using PHP Version 4.3.1
 Thank you , Diana

 ###
 This message has been scanned by F-Secure Anti-Virus for Internet
Mail.
 For more information, connect to http://www.F-Secure.com/



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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] preg_match_all()

2003-04-03 Thread Niklas Lampén
He needs both. /s makes dot to include new lines too, so you're right.


Niklas


-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED] 
Sent: 3. huhtikuuta 2003 16:26
To: Thomas Johnsson
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] preg_match_all()


Hi,

Thursday, April 3, 2003, 11:33:02 PM, you wrote:
TJ I am having problems with preg_match_all spanning over newlines.
TJ Using /m does not seem to ignore the the newlines.

TJ // This works
TJ // Both contents inside td and /td are found
TJ $html = 'tr valign=top
TJ td width=10One cell/td
TJ tdAnother/td
TJ /tr';

TJ // This does not
TJ // Only the contents inside the first td and /td are found
TJ // The only difference is that there is a linebreak efter the second
td
TJ $html = 'tr valign=top
TJ td width=10One cell/td
TJ td
TJ Another/td
TJ /tr';

TJ preg_match_all(/td.*(.*)\/td/m, $html, $out);

TJ I have been doing this before, but I can't remember how I got it
working...
TJ Any thougts?


I think you need /s to cope with newlines

-- 
regards,
Tom


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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Menu from Directory

2003-04-02 Thread Niklas Lampén
You might want to start with searching the manual for opendir()
function. There is a sample code listing all files from a directory. :)


Niklas


-Original Message-
From: Ben Whitehead [mailto:[EMAIL PROTECTED] 
Sent: 2. huhtikuuta 2003 1:05
To: [EMAIL PROTECTED]
Subject: [PHP] Menu from Directory


I am trying to sort an image menu system which is passed a directory
name,
and can count and name the files in a menu from simply seeing which
files
are in this directory. It would be ideal if it can just do this just by
looking at the files in the directory, and their file names, but if that
is
not possible, could it us the information in a text file I have created
and
placed in this directory?

Anyway help would be greatly received! (I'm new to PHP, so simple help
would
be even more appreciated!) :S

Ben

--
Ben Whitehead

[EMAIL PROTECTED]



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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Re: Internet Explorer toolbar

2003-03-28 Thread Niklas Lampén
Heh, I think this kind of idiotism and hair splitting is fun for a
change. :)
I personnally like this in this php-list that you can ask allmost
anything and get a desent answer in a short perioid of time. Lets keep
it that way, even if it takes us sometimes to javascript or some other
OT. :)


Niklas


-Original Message-
From: Philip J. Newman [mailto:[EMAIL PROTECTED] 
Sent: 28. maaliskuuta 2003 10:17
To: Dan Rossi; Leif K-Brooks
Cc: Peter Houchin; Dan; php-general
Subject: Re: [PHP] Re: Internet Explorer toolbar


Mummy and Daddy sto fighting.

- Original Message -
From: Dan Rossi [EMAIL PROTECTED]
To: Philip J. Newman [EMAIL PROTECTED]; Leif K-Brooks
[EMAIL PROTECTED]
Cc: Peter Houchin [EMAIL PROTECTED]; Dan [EMAIL PROTECTED];
php-general [EMAIL PROTECTED]
Sent: Friday, March 28, 2003 7:04 PM
Subject: RE: [PHP] Re: Internet Explorer toolbar


 heh sorry excuse my arrogance , of then , find me a solution that 
 doesnt require echoing javascript ?

 -Original Message-
 From: Philip J. Newman [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 28, 2003 6:49 PM
 To: Dan Rossi; Leif K-Brooks
 Cc: Peter Houchin; Dan; php-general
 Subject: Re: [PHP] Re: Internet Explorer toolbar


 Now Now children.


 - Original Message -
 From: Dan Rossi [EMAIL PROTECTED]
 To: Leif K-Brooks [EMAIL PROTECTED]
 Cc: Peter Houchin [EMAIL PROTECTED]; Dan [EMAIL PROTECTED]; 
 php-general [EMAIL PROTECTED]
 Sent: Friday, March 28, 2003 6:47 PM
 Subject: RE: [PHP] Re: Internet Explorer toolbar


  ??? who cares i gave a solution, there is no other #**#% way
 
  -Original Message-
  From: Leif K-Brooks [mailto:[EMAIL PROTECTED]
  Sent: Friday, March 28, 2003 3:39 PM
  To: daniel
  Cc: Peter Houchin; Dan; php-general
  Subject: Re: [PHP] Re: Internet Explorer toolbar
 
 
  Yes, but that has nothing do to with PHP!  It's not doing it with 
  PHP as was asked, it's doing it with javascript.
 
  daniel wrote:
 
  yes simply buffer the exact javascript code and then echo it
  
  ie
  
  $buffer .= 'a href=#
 

onclick=window.open('something.php','something,'scrollbars=no,width=10
0,he
  igh
  t=100'/a';
  
  sorry i forget the no toolbar part from the top of my head.
  
  
  = Original Message From Leif K-Brooks
[EMAIL PROTECTED]
  =
  Correct, but he asked about doing it with PHP.
  
  Peter Houchin wrote:
  
  
  
  yes there is java script
  
  Dan wrote:
  
  
  
  On Thu, 27 Mar 2003 12:32:06 -0800 (PST), [EMAIL PROTECTED]
(Manuel
  Ochoa) wrote:
  
  
  Is there any way of using php to launch a new browser without 
  the IE toolbars?
  
  
  
  No. PHP is server side, not client side.
  
  
  
  
  
  
  --
  The above message is encrypted with double rot13 encoding.  Any
  unauthorized
  
  
  attempt to decrypt it will be prosecuted to the full extent of the 
  law.
  
  
  
  
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  
  
  
  
  
 
  --
  The above message is encrypted with double rot13 encoding.  Any
 unauthorized
  attempt to decrypt it will be prosecuted to the full extent of the 
  law.
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 



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



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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Re: Internet Explorer toolbar

2003-03-28 Thread Niklas Lampén
I think you should use the function called
PutMoneyToMyAccount($AccountID = '123456-98765', $AmountInUSDollars =
'100');. Run it as many times as you want. This doesn't need
javascript, so this wasn't OT.. :P No need to thank me, even manual
tells you this.


Niklas


-Original Message-
From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED] 
Sent: 28. maaliskuuta 2003 10:41
To: [EMAIL PROTECTED]
Cc: 'Php-General'
Subject: RE: [PHP] Re: Internet Explorer toolbar


At 09:35 28.03.2003, Niklas Lampén said:
[snip]
Heh, I think this kind of idiotism and hair splitting is fun for a 
change. :) I personnally like this in this php-list that you can ask 
allmost anything and get a desent answer in a short perioid of time. 
Lets keep it that way, even if it takes us sometimes to javascript or 
some other OT. :)
[snip] 

Ask anything? Really?

Well then - how can I get rich quick, do I need to use JavaScript or can
it be done with PHP?

(sorry couldn't resist...)

-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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


###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] String Replace

2003-03-14 Thread Niklas Lampén
There is many functions that can do it.
str_replace() is the fastest on thisone. preg_match() comes on second
position, and after that comes ereg_replace().
But if you need to do harder replacing, preg_match() is the one to use, imo.


Niklas


-Original Message-
From: Awlad Hussain [mailto:[EMAIL PROTECTED] 
Sent: 14. maaliskuuta 2003 13:26
To: [EMAIL PROTECTED]
Subject: [PHP] String Replace


I have a string with underscore in the middle.. like This_That which
function do i use to replace the _ with space? eg to This That

the string is in a variable..

I know its really simple but just don't know which function to use.

any suggestion?

-awlad

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Re: Your script possibly relies on a session side-effect which existed until PHP 4.2.3

2003-03-13 Thread Niklas Lampén
LOL! :D

-Original Message-
From: Rudolf Visagie [mailto:[EMAIL PROTECTED] 
Sent: 13. maaliskuuta 2003 10:56
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Re: Your script possibly relies on a session side-effect
which existed until PHP 4.2.3


I would have thought a genius would be able to spell geniuses.

-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 13, 2003 2:46 AM
To: chris; [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Your script possibly relies on a session side-effect
which existed until PHP 4.2.3


on 13/03/03 11:23 AM, chris ([EMAIL PROTECTED]) wrote:

 Now, if any other geniouses would like to help me (or any other 
 frustrated 4.3.1 users) figure out a solution for this vague error 
 message, don't follow Justin's very unhelpful footsteps.

Well I'll certainly never make the mistake of attempting to help you again.

People make mistakes.  I sincerely apologise for ruining your whole day by
not reading the rest of your thread.  Shsh.


Justin


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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Can't relocate to a specified URL after submit.

2003-03-13 Thread Niklas Lampén
You cannot output anything before headers.


Niklas


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 14. maaliskuuta 2003 8:03
To: [EMAIL PROTECTED]
Subject: [PHP] Can't relocate to a specified URL after submit.


The code looks like:
if( $actionflag == delete )
{
  //Delete Table ip_enrollment
  $query=delete from ip_enrollment where id='$id';
  $AMC_DB-query($query) or die(database server wasn't available
now.);

  //Delete Table ip_evaluation
  $query=delete from ip_evaluation where enrollmentID='$id';
  $AMC_DB-query($query) or die(database server wasn't available
now.);

  header( ip-list.php?subMenuSelect=m1);
}

It works fine before, but it seems header() doesn't work after I added some
js code for preventing click submit twice.

script language=JavaScript
!-- Copyright 2000 by William and Mari Bontrager.
counter = 0;
function count() {
counter++;
if(counter = 1)
  document.formname.submit();
} // --
/script

a href=javascript:count()
img border=0 src=images/ip_submit.gif/a


Thanks a lot,
Larry



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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] can't get any string replacements to clean this

2003-03-13 Thread Niklas Lampén
What are you trying to get out of that mess? What should the output look
like?


Niklas


-Original Message-
From: Dennis Gearon [mailto:[EMAIL PROTECTED] 
Sent: 14. maaliskuuta 2003 7:51
To: [EMAIL PROTECTED]
Subject: [PHP] can't get any string replacements to clean this


All i get out of:
str_replace
ereg_replace
preg_replace

is an empty string value.
Anybody know why?


?PHP
   $bad_str =  \t\t\t\\r\\\r\r\r\r\n\r\nFour
schore  ...and seven\n\n\n\n\nr\r\r\rn\r years
ago, ,,,,,,our father created on tis planet
\t\t\t\\r\\\r\r\r\r\n\r\nFour ;

   echo( br\nuncleaned
string-br\n);
   echo($bad_str . br\nn );
   echo( br\ncleaned
br\n);

   //Nothing will clean on this line
   $bad_str = preg_replace( '\r', '\n', $bad_str );
   echo(/pre\n);
?

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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] date check

2003-03-12 Thread Niklas Lampén
$FourteenDays = 86400 * 14;
$var = $FourteenDays - (strtotime($date2) - strtotime($date1));

Now if $var is  0, 14 days has not passed.


Niklas

-Original Message-
From: Fredrik [mailto:[EMAIL PROTECTED] 
Sent: 12. maaliskuuta 2003 12:06
To: [EMAIL PROTECTED]
Subject: [PHP] date check


Hi

I want to check if  $var  14 days or $var   14 days

($var = $date2  - $date1)

$date1 = 2003-01-16;
$date2 = 2003-03-16;


How can i check this?
Are there any functions for this or do i have to make one?





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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Re: [PHP-DB] How to Connect remote DB server?

2003-03-12 Thread Niklas Lampén
Possibly the db-server is accepting only localhost connections.


Niklas


-Original Message-
From: Patrick LOK [mailto:[EMAIL PROTECTED] 
Sent: 12. maaliskuuta 2003 14:39
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] Re: [PHP-DB] How to Connect remote DB server?


There is no firewall within the LAN environment.

I tried the mssql_connect too using mssql_connect(testdb,sa,) but same
error returned! Any idea?

./pl

Jason Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Wednesday 12 March 2003 19:28, Patrick LOK wrote:
  It is possible to connect a remote db server using x_connect? 
  e.g. a PostgreSQL in server PSQLDB, ip=192.168.0.100  and a MSSQL 
  server MSSQLDB, ip=192.168.0.110
 
  I tried pgsql_connect(psqldb,administrator,) 
  pgsql_connect(192.168.0.100,administrator,) but failed!
 
  Error is Unable to connect to server: psqldb in psqltest.php on 
  line 2

  Unable to connect to server: 192.168.0.100 in psqltest.php on line 
  2

 Yes, it is possible to connect to a remote DB server. You have to make
sure
 that:

 a) the DB server in question is configured to accept remote 
 connections
 b) any intervening firewall is correctly configured to allow DB traffic


 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development 
 *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-db
 --
 /*
 Dr. Livingston?
 Dr. Livingston I. Presume?
 */




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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Re: [PHP-DEV] Is PHP designed (have the capability) to access remote DB?

2003-03-12 Thread Niklas Lampén
You said before you got a odbc connection to your remote db = remote
connections are possible.

The problem is in:

a) db configuration
b) your way of trying to connect to db
c) your firewall
d) remote firewall
e) all above


Niklas


-Original Message-
From: Patrick LOK [mailto:[EMAIL PROTECTED] 
Sent: 12. maaliskuuta 2003 15:33
To: [EMAIL PROTECTED]
Subject: [PHP] Re: [PHP-DEV] Is PHP designed (have the capability) to access
remote DB?


IT IS ABOUT THE DESIGN AND DEVELOPMENT OF PHP



Derick Rethans [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Stop posting user questions to the php-dev and php5-dev list, as I 
 explained before.

 Derick

 On Wed, 12 Mar 2003, Patrick LOK wrote:

  Is PHP designed (have the capability) to access remote DB?
 
  Is there any PHP developer willing to answer the question?
 
  ./pl
 

 --
 my other box is your windows 
 PC
 -
  Derick Rethans http://derickrethans.nl/
  PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
 -



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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Help with ereg()

2003-03-11 Thread Niklas Lampén
Use preg_match_all();

Something like preg_match_all(/(\(\?.*\?)/im, $Text, $Array_PHP_Code,
PREG_PATTERN_ORDER); should do it. It might need some work, but you'll get
it. :)


Niklas


-Original Message-
From: Alejandro [mailto:[EMAIL PROTECTED] 
Sent: 11. maaliskuuta 2003 14:59
To: [EMAIL PROTECTED]
Subject: [PHP] Help with ereg()


Hi all. I'm trying to deal with Regular Expressions, but somehow it is
getting more difficult. I´m trying to do the folowing:

Read a text and get all of the PHP code out of it, highlight it and then
print all in nice HTML. I'm using this to get the PHP code:

ereg(\?.*\?,$Text,$PHP_code);

It works, yeah, but on a situation like this:

?
echo ;
?
This is some other no php code
?
echo this is PHP;
?



Thanks anyway

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Search for keyword in txt file

2003-03-07 Thread Niklas Lampén
Dolphins are gone. ;)

Here is your direction: preg_match(). If you need help with it (it can be
compicated at first), ask. :)


Niklas


-Original Message-
From: Chris Blake [mailto:[EMAIL PROTECTED] 
Sent: 7. maaliskuuta 2003 11:16
To: [EMAIL PROTECTED]
Subject: [PHP] Search for keyword in txt file


Greetings learned PHP(eople),

What is the best method to search a text file for a specific string and
return it to a form ?

I`m not looking for you guys (and gals) to give me the answer, just point me
in the right direction

So long and thanks for all the fish..


-- 
Chris Blake
Office : (011) 782-0840
Cell : 083 985 0379
Your mouse has moved. Windows must be restarted for the change to take
effect. Reboot now? [ OK ]


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


###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Search for keyword in txt file

2003-03-07 Thread Niklas Lampén
You might want to use preg_match_all(). Here's a sample of getting whole row
with a specified word in it:

pre
?
$file =
This line should be found!
This line is not important! If you see this, there is something wrong!!!
This line should be found too!
This is too much!
Should this too?
Yes, it should!;

preg_match_all(/.*should.*/i, $file, $aMatches, PREG_PATTERN_ORDER);
var_dump($aMatches);
?
/pre


Niklas

-Original Message-
From: Chris Blake [mailto:[EMAIL PROTECTED] 
Sent: 7. maaliskuuta 2003 12:36
To: Php-General
Subject: RE: [PHP] Search for keyword in txt file


Ok, it`s not that easy..here`s my code...I wanna search all the files in
the logs directory and for each file found I want it to search for the
word started and print that line into a table row. 

I will probably need to do like a for each loopbut where do I insert
it ?


=== 
?php 

if ($handle = opendir('logs')) 

{ 
 echo Directory handle: $handle.'br'; 
 echo 'table border=1' ; 
 echo 'tr'; 
 echo 'tdcenterbfont size=3 color=navyLog Files on
'.$HTTP_SERVER_VARS['HTTP_HOST'] .'/td/center/b/font'; 
 echo 'tdcenterbfont size=3
color=navyCreated/td/center/b/font'; 
 echo '/tr'; 

 { 
 // Loop over the directory - 
 while (false !== ($file = readdir($handle))) 
 //Take out upper directory pointers first--- 
 if ($file != . and $file != ..) 
 
 //Start filename insertion-- 
  { 
  echo 'trtdfont size=2a href=/logs/'.$file.'' . $file .
'/td/font/a'. 
  'td' . '/td'; 
  } 

 } 

 echo '/tr'; 
 echo '/table'; 
 closedir($handle); 
} 

   ? 


===

Thanks

Chris

 
On Fri, 2003-03-07 at 11:21, Niklas Lampén wrote: 
 Dolphins are gone. ;)
 
 Here is your direction: preg_match(). If you need help with it (it can 
 be compicated at first), ask. :)
 
 
 Niklas
 
 
 -Original Message-
 From: Chris Blake [mailto:[EMAIL PROTECTED]
 Sent: 7. maaliskuuta 2003 11:16
 To: [EMAIL PROTECTED]
 Subject: [PHP] Search for keyword in txt file
 
 
 Greetings learned PHP(eople),
 
 What is the best method to search a text file for a specific string 
 and return it to a form ?
 
 I`m not looking for you guys (and gals) to give me the answer, just 
 point me in the right direction
 
 So long and thanks for all the fish..
 
 
 --
 Chris Blake
 Office : (011) 782-0840
 Cell : 083 985 0379
 Your mouse has moved. Windows must be restarted for the change to take
 effect. Reboot now? [ OK ]
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 ###
 This message has been scanned by F-Secure Anti-Virus for Internet 
 Mail. For more information, connect to http://www.F-Secure.com/
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Chris Blake
Office : (011) 782-0840
Cell : 083 985 0379
Your mouse has moved. Windows must be restarted for the change to take
effect. Reboot now? [ OK ]


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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] javascript

2003-03-07 Thread Niklas Lampén
If you want to validate form data before sending it, javascript is the
choise.


Niklas


-Original Message-
From: Liam Gibbs [mailto:[EMAIL PROTECTED] 
Sent: 7. maaliskuuta 2003 15:44
To: php list
Subject: Re: [PHP] javascript


 in my php script registration1.php, i have written
 javascript for form validation i.e. for checking if
 the mandatory fields are filled correctly or not.
 but on clicking the submit button, i get connected to
 the next page without the form getting validated!!

What's wrong with using PHP to validate?


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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] javascript

2003-03-07 Thread Niklas Lampén
Advantage is obvious!

If there is a field user didn't fill up, you can notify user about it and
ask him/her to fill the field up.

Do the math:

Validating after send:
1. Fill in the form
2. Send
3. (Load)
4. Validate
- It failed = back to form
5. (Load)
6. Pre-fill the fields up with previous values
Repeat 1 to 6 untill user gets everything right
7. Do what you want with form data


Validating before send:
1. Fill in the form
2. Validate
- It failed = info to user if something failed
Repeat 1 and 2 untill user gets everything right
3. Send
4. (Load)
5. Do what you want with form data

Ofcourse this does not apply to every form, but basicly this is how it goes.


Niklas

-Original Message-
From: Liam Gibbs [mailto:[EMAIL PROTECTED] 
Sent: 7. maaliskuuta 2003 15:55
To: php list
Subject: Re: [PHP] javascript


 If you want to validate form data before sending it, javascript is the 
 choise.

Yeah, before sending it. Just wondering what the advantage is in validating
before sending.


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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Dollar signs in values

2003-03-06 Thread Niklas Lampén
print htmlspecialchars([EMAIL PROTECTED]@#%:[EMAIL PROTECTED]@[EMAIL 
PROTECTED]|#:~December,
2003~on~fjskl);


Niklas

-Original Message-
From: Liam Gibbs [mailto:[EMAIL PROTECTED] 
Sent: 7. maaliskuuta 2003 8:13
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Dollar signs in values


 Could you show some code to illustrate the unpredictable results that 
 you
get?

Here's what I have in my file:

[EMAIL PROTECTED]@#%:[EMAIL PROTECTED]@[EMAIL PROTECTED]|#:~December, 2003~on~fjskl

It's first exploded() by ~, then those values are produced by print()
statements, like this one:

print(DIV ALIGN = \CENTER\STRONG\ .
$information[1] . \/STRONG);

I'll try the single quotation mark method first, though.


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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Dollar signs in values

2003-03-06 Thread Niklas Lampén
True. My bad. :)

You really have to use single quotes, not double quotes. And I was the one
telling about this a couple of days a go. :)


Niklas


-Original Message-
From: Jason k Larson [mailto:[EMAIL PROTECTED] 
Sent: 7. maaliskuuta 2003 8:58
To: [EMAIL PROTECTED]
Cc: Php-General
Subject: Re: [PHP] Dollar signs in values


And what about:

print
htmlspecialchars('[EMAIL PROTECTED]@#%:[EMAIL PROTECTED]@[EMAIL 
PROTECTED]|#:~December,2003~on
~fjskl');

It seems to work for me.

--
Jason k Larson


Niklas Lampén wrote:
 print 
 htmlspecialchars([EMAIL PROTECTED]@#%:[EMAIL PROTECTED]@[EMAIL 
 PROTECTED]|#:~December,
 2003~on~fjskl);
 
 
 Niklas


###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Maximum execution time exceeded when using dial up

2003-03-06 Thread Niklas Lampén
My short answer: set_time_limit();


Niklas


-Original Message-
From: Andras Kende [mailto:[EMAIL PROTECTED] 
Sent: 7. maaliskuuta 2003 9:05
To: 'php list'
Subject: [PHP] Maximum execution time exceeded when using dial up



Hello,

I have database while query which populates cells in a html table, but
noticed if using a slow dial up connection its times out... 

Fatal error: Maximum execution time of 60 seconds exceeded in
D:\website\eis-vieworderlookup.php on line 75

What's the best way to deal with this??


Thanks,

Andras Kende



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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Performance Question

2003-03-04 Thread Niklas Lampén
I think that file_get_contents() is quicker, since include() runs what it
gets as normal php code. And that gives you the answer to the other question
as well. :)


Niklas


-Original Message-
From: Patrick Teague [mailto:[EMAIL PROTECTED] 
Sent: 4. maaliskuuta 2003 10:57
To: [EMAIL PROTECTED]
Subject: [PHP] Performance Question


What's the difference in performance between

print( file_get_contents(myfile.html) );

and

include(myfile.html);

is there any particular reason for using one over the other?

Patrick



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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] \n

2003-03-04 Thread Niklas Lampén
That should be done like

$inputresult = str_replace(\n, para;\n, $testtextarea);

unless he really wants to output \n, not line change.

?
$foo = lines;
print this is\ntwo $foo;
?

outputs:
this is
two lines

?
$foo = lines;
print 'this is\ntwo lines $foo';
?

outputs:
this is\ntwo $foo

String in enclosed by ' is exact, unlike .


Niklas


-Original Message-
From: Jon Haworth [mailto:[EMAIL PROTECTED] 
Sent: 4. maaliskuuta 2003 11:06
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] \n


Hi John,

 Nothing fancy. Can't get it to echo ¶

Is that a pilcrow sign? If so, have you tried para; instead, like this:

$inputresult = str_replace('\n', 'para;\n', $testtextarea);

Cheers
Jon

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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Text File open and display

2003-03-03 Thread Niklas Lampén
You get a file to an array of lines with file().

Example:
?
$myFile = file(text_file.txt);
// Now $myFile is an array looking like
// [0] = row 1;
// [1] = row 2;
// [2] = row 3;
// .

for ($i = 0; $i  count($myFile); $i++)
{
print Row .($i+1).: .$myFile[$i];
};
?


Niklas

-Original Message-
From: Chris Blake [mailto:[EMAIL PROTECTED] 
Sent: 3. maaliskuuta 2003 10:58
To: [EMAIL PROTECTED]
Subject: [PHP] Text File open and display


Greetings learned PHP(eople),

There have been a number of postings recently on opening and reading files,
and whilst I have read `em all I fail to make sense of it all.

Basicaly...I have a text file with entries in it...I wish to display the
contents of this file line by line in an HTML table : At present all I get
is a table with 1 row and all the text in it in a large messy blob.
=
html
body

  ?php
   $handle = fopen(fopen.txt,r);
  
   echo 'table border=1'.\n;
   echo ' tr'.\n;
   echo '   td width=15%bFile Entries/b/td'.\n;
   echo ' /tr'.\n.\n;
   //
   //For each line in the file
   // while (fpassthru($handle));
   //{
   //Print them out to Table-
   echo 'tr'.\n;
   echo '   td width=15%font size=2';
   echo fpassthru($handle);
   echo '/td/tr'. \n;
   //}
   echo '/table';
   //fclose($handle);
  
  ?
  
  /body
  /html
=
I have commented out those lines which fail and am stuck as to what the
correct syntax should be. I have read up on nl2br,fgets and other posts on
php.net, but ..harump

Thanks 


-- 
Chris Blake
Office : (011) 782-0840
Cell : 083 985 0379
It is reported that somewhere in the world, every 15 seconds, a woman gives
birth to a child. She must be found and stopped.


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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] info required reg. PHP

2003-03-03 Thread Niklas Lampén
1) No you can't. Use javascript for that.

2) This information is easy to find from web. Read datasheets or use google.


Niklas


-Original Message-
From: yogendra lingsugur [mailto:[EMAIL PROTECTED] 
Sent: 3. maaliskuuta 2003 14:32
To: [EMAIL PROTECTED]
Subject: [PHP] info required reg. PHP


Hello !

   I have got 2 doubts/questions for clarification.

1) Can we display an alert box using PHP.  The objective is to fire back the
user for his incorrect submission with an alert message.

2) I would like to know the max. number of records or max. space a database
(mentioned below) can provide. Oracle, MS.Access, MySQL, SQL Server,...

with thanks
L. Yogendra




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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] including db content as part of script

2003-02-27 Thread Niklas Lampén
Well, you could use temporary files for this. I've never done this by
myself, but I think it's worth giving a try. :)

Fetch the data from the database, write your code to temporary file and then
include this temporary file. After that you can destroy the temporary file.


Niklas


-Original Message-
From: Dennis Heuer [mailto:[EMAIL PROTECTED] 
Sent: 27. helmikuuta 2003 14:29
To: [EMAIL PROTECTED]
Subject: [PHP] including db content as part of script


Hello -

One single question. Is including() a script on runtime only possible with
files or can I include() code from a database?

greetings
Dennis

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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] File upload problem - permission denied

2003-02-27 Thread Niklas Lampén
Seems that php does not have write access to that directory. Set it right
and it should work.


Niklas


P.S. Tip: It's much quicker to create plain html without echo. Just do it
like
form name=blah, not like
? echo form name=\blah\; ? :)


-Original Message-
From: Frans Bakker [mailto:[EMAIL PROTECTED] 
Sent: 27. helmikuuta 2003 15:43
To: [EMAIL PROTECTED]
Subject: [PHP] File upload problem - permission denied


Hello everybody,

I am relatively new to PHP and for quite some days I am trying to get a file
upload system going through a standard html form. To test it I use an html
page called Test2.php with a form in it with
enctype=\multipart/form-data\. Here is the source code:

?php

$AppImageDir = Web/Images;

if (isset($_FILES[ImageFile])) {
move_uploaded_file($_FILES['ImageFile']['tmp_name'],
$AppImageDir./.$_FILES['ImageFile']['name']);

}

?

html
head
titleWeb site - pages form/title
/head
body
?php

echo 
form action=\Test2.php\ enctype=\multipart/form-data\ method=\post\
input type=\hidden\ name=\MAX_FILE_SIZE\ value=\8\ input
type=\file\ name=\ImageFile\ input type=\submit\ name=\btnSubmit\
value=\Upload\ /form ; ?

/body
/html

It is a standard straight forward image upload situation. You see that the
form directs to itself (action=\Test2.php\) and on top of the page a
simple instruction to see if the file uploads correctly. As far as I can
see, this is correct code. Note that the any \\ are to escape  and further
\\ (necesary in echo  statements).

However, when I execute the page, I get the following error messages:

Warning: Unable to create '/Web/Images/cartel_feria1.jpg': Permission denied
in /Web/Test2.php on line 6

Warning: Unable to move '/tmp/php0jHeNE' to '/Web/Images/cartel_feria1.jpg'
in /Web/Test2.php on line 6

It seems to say that I don't have permission to execute a file upload on
that page. As you can see by the directory specifications this script runs
on a Linux. However, I also tried the same script on a Windows machine, with
the corresponding directory specifications of course, and with the same
result: permission denied.

What is wrong here, where do I set what type of permissions in order to get
the file upload to work? By the way, in the php.ini FileUpload is set at
yes.

Kind regards,
FRANS BAKKER




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


###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] File upload problem - permission denied

2003-02-27 Thread Niklas Lampén
On linux you can do it in shell with chmod command. Do 'chmod 766 direcory'.
You can find out more about chmod-command at
http://www.die.net/doc/linux/man/man1/chmod.1.html.


Niklas


-Original Message-
From: Frans Bakker [mailto:[EMAIL PROTECTED] 
Sent: 27. helmikuuta 2003 16:03
To: [EMAIL PROTECTED]
Subject: Re: [PHP] File upload problem - permission denied


All right then. ¿Where do I set that permission for PHP? On my local Windows
machine it is usually in IIS. However the whole ..\inetpub\wwwroot\..
directory already has read and write permissions. Apart from PHP I use Cold
Fusion. With Cold Fusion I don't have any permission problems...

Niklas lampén [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
Seems that php does not have write access to that directory. Set it right
and it should work.


Niklas


P.S. Tip: It's much quicker to create plain html without echo. Just do it
like form name=blah, not like ? echo form name=\blah\; ? :)


-Original Message-
From: Frans Bakker [mailto:[EMAIL PROTECTED]
Sent: 27. helmikuuta 2003 15:43
To: [EMAIL PROTECTED]
Subject: [PHP] File upload problem - permission denied


Hello everybody,

I am relatively new to PHP and for quite some days I am trying to get a file
upload system going through a standard html form. To test it I use an html
page called Test2.php with a form in it with
enctype=\multipart/form-data\. Here is the source code:

?php

$AppImageDir = Web/Images;

if (isset($_FILES[ImageFile])) {
move_uploaded_file($_FILES['ImageFile']['tmp_name'],
$AppImageDir./.$_FILES['ImageFile']['name']);

}

?

html
head
titleWeb site - pages form/title
/head
body
?php

echo 
form action=\Test2.php\ enctype=\multipart/form-data\ method=\post\
input type=\hidden\ name=\MAX_FILE_SIZE\ value=\8\ input
type=\file\ name=\ImageFile\ input type=\submit\ name=\btnSubmit\
value=\Upload\ /form ; ?

/body
/html

It is a standard straight forward image upload situation. You see that the
form directs to itself (action=\Test2.php\) and on top of the page a
simple instruction to see if the file uploads correctly. As far as I can
see, this is correct code. Note that the any \\ are to escape  and further
\\ (necesary in echo  statements).

However, when I execute the page, I get the following error messages:

Warning: Unable to create '/Web/Images/cartel_feria1.jpg': Permission denied
in /Web/Test2.php on line 6

Warning: Unable to move '/tmp/php0jHeNE' to '/Web/Images/cartel_feria1.jpg'
in /Web/Test2.php on line 6

It seems to say that I don't have permission to execute a file upload on
that page. As you can see by the directory specifications this script runs
on a Linux. However, I also tried the same script on a Windows machine, with
the corresponding directory specifications of course, and with the same
result: permission denied.

What is wrong here, where do I set what type of permissions in order to get
the file upload to work? By the way, in the php.ini FileUpload is set at
yes.

Kind regards,
FRANS BAKKER




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


###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/



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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] header and writing problem

2003-02-26 Thread Niklas Lampén
I think this can be done with mySQL (if you're using it) log-files.


Niklas

-Original Message-
From: George Pitcher [mailto:[EMAIL PROTECTED] 
Sent: 26. helmikuuta 2003 11:02
To: [EMAIL PROTECTED]
Subject: [PHP] header and writing problem


Hi all,

Back on the list after a long break.

I want to be able to write all my sql queries (well at least the ones that
change or create records) to a log file.

However some of the pages that contain these queries are just used to
redirect the user depending on the result.

Writing to a file id not permitted before creating the header for the
redirect.

can anyone suggest a workaround.

Cheers

George


===

George Pitcher
HERON Technical Manager
Ingenta plc
23-38 Hythe Bridge Street, Oxford, OX1 2ET
T  +44 (0)1865 799137 direct
T  +44 (0)1865 799000 switchboard
F  +44 (0)1865 799134
E  [EMAIL PROTECTED]

www.ingenta.com
Ingenta: Empowering the exchange of academic and professional content
online.


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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] to holmes Re: [PHP] mysql trouble

2003-02-26 Thread Niklas Lampén
No, he doesn't mean that.

You are doing:
$String = text  + more text;
while you should be doing:
$String = text  . more text;


Niklas

-Original Message-
From: Luis A [mailto:[EMAIL PROTECTED] 
Sent: 26. helmikuuta 2003 16:09
To: [EMAIL PROTECTED]
Subject: [PHP] to holmes Re: [PHP] mysql trouble


you mean  i do not need to put the pus on the end of the function

(+)   i dont need to put there that?


- Original Message -
From: John W. Holmes [EMAIL PROTECTED]
To: 'Richard Whitney' [EMAIL PROTECTED]; 'Luis A'
[EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, February 25, 2003 8:21 PM
Subject: RE: [PHP] mysql trouble


  ### ?php
  ### // process form
  ### $link = mysql_connect(localhost, root);
  you need to have the password as the third argument
  $link = mysql_connect(localhost, root, password);
 
  Also, why is it in a variable?
  Just make it:
  mysql_connect(localhost, root, password);

 Sometime there are users that do not have a password. Every parameter 
 to
 mysql_connect() is optional, by the way.

 Also, you want to assign the result of mysql_connect() to a variable 
 so you can tell the connections apart. If you only have one connection 
 per script, then it's not a big deal. But, if you connect to several 
 databases, then you need that result to tell them apart when you do 
 queries later so PHP knows what connection to send your query through.

  ### mysql_select_db(mydb,$db);
  ### $sql = INSERT INTO agenda (nombre, direccion, telefono, email) 
  
 +

 Problem is the plus (+) sign at the end of this line.

 ---John W. Holmes...

 PHP Architect - A monthly magazine for PHP Professionals. Get your 
 copy today. http://www.phparch.com/



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




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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



RE: [PHP] Newbie's question about \n

2002-07-22 Thread Niklas Lampén

If you check the source of your code you'll see that in source the text
is in two lines.
\n doesn't work as br, so this is about how HTML works, not plain
text.


Niklas

-Original Message-
From: KK Lee [mailto:[EMAIL PROTECTED]] 
Sent: 22. heinäkuuta 2002 14:01
To: [EMAIL PROTECTED]
Subject: [PHP] Newbie's question about \n 


Dear ALL,

It seems that i have a very silly problem.
I can't get the new line escape character to work.
the following is my SIMPLE script and corresponding output.


PHP script:
!DOCTYPE HTML PUBLIC
   -//W3C//DTD HTML 4.0 Transitional//EN
   http://www.w3.org/TR/html4/loose.dtd; 
html
head
  titleTEST/title
/head
body bgcolor=#ff
  ?php
echo this should be printed out:\n;
echo this is a second line;
  ?
/body
/html


Output in IE6:
this should be printed out: this is a second line


regards,

KK




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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] Require()

2002-06-26 Thread Niklas Lampén

Try this:

?
if ($viewsystem == 1)
$Str = d:\\htdocs\\somewhere\\editexemptfiles.php?every=1;

require($Str);
?


Niklas


-Original Message-
From: Andy Whittlestone [mailto:[EMAIL PROTECTED]] 
Sent: 26. kesäkuuta 2002 15:37
To: [EMAIL PROTECTED]
Subject: [PHP] Require()


 I want to use require to send some post information to a page.


Code:

if ($viewsystem = = 1)
$Str = editexemptfiles.php?every = 1;

require($Str);


I've tried what it says in the online documentation, but it doesn't
work,

Tried:
$Str = d:\htdocs\somewhere\editexemptfiles.php?every = 1;


getting the following error:

Fatal error: Failed opening required
'd:/htdocs/somewhere/anotherpage.php?every = 1'
(include_path='.;d:\php\includes') in d:\htdocs\somewhere\thispage.php
on line 48






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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] Help and advice sought - search/replace

2002-06-26 Thread Niklas Lampén

If your list looks like this:


Salo, Mika
Räikkönen, Kimi
Häkkinen, Mika


And there is no other commas in the list, you can do it something like
this:

?
$commaSeparatedList = join(\n, file(NAMES.txt));
$tabSeparatedList = preg_replace(, , \t, $commaSeparatedList);
$arrayOfTabSepList = explode(\n, $tabSeparatedList);
?

I think that'll do. I didn't test it thou.. :)


Niklas

-Original Message-
From: Jason Soza [mailto:[EMAIL PROTECTED]] 
Sent: 27. kesäkuuta 2002 7:42
To: PHP-General Mailing List
Subject: [PHP] Help and advice sought - search/replace


Just looking for a pointer or functions I can use to do this...

I have a spreadsheet with a couple thousand entries that I'll be using
for populating a MySQL database. The spreadsheet has names listed in
last, first - the database I'll be populating has separate fields for
first and last names.

I exported the names column from the spreadsheet in tab-delimited format
and I figured I could come up with a quick PHP script that would open
the text file, find each instance of , , take all that's before that
delimiter and move it after all that's after that delimiter, inserting a
tab in between. So last, first would become first[tab]last.

So far, I've gotten:
?php
$filename = NAMES.txt; //name the file...
$fp = fopen($filename,r+); //open it...
echo Reading $filename...;

$contents = fread($filename, filesize($filename)); //read it...

$names = explode(\n, $contents);

foreach($names as $name);
echo $namebr;

fclose($filename);
?

Obviously, I've written in some stuff just so I can see what I'm doing,
the echo in the foreach for example. But I'm stuck on what to use to
actually separate and rewrite each $name. I'm assuming I'll have to
create a while() or for() loop and use a regular expression for this?
I'm not sure where to look. Any help would be great - just so I won't
have to go in and manually separate first and last names. Thanks!

Jason Soza


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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] looping through numbers

2002-06-25 Thread Niklas Lampén

for ($i = 200; $i = 200; $i++)
print $i ;


Niklas


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: 25. kesäkuuta 2002 10:05
To: [EMAIL PROTECTED]
Subject: [PHP] looping through numbers


Hello ,

How do I do a loop that will increase a number tell it reaches another
number

I what it to print out every number starting at 200 and ending at 250 so
it would print out 200 201 202 203 204



-- 
Best regards,
 rdkurth  mailto:[EMAIL PROTECTED]


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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] looping through numbers

2002-06-25 Thread Niklas Lampén

it should ofcourse be

for ($i = 200; $i = 250; $i++)
print $i ;


:)



-Original Message-
From: Niklas Lampén [mailto:[EMAIL PROTECTED]] 
Sent: 25. kesäkuuta 2002 10:05
To: Php-General
Subject: RE: [PHP] looping through numbers


for ($i = 200; $i = 200; $i++)
print $i ;


Niklas


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: 25. kesäkuuta 2002 10:05
To: [EMAIL PROTECTED]
Subject: [PHP] looping through numbers


Hello ,

How do I do a loop that will increase a number tell it reaches another
number

I what it to print out every number starting at 200 and ending at 250 so
it would print out 200 201 202 203 204



-- 
Best regards,
 rdkurth  mailto:[EMAIL PROTECTED]


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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] function echo ' '

2002-06-25 Thread Niklas Lampén

Shorter version would be

a href=?=$address?

And this is not bad coding, it is actually faster than echoing
everything. We had this conversation maybe a week ago, so let's not
start it again. :)


Niklas



-Original Message-
From: Craig [mailto:[EMAIL PROTECTED]] 
Sent: 25. kesäkuuta 2002 10:43
To: [EMAIL PROTECTED]
Subject: Re: [PHP] function echo ' '


Can you use

a href=? echo $address; ? or is this bad coding?


René moonen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Use the escape character to output double quotes

 echo 'a href=\$address\';

 René

 Martin Johansson wrote:

 Is there a way to express php variables inside an echo ' '.
 
 I want something like this to work:
 
 echo 'a href=$address';
 
 I know I can write it like this:
 echo 'a href=';
 echo $address;
 echo '';
 
 But Its to hard to read the code like this.
 /Martin
 
 
 
 





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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] function echo ' '

2002-06-25 Thread Niklas Lampén

Not true. :)
You can do it like this: (Ok, this is a for loop, but idea is the same)

?
for ($i = 0; $i  10; ++$i)
{
?
a href=page?=$i?.htmPage ?=$i?/a
?
};
?


Niklas

-Original Message-
From: Martin Johansson [mailto:[EMAIL PROTECTED]] 
Sent: 25. kesäkuuta 2002 10:56
To: [EMAIL PROTECTED]
Subject: Re: [PHP] function echo ' '


But the problem is that Im doin it inside a while loop. So I need to
echo it. /mj

Niklas lampén [EMAIL PROTECTED] skrev i meddelandet
025801c21c1d$55d16210$ba93c5c3@Niklas">news:025801c21c1d$55d16210$ba93c5c3@Niklas...
Shorter version would be

a href=?=$address?

And this is not bad coding, it is actually faster than echoing
everything. We had this conversation maybe a week ago, so let's not
start it again. :)


Niklas




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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] mysql_num_rows always returns 1?

2002-06-18 Thread Niklas Lampén

Try

$query = select count(*) as Lines from users where 
  
and then check the value of Lines. Or then do something like

$query = select ID from users where 
and now your mysql_num_rows($result) should return right kinda value.


Niklas

-Original Message-
From: Mark Colvin [mailto:[EMAIL PROTECTED]] 
Sent: 18. kesäkuuta 2002 15:00
To: [EMAIL PROTECTED]
Subject: [PHP] mysql_num_rows always returns 1?


The function below works when I pass in a valid username and password
and returns '1'. When I pass a username and password that is not in the
database it still returns '1'. I have put some echo statements in for
debugging and the value of $numresult is always '1'. Does mysql_num_rows
retain results in memory or something like that or am I completely going
down the wrong road?

  function VerifyLogin($user, $pass)
  {

 $conn = $this-DB_Connect();

 $query = select count(*) from users where 
   .username = '$user' and 
   .password = '$pass';

 $result = mysql_query($query);

 if(!$result)
 {
 echo 'Cannot run query.';
 echo 'user = ' .$user;
 echo 'pass = ' .$pass;
 echo 'query = ' .$query;
 echo 'result = ' .$result;
 $numresult = mysql_num_rows($result);
 echo 'numresult = ' .$numresult;
 exit;
 }
 else
 {
 $numresult = mysql_num_rows($result);
 echo 'numresult = ' .$numresult;
 }

 //if a row exists we have a correct username/password
 if (mysql_num_rows($result) == 1)
 {
return 1;
 }
 // else username and/or password is wrong
 {
return 0;
 }
  }

Thanks in advance


Mark



This e-mail is intended for the recipient only and
may contain confidential information. If you are
not the intended recipient then you should reply
to the sender and take no further ation based
upon the content of the message.
Internet e-mails are not necessarily secure and
CCM Limited does not accept any responsibility
for changes made to this message. 
Although checks have been made to ensure this
message and any attchments are free from viruses
the recipient should ensure that this is the case.


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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] open database paradox

2002-06-18 Thread Niklas Lampén

Use ODBC.


Niklas


-Original Message-
From: sonjaya [mailto:[EMAIL PROTECTED]] 
Sent: 19. kesäkuuta 2002 7:57
To: [EMAIL PROTECTED]
Subject: [PHP] open database paradox 


i want to open and read database  in paradox , how 

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] php-speed

2002-06-13 Thread Niklas Lampén

Embedding PHP in HTML, since I think HTML is ignored by php, just passed
thru.


Niklas


-Original Message-
From: Philipp Melab [mailto:[EMAIL PROTECTED]] 
Sent: 13. kesäkuuta 2002 14:55
To: [EMAIL PROTECTED]
Subject: [PHP] php-speed


I have a simple newbie question...
Whats better (faster?):

- embedding PHP in HTML
- or printing HTML via PHP
...?

yours Philipp

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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] php-speed

2002-06-13 Thread Niklas Lampén

On which part was I wrong?

Printing HTML via PHP is slower than inserting PHP into HTML. Maybe
we're just having communicational problems. :)

English is not my native language, so I might have understood it wrong,
but I understand embedding php opposite to echoing html. Am I understood
now? ;)

Btw. everyone else, check that link below too, if this issue is in your
interest.


Niklas


-Original Message-
From: Pradeep Dsouza [mailto:[EMAIL PROTECTED]] 
Sent: 13. kesäkuuta 2002 15:21
To: [EMAIL PROTECTED]
Subject: Re: [PHP] php-speed


See this
And maybe you might change your impression

http://www.phpbeginner.com/columns/jason/echo

Pradeep

www.naharonline.com





- Original Message -
From: Niklas Lampén [EMAIL PROTECTED]
To: Php-General [EMAIL PROTECTED]
Sent: Thursday, June 13, 2002 5:38 PM
Subject: RE: [PHP] php-speed


Embedding PHP in HTML, since I think HTML is ignored by php, just passed
thru.


Niklas


-Original Message-
From: Philipp Melab [mailto:[EMAIL PROTECTED]]
Sent: 13. kesäkuuta 2002 14:55
To: [EMAIL PROTECTED]
Subject: [PHP] php-speed


I have a simple newbie question...
Whats better (faster?):

- embedding PHP in HTML
- or printing HTML via PHP
...?

yours Philipp

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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] php-speed

2002-06-13 Thread Niklas Lampén

I don't think so. The difference is (IMHO + the article linked below) if
you use

...a href=?=$Var?Foo/a... (faster)
or
? print ...a href=\$Var\Foo/a...; ? (slower)


Niklas


-Original Message-
From: Brian McGarvie [mailto:[EMAIL PROTECTED]] 
Sent: 13. kesäkuuta 2002 15:29
To: [EMAIL PROTECTED]
Cc: Php-General
Subject: RE: [PHP] php-speed


I believe it also depends on the quote types used...

Place string/text/html code etc with in single quotes  '  if the
string contains no $var's to be parsed, andif it does need to
parse $var's.

 -Original Message-
 From: Niklas Lampén [mailto:[EMAIL PROTECTED]]
 Sent: 13 June 2002 1:25 PM
 To: Php-General
 Subject: RE: [PHP] php-speed
 
 
 On which part was I wrong?
 
 Printing HTML via PHP is slower than inserting PHP into HTML. Maybe 
 we're just having communicational problems. :)
 
 English is not my native language, so I might have understood
 it wrong,
 but I understand embedding php opposite to echoing html. Am I 
 understood
 now? ;)
 
 Btw. everyone else, check that link below too, if this issue
 is in your
 interest.
 
 
 Niklas
 
 
 -Original Message-
 From: Pradeep Dsouza [mailto:[EMAIL PROTECTED]]
 Sent: 13. kesäkuuta 2002 15:21
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] php-speed
 
 
 See this
 And maybe you might change your impression
 
 http://www.phpbeginner.com/columns/jason/echo
 
 Pradeep
 
 www.naharonline.com
 
 
 
 
 
 - Original Message -
 From: Niklas Lampén [EMAIL PROTECTED]
 To: Php-General [EMAIL PROTECTED]
 Sent: Thursday, June 13, 2002 5:38 PM
 Subject: RE: [PHP] php-speed
 
 
 Embedding PHP in HTML, since I think HTML is ignored by php,
 just passed
 thru.
 
 
 Niklas
 
 
 -Original Message-
 From: Philipp Melab [mailto:[EMAIL PROTECTED]]
 Sent: 13. kesäkuuta 2002 14:55
 To: [EMAIL PROTECTED]
 Subject: [PHP] php-speed
 
 
 I have a simple newbie question...
 Whats better (faster?):
 
 - embedding PHP in HTML
 - or printing HTML via PHP
 ?
 
 yours Philipp
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 ###
 This message has been scanned by F-Secure Anti-Virus for
 Internet Mail.
 For more information, connect to http://www.F-Secure.com/
 
 ###
 This message has been scanned by F-Secure Anti-Virus for
 Internet Mail.
 For more information, connect to http://www.F-Secure.com/
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 ###
 This message has been scanned by F-Secure Anti-Virus for
 Internet Mail.
 For more information, connect to http://www.F-Secure.com/
 
 ###
 This message has been scanned by F-Secure Anti-Virus for
 Internet Mail.
 For more information, connect to http://www.F-Secure.com/
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] tutorials

2002-06-12 Thread Niklas Lampén

Well, it depends on how well you know the basics of programming. If
you're a total newbie, first of all learn how you use variables,
conditional statements and loops. Without these you're powerless! :)

One way is to just create a simple form on one page and then try
thingies you can do with the values sent from that form.

If you need a tutorial, try searching google with php tutorial.. :)


Niklas


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: 12. kesäkuuta 2002 10:17
To: [EMAIL PROTECTED]
Subject: [PHP] tutorials


hi 

i want to start learning this PHP, i've got the manual
but i need a kind of a starting point? any suggestions


Adriaan Putter

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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] bulk mail()

2002-06-12 Thread Niklas Lampén

One solution could be this:

You only need on page for this:

1) create an array of recipients

2) get value from array like array[$pos];

3) send mail to this receiver

4) now some javascript, unless ofcourse if $pos is bigger than
count($array): location.href = http://blah.com/foo.php?pos=?=$pos+1?


And keep some log on sending. Even simple text file will do, if you are
sending mails in some known order. Log file is very handy if cpu
crashes, or something else happens.


Niklas


-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]] 
Sent: 12. kesäkuuta 2002 14:45
To: php
Subject: [PHP] bulk mail()


Hi all,

I've got a mailing on a website, with email address' / names / etc in a
MySQL table.

I think there's around 120 on it at the moment.

I've been noticing a growing lag on the sending of mail though... I've
got a script which takes a message from a form, then runs a while loop
through the rows of the mailing_list table, replacing a special string
with the subscribers name, and sending using the mail() command.

However, this time, the script actually failed, with a failure when
attempting to access blah.com/foo.php (the sending script).  I have no
idea if SOME people got the email, or what, and have no idea how to
check.

So, I make the assumption that as the mailing list has grown, the script
time has slowed... now it's too big (or the server was too busy) to
process all the emails before the script timed out.


If I didn't want to personalise the emails, I'm sure the script would
run a lot quicker with every address in the Bcc header, but since we
personalise each email, I can't see any option other than using mail()
200 times...  and it's only going to get a lot worse as we climb to
1000+.

So, what options do I have?

Break the mailing list up into batches of 40 or so?  How would I
implement something like this?


Any advice / concepts / ideas welcome!


Justin French

Creative Director
http://Indent.com.au



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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] Help with forms data please

2002-06-12 Thread Niklas Lampén

That's how I do it when I need to handle the data and return user to the
same page.
Use header(Location: blah); in the end of the handler page. Then even
'back'-button won't take user back to the handler page, and refresh
won't send data again.


Niklas

-Original Message-
From: Jonathan Rosenberg [mailto:[EMAIL PROTECTED]] 
Sent: 12. kesäkuuta 2002 16:18
To: Bret L Conard; [EMAIL PROTECTED]
Subject: RE: [PHP] Help with forms data please


How about if you just return the user to the same page?  Will that work?

 -Original Message-
 From: Bret L Conard [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, June 12, 2002 7:33 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Help with forms data please


 I need to send the data from a form without taking the
 surfer to that page.
 ie:
 form on ' formPage.php '
 with
 form name='foo' method='post' action='../newUser.php'
 but leave the user on ' formPage.php'
 Any way to do that?

 Thanks



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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] Else/For loop

2002-06-12 Thread Niklas Lampén

If you still have an error there, change

if ($num_results = 0)
to
if ($num_results == 0)

See the difference? Realize the error?


Niklas


-Original Message-
From: Roberts, Mark [mailto:[EMAIL PROTECTED]] 
Sent: 12. kesäkuuta 2002 16:20
To: [EMAIL PROTECTED]
Subject: [PHP] Else/For loop


Being relatively new to php, I discovered the following after about 2
hours of debugging last night and was wondering why???

I had the following code:

if ( $num_results = 0 )
{
echo no records found;
}
else
{
for ($i=0; $i  $num_results; $i++)
{
display record set
}
}

As a result, the for loop never executed, no matter how many records
were returned in the record set. I placed echo statements though out to
determine why the for loop was not being executed. I put an echo
statement just before the for to make sure the else condition was being
met.

Finally, I just copy/pasted (literally) the for loop to just before the
'if' statement. Much to my surprise...the for loop now works perfectly.
(Except, of course, if there are no records returned).

The duduction...for loops will not work inside else statements. The
question...why?

I think I can work around this with some different coding, but why
should I have to? I have done this same thing in java, perl and other
languages...

Mark Roberts
Sr. Systems Analyst
LanApps/Web Development
The Williams Information Services Corporation
918-573-1706
[EMAIL PROTECTED]



###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




[PHP] RE: [PHP-DB] cookies and Global variables

2002-06-06 Thread Niklas Lampén

1. Cookies _has_ to be sent before anything else, that just is the case.

2. Sessions are the answer for thisone.


Niklas

-Original Message-
From: Dib, Walid (MED, Stagiaire GEMS) [mailto:[EMAIL PROTECTED]] 
Sent: 6. kesäkuuta 2002 10:06
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] cookies and Global variables


Hello


1) I want to use cookies for my site, how can I do it? My browser warn
me that headers are already sent!!

2) How can I use the same variables on all pages:
for example: $login, I need this variable on all pages to send
requests to a MySQL database.


Thanks 


DIB Walid






###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] phpSearch

2002-06-05 Thread Niklas Lampén

Yeah, we'd be happy to develope such program for you. Is there something
else you need, cash? :


Niklas


-Original Message-
From: millw0rm [mailto:[EMAIL PROTECTED]] 
Sent: 6. kesäkuuta 2002 9:05
To: [EMAIL PROTECTED]
Subject: [PHP] phpSearch


Hi, I m looking for a Search Engine kinda application which can search
content inside my own website, which includes files like php, text, html
 as well as mySQL db... do u guys hav ne idea where i can find the
application or r there ne1 who can develop it for me pls... i tried few
applications like phpdig, Site Search, phpMySearch but unfortunately now
of them got what I need... neways can u help me out. pls






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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




RE: [PHP] How can I remove the last character from a one line file?

2002-05-30 Thread Niklas Lampén

eregi_replace(o$, , $String);


Niklas


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: 30. toukokuuta 2002 13:05
To: [EMAIL PROTECTED]
Subject: RE: [PHP] How can I remove the last character from a one line
file? 


Hi all,

The problem is nearly solved.  I need my if statement to read
the last character from the file  if it ends with an o, then remove the
one character.  My current if statement allows the action to take place
if there is an o anywhere in the file.  Can somebody help me with this.

My current if statement looks like this:

if (eregi (.*\b,$port)){
$port=substr($port,0,(strlen($port)-1));
}

Thanks alot
Dave

-Original Message-
From: Rea, David 
Sent: 28 May 2002 15:46
To: 'Ed Gorski'
Subject: RE: [PHP] How can I remove the last character from a one line
file? 


That worked a dream,

Thanks Ed!
Dave

-Original Message-
From: Ed Gorski [mailto:[EMAIL PROTECTED]]
Sent: 28 May 2002 14:41
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] How can I remove the last character from a one line
file? 


Try:

$string=Jacko;
$string=substr($string,0,(strlen($string)-1));
echo $string;

ed

At 09:35 AM 5/28/2002 -0400, [EMAIL PROTECTED] wrote:
Hi all,

 How can I remove the last character from a one line file?
 i.e. I need to change Jacko to Jack


I would really appreciate a response on this!

Thank you!
Dave

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


Edmund Gorski
Programmer / Analyst
WWW Coordinator Dept. @ District Office
727-341-3181


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


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




RE: [PHP] Parse Error(newbie)

2002-05-29 Thread Niklas Lampén

mysql_query(delete from conf_event where time  ( time() );

You're missing the ending  there.


Niklas

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: 29. toukokuuta 2002 16:20
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Parse Error(newbie)


Line 81 is $query.

I showed it in my first email.

I suspect this line is the one causing the trouble(It is about four
lines above the start of the function and is the only previous PHP
statement) mysql_query(delete from conf_event where time  ( time() );

- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 29, 2002 11:11 PM
Subject: Re: [PHP] Parse Error(newbie)


 On Wednesday 29 May 2002 21:13, [EMAIL PROTECTED] wrote:
  Here is the function:
 
  function print_new_story(){
  $query = SELECT * FROM news ORDER BY id DESC LIMIT 1; $result = 
  mysql_query($query); $num_results = mysql_num_rows($result);
 
  for ($i=0; $i  $num_results; $i++)
{
   $row = mysql_fetch_array($result);
   echo 'h2a href=#: ';
   echo $row['title'];
   if(!$row['date'] == 0){
   echo ' - ';
   echo date(d-M-y, $row['date']);
   }
   echo ' :/a/h2br';
  include $row['int_location'];
}
 
  }
 
  and here is the error message:
  Parse error: parse error in \\johnh\c\co2 
  busters\includes\functions.php
on
  line 81

 We're not mind readers, which is line 81?

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development 
 *

 /*
 Would it help if I got out and pushed?
 -- Princess Leia Organa
 */


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


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


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




RE: [PHP] Getting only 255 chars from SQL Server

2002-05-13 Thread Niklas Lampén

The platform doesn't matter here, since VarChar's maximum length is 255
chars, so everything above that is cutted away on insert.
Creating table with VarChar(800) should give an error..


Niklas


-Original Message-
From: Michael Sims [mailto:[EMAIL PROTECTED]] 
Sent: 13. toukokuuta 2002 15:32
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Getting only 255 chars from SQL Server


On Sun, 12 May 2002 18:43:47 -0700, you wrote:

I have an SQL Server database running on a server on the internet. I
need to have php connecting to the db and returning values. Simple 
stuff. No problem making the connection and getting data using the
mssql 
functions. The weird thing is that 4 of the fields in the table are 
vchar fields of length 800. When getting the data from the db for the 
web page, all that gets returned are the first 255 characters of each 
field.

Are you using FreeTDS on *nix, or is this a Windows server making the
connection?

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


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




RE: [PHP] Getting only 255 chars from SQL Server

2002-05-13 Thread Niklas Lampén

Oh, it's different in msSQL. My mistake, sorry.. :)
My knowledge is based on mySQL, I thought that the field lengths were in
some sorta standard.


Niklas



-Original Message-
From: Sqlcoders.com Programming Dept [mailto:[EMAIL PROTECTED]] 
Sent: 14. toukokuuta 2002 1:46
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Getting only 255 chars from SQL Server


Taken from Microsoft SQL Server 2000 Reference (Transact-SQL Reference):

varchar[(n)]

Variable-length non-Unicode character data with length of n bytes. n
must be a value from 1 through 8,000. Storage size is the actual length
in bytes of the data entered, not n bytes. The data entered can be 0
characters in length. The SQL-92 synonyms for varchar are char varying
or character varying.



- Original Message -
From: Niklas Lampén [EMAIL PROTECTED]
To: Php-General [EMAIL PROTECTED]
Sent: May 13 2002 05:38 AM
Subject: RE: [PHP] Getting only 255 chars from SQL Server


 The platform doesn't matter here, since VarChar's maximum length is 
 255 chars, so everything above that is cutted away on insert. Creating

 table with VarChar(800) should give an error..


 Niklas


 -Original Message-
 From: Michael Sims [mailto:[EMAIL PROTECTED]]
 Sent: 13. toukokuuta 2002 15:32
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Getting only 255 chars from SQL Server


 On Sun, 12 May 2002 18:43:47 -0700, you wrote:

 I have an SQL Server database running on a server on the internet. I 
 need to have php connecting to the db and returning values. Simple 
 stuff. No problem making the connection and getting data using the
 mssql
 functions. The weird thing is that 4 of the fields in the table are 
 vchar fields of length 800. When getting the data from the db for the

 web page, all that gets returned are the first 255 characters of each

 field.

 Are you using FreeTDS on *nix, or is this a Windows server making the 
 connection?

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


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





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




RE: [PHP] Getting only 255 chars from SQL Server

2002-05-13 Thread Niklas Lampén

That is what I said before..
So can varchar be longer than 255 chars in MSSQL (or in any SQL)?
Actually this is not my problem, I'm doing well with mySQL (varchars
maximum length 255 :), but I'm getting interested here!


Niklas


-Original Message-
From: Matt Friedman [mailto:[EMAIL PROTECTED]] 
Sent: 13. toukokuuta 2002 16:00
To: 'Php-General'
Subject: RE: [PHP] Getting only 255 chars from SQL Server


If you want to make sure you get the whole string and it's fairly long,
like a paragraph of characters or something, the db field should be a
text field. Varchar is definitely no longer than 255 in MSSQL. You've
lost the data over 255 chars with your current setup. 

Matt Friedman
Web Applications Developer
www.SpryNewMedia.com


-Original Message-
From: Niklas Lampén [mailto:[EMAIL PROTECTED]] 
Sent: Monday May 13, 2002 8:56 AM
To: Php-General
Subject: RE: [PHP] Getting only 255 chars from SQL Server

Oh, it's different in msSQL. My mistake, sorry.. :)
My knowledge is based on mySQL, I thought that the field lengths were in
some sorta standard.


Niklas



-Original Message-
From: Sqlcoders.com Programming Dept [mailto:[EMAIL PROTECTED]] 
Sent: 14. toukokuuta 2002 1:46
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Getting only 255 chars from SQL Server


Taken from Microsoft SQL Server 2000 Reference (Transact-SQL Reference):

varchar[(n)]

Variable-length non-Unicode character data with length of n bytes. n
must be a value from 1 through 8,000. Storage size is the actual length
in bytes of the data entered, not n bytes. The data entered can be 0
characters in length. The SQL-92 synonyms for varchar are char varying
or character varying.



- Original Message -
From: Niklas Lampén [EMAIL PROTECTED]
To: Php-General [EMAIL PROTECTED]
Sent: May 13 2002 05:38 AM
Subject: RE: [PHP] Getting only 255 chars from SQL Server


 The platform doesn't matter here, since VarChar's maximum length is
 255 chars, so everything above that is cutted away on insert. Creating

 table with VarChar(800) should give an error..


 Niklas


 -Original Message-
 From: Michael Sims [mailto:[EMAIL PROTECTED]]
 Sent: 13. toukokuuta 2002 15:32
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Getting only 255 chars from SQL Server


 On Sun, 12 May 2002 18:43:47 -0700, you wrote:

 I have an SQL Server database running on a server on the internet. I
 need to have php connecting to the db and returning values. Simple 
 stuff. No problem making the connection and getting data using the
 mssql
 functions. The weird thing is that 4 of the fields in the table are
 vchar fields of length 800. When getting the data from the db for the

 web page, all that gets returned are the first 255 characters of each

 field.

 Are you using FreeTDS on *nix, or is this a Windows server making the
 connection?

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


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





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



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


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




RE: [PHP] Generating PINs

2002-05-13 Thread Niklas Lampén

Well, you could produce those randomly. Store all the PINs to a database
and before storing compare that it doesn't exist yet. Here is a piece of
code to produce PINs in _exactly_ that format you want. I've done it for
myself, but feel free to use it in any way you like:


?
srand((double) microtime() * 100);

for ($i=0; $i  3; $i++) { // $i  3 tells you how many 'parts' there
should be

for ($n=0; $n  5; $n++) { // $n  5 tells you how many chars
there is in each part
$nType = rand(1,3);
if ($nType == 1) // A number between 0 - 9
$strChar = rand(0,9);
elseif ($nType == 2) { // A small letter between a - z
$strChar = chr(rand(65,90));
} elseif ($nType == 3) { // A capital letter between A -
Z
$strChar = chr(rand(97,122));
};

$strCode .= $strChar;
};
// If it ain't the last part, add the separator char
if ($i != 2)
$strCode .= -;
};
?


Niklas

-Original Message-
From: Alvin Tan [mailto:[EMAIL PROTECTED]] 
Sent: 14. toukokuuta 2002 7:13
To: [EMAIL PROTECTED]
Subject: [PHP] Generating PINs


Hi All,

This is not really a PHP question, but seeing that the final application

will be in PHP, I figured this'll be the best place to start.

I have a client who wants to release a unique PIN for each product they 
sell which works as a key to get more goodies on the website. How/where
can 
I get a large number of PINs, much like a software key (e.g. 
3HH5R-E59VB-7SX99 or similar)?

TIA
@lvin


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


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




RE: [PHP] how to generate a date between 1998 and today by random?

2002-05-07 Thread Niklas Lampén

array_rand() might be the solution for you.


Niklas

-Original Message-
From: andy [mailto:[EMAIL PROTECTED]] 
Sent: 7. toukokuuta 2002 16:12
To: [EMAIL PROTECTED]
Subject: [PHP] how to generate a date between 1998 and today by random?


hi there,

I am wondering if there is an easy way to generate a random date. It
would work by creating arrays of values and then just selecting like:

$year = array(2002, 2003, 2004, 2005);
$month = array
('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Okt','Nov','Dez
');

$date = $month[rand(0,count($month))].' '.rand(0,31).',
'.$year[rand(0,count($year))];

But there might be an easyer and faster (better performant) way.

Thanx for any help,

Andy



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


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




RE: [PHP] Soring an array

2002-04-09 Thread Niklas Lampén

You could use these two functions:

array_unique(); and sort();


Niklas

-Original Message-
From: Vasoczki Ferenc [mailto:[EMAIL PROTECTED]] 
Sent: 9. huhtikuuta 2002 11:26
To: Php Mailing List (E-mail)
Subject: [PHP] Soring an array


Hi!

I am new on this list, so i welcome everybody!
/sorry if my english is not too good/

My problem is:
I want to sort an array.
I found the array_multisort funciton in the help, but that is for
multidimensional arrays, or 2 or more arrays.

What i need exactly.

I have 5 MySQL tables, and i want to collect some informations from all
theese tables, and then get out only the different items.
Like: 1st table: 1,2,3  2nd: 2,4,3  3rd: 5,1,5

I need an array, what will include 1,2,3,4,5

So i thought, i collect all the numbers in 1 array, then sort it, and
then get out the duplicat items.

Any suggestion ?

Thx

Vaso


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


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




RE: [PHP] Returning mutliple matches of a regex with preg_match()

2002-03-20 Thread Niklas Lampén

preg_match_all();


Niklas

-Original Message-
From: Stefen Lars [mailto:[EMAIL PROTECTED]] 
Sent: 21. maaliskuuta 2002 7:28
To: [EMAIL PROTECTED]
Subject: [PHP] Returning mutliple matches of a regex with preg_match()


Hello all

I have been scratching my head for the last two days about this regular 
expression problem. I would be really VERY happy if someone could help
me!

I have the following text in the file 'text.htm', for example:

--

BLOCKQUOTEP
Cow, Cow, Cow, Cow, Cow
Cow, Cow, Cow, Cow, Cow
Cow, Cow, Cow, Cow, Cow
a lot of lines
/P/BLOCKQUOTE

pboring stuff - we are not interested in this/p

BLOCKQUOTEP
Chicken, Chicken, Chicken
Chicken, Chicken, Chicken
Chicken, Chicken, Chicken
more lines
/P/BLOCKQUOTE

pmore boring stuff - we are not interested in this/p

BLOCKQUOTEP
Rabbit, Rabbit, Rabbit, Rabbit

/P/BLOCKQUOTE

peven more boring stuff - we are not interested in this/p

BLOCKQUOTEP
Pig, Pig, Pig, Pig, Pig
/P/BLOCKQUOTE

--

I want to return all the stuff between BLOCKQUOTEP ...
/P/BLOCKQUOTE 
in an array. One element per match. For example, for the above text, I
would 
like to get back an array back like this:

array(
Cow, Cow, Cow, Cow, Cow Cow, Cow, Cow, Cow, Cow Cow, Cow, Cow,
Cow, Cow a 
lot of lines,
Chicken, Chicken, Chicken Chicken, Chicken, Chicken Chicken,
Chicken, 
Chicken more lines,
Rabbit, Rabbit, Rabbit, Rabbit,
Pig, Pig, Pig, Pig, Pig
)

I have been trying to do this with (many variations of) the following
code:

--

?PHP

// open file
$fd = fopen (./text.htm, r);

// load contents into a variable
while (!feof ($fd))
{
$content .= fgets($fd, 4096);
}

// close file
fclose ($fd);

// remove char returns and co.
$content = preg_replace(/(\r\n)|(\n\r)|(\n|\r)/,  ,$content);

// match agains regex -- this does not work correctly
if 
(preg_match(/BLOCKQUOTEP(.*)\/P\/BLOCKQUOTE/i,$content,$matche
s))
{
echo pre;
var_dump($matches);
echo /pre;
}

?

--

For the above, var_dump() returns this:

--

array(2) {
  [0]=
  string(556) BLOCKQUOTEP Cow, Cow, Cow, Cow, Cow Cow, Cow, Cow,
Cow, 
Cow Cow, Cow, Cow, Cow, Cow a lot of lines /P/BLOCKQUOTE  pboring 
stuff - we are not interested in this/p  BLOCKQUOTEP Chicken, 
Chicken, Chicken Chicken, Chicken, Chicken Chicken, Chicken, Chicken
more 
lines /P/BLOCKQUOTE  pmore boring stuff - we are not interested in

this/p  BLOCKQUOTEP Rabbit, Rabbit, Rabbit, Rabbit  
/P/BLOCKQUOTE  peven more boring stuff - we are not interested in 
this/p  BLOCKQUOTEP Pig, Pig, Pig, Pig, Pig /P/BLOCKQUOTE
  [1]=
  string(524)  Cow, Cow, Cow, Cow, Cow Cow, Cow, Cow, Cow, Cow Cow,
Cow, 
Cow, Cow, Cow a lot of lines /P/BLOCKQUOTE  pboring stuff - we are
not 
interested in this/p  BLOCKQUOTEP Chicken, Chicken, Chicken 
Chicken, Chicken, Chicken Chicken, Chicken, Chicken more lines 
/P/BLOCKQUOTE  pmore boring stuff - we are not interested in 
this/p  BLOCKQUOTEP Rabbit, Rabbit, Rabbit, Rabbit  
/P/BLOCKQUOTE  peven more boring stuff - we are not interested in 
this/p  BLOCKQUOTEP Pig, Pig, Pig, Pig, Pig 
}

--

Clearly not what I want.

Is my approach here incorrect? Or is it indeed possible to construct a
regex 
to do what I want (with just one pass of the text)?

Thank you in advance.

:-))

S.






_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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


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




RE: [PHP] how to pass values to PHP by clicking on imagemap

2002-03-19 Thread Niklas Lampén

Just declare the link to have variable to be a number depending on point
where user clicks:

www.server.com/mypage.php?number=1

Now the variable $number is set to '1'.


Niklas

-Original Message-
From: Simon De Deyne [mailto:[EMAIL PROTECTED]] 
Sent: 19. maaliskuuta 2002 11:50
To: [EMAIL PROTECTED]
Subject: [PHP] how to pass values to PHP by clicking on imagemap


does anybody has a good suggestion for doing this?
I just would like to pass a number by clicking on an imagemap to a php
script...

Sorry for the novice-ity of this mail,
have a nice day!
simon


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


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




RE: [PHP] Calling Javascript-function from php-script ...

2002-03-19 Thread Niklas Lampén

AFAK it's not possible since PHP is server-side and I guess your
JavaScript is client-side.


Niklas


-Original Message-
From: Marcel Besancon [mailto:[EMAIL PROTECTED]] 
Sent: 19. maaliskuuta 2002 14:05
To: [EMAIL PROTECTED]
Subject: [PHP] Calling Javascript-function from php-script ...


Hi everybody,

is there someone who can tell me how to call a javascript-function
by a php-script.

Thanks for each answer

Marcel

--
registered Fli4l-User #0388



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


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




RE: [PHP] Calling Javascript-function from php-script ...

2002-03-19 Thread Niklas Lampén

Then you need to do it like this:

? if ($myVal == ---) { ?
script language=JavaScript
alert(DOH!);
/script
? }; ?

But you can not make PHP call javascript functions directly.


Niklas


-Original Message-
From: Marcel Besancon [mailto:[EMAIL PROTECTED]] 
Sent: 19. maaliskuuta 2002 14:20
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Calling Javascript-function from php-script ...


Hi,

i know that one is server-side and the other is client-side. But
what i meant ist the following. I have a script with a form. By
submitting this form and checking out some values php should call a
javascript-function (such as an alert). You see the php-script shall
call the javascript-function by refreshing the whole page.

Bye,

Marcel

--
registered Fli4l-User #0388
Scott Furt [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Short answer: no.

 Long answer: have the PHP script output javascript code
 to the browser.

 PHP = server-side
 Javascript = client-side

 Marcel Besancon wrote:
  Hi everybody,
 
  is there someone who can tell me how to call a 
  javascript-function
by a
  php-script.
 
  Thanks for each answer
 
  Marcel
 
  --
  registered Fli4l-User #0388
 
 
 
 





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


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




RE: [PHP] Is there any Possible Way to get data from Excel File?

2002-03-19 Thread Niklas Lampén

I think that the smartest way to insert data from Excel to mySQL is
saving Excel file as CSV and then inserting the whole file. This is
ofcourse only if you wan't to insert the whole file.


Niklas


-Original Message-
From: Jack [mailto:[EMAIL PROTECTED]] 
Sent: 20. maaliskuuta 2002 8:01
To: [EMAIL PROTECTED]
Subject: [PHP] Is there any Possible Way to get data from Excel File?


Dear all
What i'm planning to do is to use php to grep the data from a Excel file
and then insert it to the MySQL Database, so is there any possible way
that the php can grep the data from an Excel File?

Thx all
Jack
[EMAIL PROTECTED]




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


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




RE: [PHP] Timing PHP

2002-03-18 Thread Niklas Lampén

microtime() function's manual entry tells you exactly what you want to
do. :)


Niklas

-Original Message-
From: Stig Kronback [mailto:[EMAIL PROTECTED]] 
Sent: 18. maaliskuuta 2002 12:00
To: [EMAIL PROTECTED]
Subject: [PHP] Timing PHP


Dear ?

I need to see how long it takes for my php-scripts to
execute, what can I do, doesn't PHP include a function
that will show that information?

Regards,
Stig

=
Stig Kronback Andersen
Drejervej 13, st
2400 Koebenhavn NV
Denmark
Phone: +45 35310382
E-mail: [EMAIL PROTECTED]

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts http://uk.my.yahoo.com

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


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




RE: [PHP] array within an array

2002-03-15 Thread Niklas Lampén

$array[0][1] is how you access multi-dimensional arrays.


Niklas

-Original Message-
From: Caspar Kennerdale [mailto:[EMAIL PROTECTED]] 
Sent: 15. maaliskuuta 2002 15:18
To: [EMAIL PROTECTED]
Subject: [PHP] array within an array


I have an sql query which calls * rows from a table.

Each row is an array of table field values.

This is how I understand the heirachy

$table_row_array[0] = $field_row_array[]
$table_row_array[1] = $field_row_array[]
$table_row_array[2] = $field_row_array[]

Now $table_row_array is being drawn from the database via a while loop
and an $a++, thus I do not have a name for $field_row_array-

I just know that the value of each in $table_row_array is an array.

How can I access the values within $filed_row_array[]?

I want to do something like

$table_row_array[0 [1]]; (the second value from the array that is the
first of $table_row_array)

I know this isnt the syntax

Thanks in advance





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


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




RE: [PHP] array within an array (one more query)

2002-03-15 Thread Niklas Lampén

Yes.


Niklas

-Original Message-
From: Caspar Kennerdale [mailto:[EMAIL PROTECTED]] 
Sent: 15. maaliskuuta 2002 15:35
To: Php-General
Subject: RE: [PHP] array within an array (one more query)


can you therefore have $array[0][9][2][3]

if you had an array within an array within an array within an array.

(not sure i'd want to, but you never know)



$array[0][1] is how you access multi-dimensional arrays.


Niklas

-Original Message-
From: Caspar Kennerdale [mailto:[EMAIL PROTECTED]]
Sent: 15. maaliskuuta 2002 15:18
To: [EMAIL PROTECTED]
Subject: [PHP] array within an array


I have an sql query which calls * rows from a table.

Each row is an array of table field values.

This is how I understand the heirachy

$table_row_array[0] = $field_row_array[]
$table_row_array[1] = $field_row_array[]
$table_row_array[2] = $field_row_array[]

Now $table_row_array is being drawn from the database via a while loop
and an $a++, thus I do not have a name for $field_row_array-

I just know that the value of each in $table_row_array is an array.

How can I access the values within $filed_row_array[]?

I want to do something like

$table_row_array[0 [1]]; (the second value from the array that is the
first of $table_row_array)

I know this isnt the syntax

Thanks in advance





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


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


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


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


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




RE: [PHP] Hi some logic help is required!!!!!

2002-03-14 Thread Niklas Lampén

First of all, take that 'I want to know when you received my e-mail'
-thingie away. It's anoying.

But to the solution:

if ((x  A || x  B)  (y  A || x  B))
{
do something..
}


Niklas


-Original Message-
From: Balaji Ankem [mailto:[EMAIL PROTECTED]] 
Sent: 14. maaliskuuta 2002 13:51
To: Php-General
Subject: [PHP] Hi some logic help is required!



Hi friend,
I need some help on this logic...


1. I have some range (A to B) which is fixed and A,B are very large
numbers.(AB)

2. I have X to Y and I want to check this range should not match with A
to B.

How can I check this?


Ex:

1)  A=4   B=8

Totally 4 cases will come!!

X=2 Y=5
X=5 Y=6
X=2 Y=9
X=6 Y=9

In all the above cases that logic should return false.

How can I solve this?? Don't use for loop!(Because those are
very large numbers (chrores))

And logic should be simple and cute!


Cheers
Balaji



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




RE: [PHP] Hi some logic help is required!!!!!

2002-03-14 Thread Niklas Lampén

Last X should be Y.


Niklas


-Original Message-
From: Niklas Lampén [mailto:[EMAIL PROTECTED]] 
Sent: 14. maaliskuuta 2002 14:05
To: Php-General
Subject: RE: [PHP] Hi some logic help is required!


First of all, take that 'I want to know when you received my e-mail'
-thingie away. It's anoying.

But to the solution:

if ((x  A || x  B)  (y  A || x  B))
{
do something..
}


Niklas


-Original Message-
From: Balaji Ankem [mailto:[EMAIL PROTECTED]] 
Sent: 14. maaliskuuta 2002 13:51
To: Php-General
Subject: [PHP] Hi some logic help is required!



Hi friend,
I need some help on this logic...


1. I have some range (A to B) which is fixed and A,B are very large
numbers.(AB)

2. I have X to Y and I want to check this range should not match with A
to B.

How can I check this?


Ex:

1)  A=4   B=8

Totally 4 cases will come!!

X=2 Y=5
X=5 Y=6
X=2 Y=9
X=6 Y=9

In all the above cases that logic should return false.

How can I solve this?? Don't use for loop!(Because those are
very large numbers (chrores))

And logic should be simple and cute!


Cheers
Balaji



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


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




RE: [PHP] rand()

2002-03-13 Thread Niklas Lampén

Use two rand()'s.

$foo = rand(2);

if ($foo == 0)
rand(first_set);
else
rand(second_set);


Niklas

-Original Message-
From: Jeff Sittler [mailto:[EMAIL PROTECTED]] 
Sent: 14. maaliskuuta 2002 7:50
To: [EMAIL PROTECTED]
Subject: Re: [PHP] rand()


the min and max would work if I wanted the number between 33 and 146,
but I am wanting to specify two ranges, not just one.

Please RTFP

Jeff
Jason Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 On Thursday 14 March 2002 13:31, Jeff Sittler wrote:
  I am wanting to use rand() to generate a number between 33-90 OR
125-146.
  Is there a way to do this?  I don't want any numbers before 33 or
between
  91-124 or after 146.  Could someone point me in the direction I need

  to look to accomplish this.

 rand(min, max);

 Please RTFM.

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk

 /*
 Man and wife make one fool.
 */



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


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




RE: [PHP] Hi How to convert the time from mysql(DATETIME) table to the format DD/MM/YYYY HH:MM AM or PM in PHP?

2002-03-12 Thread Niklas Lampén

Do you want to do this in mySQL or PHP?


Niklas

-Original Message-
From: Balaji Ankem [mailto:[EMAIL PROTECTED]] 
Sent: 12. maaliskuuta 2002 12:30
To: 'Php-General'
Subject: [PHP] Hi How to convert the time from mysql(DATETIME) table to
the format DD/MM/ HH:MM AM or PM in PHP?


Hi,
I have stored the date and time in mysql table with DATETIME
type.

I want to change it in to DD/MM/ HH:MM AM or PM.

How can I do this?

Thanks in advance
Balaji



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




RE: [PHP] Hi How to convert the time from mysql(DATETIME) table to the format DD/MM/YYYY HH:MM AM or PM in PHP?

2002-03-12 Thread Niklas Lampén

You have to parse your dates in anyway you like best to pieces, then use
mktime() and then date() function. :)


Niklas

-Original Message-
From: Balaji Ankem [mailto:[EMAIL PROTECTED]] 
Sent: 12. maaliskuuta 2002 12:35
To: [EMAIL PROTECTED]; 'Php-General'
Subject: RE: [PHP] Hi How to convert the time from mysql(DATETIME) table
to the format DD/MM/ HH:MM AM or PM in PHP?


Thankyou for reply!!

I want to do it in PHP.

Thanks in advance
Balaji

-Original Message-
From: Niklas Lampén [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, March 12, 2002 4:04 PM
To: Php-General
Subject: RE: [PHP] Hi How to convert the time from mysql(DATETIME) table
to the format DD/MM/ HH:MM AM or PM in PHP?


Do you want to do this in mySQL or PHP?


Niklas

-Original Message-
From: Balaji Ankem [mailto:[EMAIL PROTECTED]] 
Sent: 12. maaliskuuta 2002 12:30
To: 'Php-General'
Subject: [PHP] Hi How to convert the time from mysql(DATETIME) table to
the format DD/MM/ HH:MM AM or PM in PHP?


Hi,
I have stored the date and time in mysql table with DATETIME
type.

I want to change it in to DD/MM/ HH:MM AM or PM.

How can I do this?

Thanks in advance
Balaji



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



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




RE: [PHP] Re: A stupid question...

2002-03-11 Thread Niklas Lampén

An option too:

SELECT * FROM table WHERE SURNAME LIKE 'a%' ORDER BY surname ASC


Niklas

-Original Message-
From: liljim [mailto:[EMAIL PROTECTED]] 
Sent: 11. maaliskuuta 2002 11:09
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: A stupid question...


Hi chuck,

use left()

assuming your column is called name, then something like this will do:

$letter = a;

$get = @mysql_query(SELECT * FROM table WHERE LEFT(surname, 1) =
'$letter' ORDER BY surname ASC);

That should get out all of the fields beginning with a or A and list
them alphabetically.

Hope that's of some help.


James

Chuck Pup Payne [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I want to sort by a letter in a colomn. Let say I want to sort the 
 colomn last_name. I can do order by but I can do just the A's.

 http://www.myserver.com/mysort.php?Letter=A

 Like to create a link on a web A then sort only the last name are A.

 I hope that's helps. I can order by, but I can't so a sort like the
example
 above.

 Chuck Payne
 Magi Design and Support


  on 3/10/02 9:42 PM, Cary at [EMAIL PROTECTED] wrote:
 
  At 08:24 PM 3/10/02, Chuck \PUP\ Payne wrote:
  Hi,
 
  I not a newie but I am not a pro at mysql either. I want to do a 
  query
by
  letter(a, b, c..ect.). Is there a simple way to do it. I am 
  writing in
PHP.
  So can someone please so me the how.
 
 
  I'm not totally sure what your looking for. If you could elaborate 
  a
little
  I am sure that one of us could help you out.
 
  Cary
 
 
 
 




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


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




RE: [PHP] How to get the local date formated like this: 2002-03-15 Y2K Problem

2002-03-05 Thread Niklas Lampén

date(Y-m-d);


Niklas

-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]] 
Sent: 5. maaliskuuta 2002 9:59
To: [EMAIL PROTECTED]
Subject: [PHP] How to get the local date formated like this: 2002-03-15
Y2K Problem


Hi there,

I am trying to find out how to get the local date in a format conform to
this: 2002-03-15.

The following code is a try, but it does not work like I want:

$local_time = localtime(time() , 1);
echo Date:  .
$local_time[tm_year].'-'.$local_time[tm_mon].'-'.$local_time[tm_mday];

Returns: Date: 102-2-5
The prob is, that tm_year is not y2k compliant and the 0 are missing for
month and day

The goal is to find out, if a date provided by the user is in the future
or not. His date is in this format: [-mm-dd]

Has anybody an idea?

Thanx,

Andy



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


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




RE: [PHP] exists?

2002-03-05 Thread Niklas Lampén

Do you have manual at all? Download it from www.php.net.

The function ereg() is your answer.


Niklas

-Original Message-
From: jtjohnston [mailto:[EMAIL PROTECTED]] 
Sent: 5. maaliskuuta 2002 10:29
To: [EMAIL PROTECTED]
Subject: [PHP] exists?


It's late, I'm tired.
I want to parse $searchenquiry

if(% exists in $searchenquiry)
{
do ...
}else{
do ...
}



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


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




RE: [PHP] stripslashes in web forms

2002-03-04 Thread Niklas Lampén

This should do it:

?
$test = 17\ blah;
$test = stripslashes($test);
?
input type=text name=test value=?=htmlspecialchars($test)?


Niklas


-Original Message-
From: Claudiu [mailto:[EMAIL PROTECTED]] 
Sent: 4. maaliskuuta 2002 11:56
To: [EMAIL PROTECTED]
Subject: [PHP] stripslashes in web forms


Here is the ideea.. i have a string variable $test that contains let's
say : 17 Normally the output on the screen of this string would be echo
$test; --- 17 \

There is this function stripslashes which gives me the oportunity to
output exactly what i want... i mean 17 .. .but this doesnt seem to
work in an input box in a web form... it outputs only 17 and somehow
misses the  ... What is there to do?

Thanks in advance..
Claus



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


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




RE: [PHP] keeping the dot

2002-03-04 Thread Niklas Lampén

Don't don't don't me.. ehehehehee... %P


Niklas

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: 4. maaliskuuta 2002 12:20
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] keeping the dot


Don't don't me.

Regards,
Joseph A. Bannon

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


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




RE: [PHP] case insenstive

2002-03-04 Thread Niklas Lampén

if (eregi(^a, $author))
{
print blah!;
}


Niklas

-Original Message-
From: jtjohnston [mailto:[EMAIL PROTECTED]] 
Sent: 5. maaliskuuta 2002 8:08
To: [EMAIL PROTECTED]
Subject: [PHP] case insenstive


I need to make this case insensitive. This seems like over kill?

 if((substr($author, 0, 1) == a) or (substr($author, 0, 1) == a)) {
}


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


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




RE: [PHP] RE: sending multiple frames to different pages

2002-02-28 Thread Niklas Lampén

You can use javascript.
If you're calling this from a frame, this is how it works:

parent.frames[first_frame / zero based number].location.href =
my_page.php;
parent.frames[second_name / zero based number].location.href =
my_page2.php;

Problem with this is that if user clicks Back button in browser, only
second_frame will go -1 in history. Better solution would be making
the pages creating frames to get variables for frames, so you could send
variables with page names to it.

frameset
frame src=?=$FirstFrame?
frame src=?=$SecondFrame?
/frameset


Niklas

-Original Message-
From: Matthew Darcy [mailto:[EMAIL PROTECTED]] 
Sent: 1. maaliskuuta 2002 9:03
To: [EMAIL PROTECTED]
Subject: [PHP] RE: sending multiple frames to different pages





Hello all

I have just created a login script that works fine. At the moment I have
a pretty simple (I have coded this but I am trying to keep it simple to
explain what I am after

if login != ok then

generate HTML for error page

else

Generate HTML for ok page.

end;


what I want to do is

if login != ok then

generate HTML for error page

else

send browser frame1 to www.loginok.com
AND
send broswer frame2 to www.loginfeatures.com

end



can someone show me how to do the browser re-direction to multiple pages
please ?? Also can someone explain the different ways to send
frames/browser to a different page with PHP.

Thanks,

Matt


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


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




RE: [PHP] create a file

2002-02-28 Thread Niklas Lampén

fopen(file, w)

-Original Message-
From: Thomas Franz [mailto:[EMAIL PROTECTED]] 
Sent: 1. maaliskuuta 2002 9:55
To: [EMAIL PROTECTED]
Subject: [PHP] create a file


good morning,

i want to create a new file and save it in the current dir. I look in
the manual but only i found how to create a dir.

Thanks for help.

Thomas



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


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




RE: [PHP] isset?

2002-02-27 Thread Niklas Lampén

If $submit is 0/NULL/FALSE and you do if ($submit) you'll receive
FALSE.
With if (isset($submit)) you'll receive TRUE.

In other words, isset() checks if variable is set at all and is() checks
if the expression is true.


Niklas



-Original Message-
From: jtjohnston [mailto:[EMAIL PROTECTED]] 
Sent: 28. helmikuuta 2002 7:34
To: [EMAIL PROTECTED]
Subject: [PHP] isset?


So what is the good of isset? What does if(isset($submit)) do
differently than if($submit) ??

J


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


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




RE: [PHP] foreach not in reach

2002-02-22 Thread Niklas Lampén

You didn't supply any information about you foreach() loop, but it works
like

foreach ($array as $string)
print $elementbr\n;

And explode() returns an array, so I think you need to do it like this:

$array = explode(;, $string);
array_push($authors, $array); // You could use foreach() here as well


Niklas


-Original Message-
From: jtjohnston [mailto:[EMAIL PROTECTED]] 
Sent: 22. helmikuuta 2002 8:48
To: [EMAIL PROTECTED]
Subject: [PHP] foreach not in reach


Question 1:
How can I append strings to my authors array?
Me thinks this doesn't work :§) ?
$authors .= explode(;, $mydata-KW);
I'm getting Invalid argument supplied for foreach()

Question 2:
Once I get this working, I want to (a) alphabetise the contents of the
array, (b) count repititions, (c) elimintate copies, and create an array
I can print with tow things $author[i]\t$counter[i], so I end up with
something like:

Adam2
Louis5
John3
Mary8



$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query(select KW from $table);

while ($mydata = mysql_fetch_object($news))
{
$authors .= explode(;, $mydata-KW);
}

foreach ($authors as $author)
{
echo $authorbr\n;
}


I'm learning, slowly but surely Martin :)
J


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


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




RE: [PHP] Mysql_num_rows

2002-02-18 Thread Niklas Lampén

Maybe you can round the problem with

if ($num  1)
echo Nothing today!;
else
echo Something to do today!;

if (!isset($num) || $num == 0)...


Niklas


-Original Message-
From: Frank Miller [mailto:[EMAIL PROTECTED]] 
Sent: 18. helmikuuta 2002 16:05
To: [EMAIL PROTECTED]
Subject: [PHP] Mysql_num_rows


Thanks to everyone that helped me with my last problem I've run into 
another problem and was wondering if someone here could offer any help
or 
suggestions.  The project I'm working on is an event calender. It does 
several things but the problem I've run into is when I click a date on
the 
calendar if there are no events for that day I want to print a message
on 
the web page saying as much.  I've read the documentaion that said if
I'm 
using a select statement to use mysql_num_rows and that it returns an 
integer. Here is a snippet of my code

$query = SELECT *,TIME_FORMAT(eventtime, '%l:%i %p')AS eventtime, 
DATE_FORMAT(dateofevent,'%M %e, %Y') AS fdateofevent  FROM tamutevents 
where refid=$refid;

$result = mysql_query($query,$connection) or die(Error in Query); $num
= mysql_num_rows($result);


Next I say  if ($num == 0)
{
  echo  There are no events scheduled today!;
}
else
 {
 echo blah, blah, blah;
}

The problem is if there are no records that match the select then it
always 
goes to the  else part.  I've tried printing the value of $num and it
works 
if there is something scheduled but when there is nothing scheduled $num

shows nothing on the screen.

I'm using Mysql 3.23.38 and php 4.06 on a windows test machine but it
works 
the same on php 4.06 and Mysql 3.23.46 on my Linux server.

Has anyone else run into this and if so can you tell me what to do about
it.

Thanks in advance - Frank


Frank Miller
Computer Specialist and Webmaster
Technology and Distance Education
Texas AM University-Texarkana
2600 North Robison Rd
Texarkana, Texas 75501

Phone:  903-223-3156
Fax:  903-223-3139
Office:   165


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


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




RE: [PHP] date problem

2002-02-18 Thread Niklas Lampén

date() is your answer, use it in the piece of code generating the query.
$DateTime = date(Y-m-d H:i:s); // 2002-02-18 16:10:43


Niklas


-Original Message-
From: eoghan [mailto:[EMAIL PROTECTED]] 
Sent: 18. helmikuuta 2002 16:14
To: [EMAIL PROTECTED]
Subject: [PHP] date problem


hello

i am running into some trouble with a very basic problem.
i want to insert the current date/time into my db. i have 
the field set up as a datetime field. when i submit info,
i just get a blank date, i mean it all zeros, like
-00-00 00.00:00:00. how do i insert the current datetime into my db?
i tried using a hidden field with a foramtted gmt date value, but its
not working... any help

thanks - eoghan

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


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




RE: [PHP] Mysql_num_rows

2002-02-18 Thread Niklas Lampén

Do everything as you did, except for that if-statement.

$Query = SELECT * FROM table;
$Results = mysql_query($Query);
$num = mysql_num_rows($Results);

if ($num  1 || !isset($num))
echo Nothing here!;
else
echo Do something today!;


Niklas

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent: 18. helmikuuta 2002 16:27
To: Php-General; ':[EMAIL PROTECTED]'
Subject: RE: [PHP] Mysql_num_rows


Please show your exact code, because your code snippet looks right.

Then, again, maybe it's because it's an Aggie machine...GRIN

-Original Message-
From: Niklas Lampén [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 18, 2002 8:11 AM
To: Php-General
Subject: RE: [PHP] Mysql_num_rows


Maybe you can round the problem with

if ($num  1)
echo Nothing today!;
else
echo Something to do today!;

if (!isset($num) || $num == 0)...


Niklas


-Original Message-
From: Frank Miller [mailto:[EMAIL PROTECTED]] 
Sent: 18. helmikuuta 2002 16:05
To: [EMAIL PROTECTED]
Subject: [PHP] Mysql_num_rows


Thanks to everyone that helped me with my last problem I've run into 
another problem and was wondering if someone here could offer any help
or 
suggestions.  The project I'm working on is an event calender. It does 
several things but the problem I've run into is when I click a date on
the 
calendar if there are no events for that day I want to print a message
on 
the web page saying as much.  I've read the documentaion that said if
I'm 
using a select statement to use mysql_num_rows and that it returns an 
integer. Here is a snippet of my code

$query = SELECT *,TIME_FORMAT(eventtime, '%l:%i %p')AS eventtime, 
DATE_FORMAT(dateofevent,'%M %e, %Y') AS fdateofevent  FROM tamutevents 
where refid=$refid;

$result = mysql_query($query,$connection) or die(Error in Query); $num
= mysql_num_rows($result);


Next I say  if ($num == 0)
{
  echo  There are no events scheduled today!;
}
else
 {
 echo blah, blah, blah;
}

The problem is if there are no records that match the select then it
always 
goes to the  else part.  I've tried printing the value of $num and it
works 
if there is something scheduled but when there is nothing scheduled $num

shows nothing on the screen.

I'm using Mysql 3.23.38 and php 4.06 on a windows test machine but it
works 
the same on php 4.06 and Mysql 3.23.46 on my Linux server.

Has anyone else run into this and if so can you tell me what to do about
it.

Thanks in advance - Frank


Frank Miller
Computer Specialist and Webmaster
Technology and Distance Education
Texas AM University-Texarkana
2600 North Robison Rd
Texarkana, Texas 75501

Phone:  903-223-3156
Fax:  903-223-3139
Office:   165


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


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

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


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




RE: [PHP] PHP_SELF Undefined

2002-02-18 Thread Niklas Lampén

I had this problem while running PHP under windows. I solved (well,
rounded :) the problem with $SCRIPT_NAME (if I remember it right) which
gives the very same result.


Niklas


-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED]] 
Sent: 19. helmikuuta 2002 8:05
To: [EMAIL PROTECTED]
Subject: Re: [PHP] PHP_SELF Undefined


 When I execute the code below, why is PHP_SELF undefined? I will
appretiate
 any help on this. I can get its value by:
  echo $_SERVER[PHP_SELF];Thanks in advance! -Teresa

Is your PHP install = version 4.1.0 ?

You can test with a call to phpinfo();

If your version is less than 4.1.0, try the global variable $PHP_SELF
instead.


Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/




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


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




RE: [PHP] Setting up group mailer

2002-02-13 Thread Niklas Lampén

Firstly:
Keep track very carefully to whom you've allready sent the message, it
might allways crash.

Second:
Add some Sleep()'s so it won't kill your mailserver.

Third:
Don't spam. :)


Niklas


-Original Message-
From: phantom [mailto:[EMAIL PROTECTED]] 
Sent: 14. helmikuuta 2002 9:11
To: [EMAIL PROTECTED]
Subject: [PHP] Setting up group mailer


I am planning a script that will send mail to all my clients
(potentially up to 1, even more clients)...  I figured I can loop a
mailer script for every client (I don't want to have more than one email
address per message in the recipient field).

Any special advise or pages I could view for help or is looping a mailer
script acceptable?  I know I had one in ASP once upon a time and the
script was so slow that it would mail about 100 messages in a minute and
the script would time out quickly before I was done.

Thanks.


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


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




RE: [PHP] Tricky array question

2002-02-05 Thread Niklas Lampén

It should be $category[0] = $glacier;
^--- ERROR in you code


Niklas


-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]] 
Sent: 5. helmikuuta 2002 11:59
To: [EMAIL PROTECTED]
Subject: [PHP] Tricky array question


Hi there,

I have a tricky array question.

My app is passing via post a array variable called glacier. Now I am
checking for the content of this array. Because there are more of those
arrays, I am getting all the names out of a db.

How is it possible to get the value and keep the name of the array
dynamic?

e.g:
Array name passed by post is: $glacier
//
contains e.g. $glacier[0] = testname
Array with category names coming out of db is:   $category // contains
e.g.
$category[0] = glacier

 echo $categories[0]; // returns glacier
 echo $glacier[0];  // returns testname

I tryed $categories[0][0] but it returns only the first letter of
glacier
(g)

Any ideas??

Thanx, Andy




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


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




RE: [PHP] Re: Tricky array question

2002-02-05 Thread Niklas Lampén

I think you should ignore that. I use it all the times, and it works
fine.


Niklas


-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]] 
Sent: 5. helmikuuta 2002 12:37
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Tricky array question


Hello Rainer,

what kind of disadvantages do I take with me, if my form does not
validate? Is this a problem because of the spiders, or the
functionality?

It works fine so far on all browsers I know.

Can you please give more details?

Thanx Andy


Rainer [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi Andy,

 I was just reading your message, do I see that you send an array with 
 a form? Like input name=glacier[x] ?
 I just wanted you to know that using brackets [] is not allowed in the
 html-name attribute! Your html-page will not validate :(

 The sollution is sending al your vars as simple vars (no array) and
collect
 them with HTTP_GET_VARS[] or HTTP_POST_VARS[], php-variables.

 Maybe this will also be a sollution for your problem... just take a 
 look from another point of view :)

 Cheers,
 Rainer.


 Andy [EMAIL PROTECTED] wrote in message 
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi there,
 
  I have a tricky array question.
 
  My app is passing via post a array variable called glacier. Now I am

  checking for the content of this array. Because there are more of 
  those arrays, I am getting all
 the
  names out of a db.
 
  How is it possible to get the value and keep the name of the array
 dynamic?
 
  e.g:
  Array name passed by post is:
$glacier
//
  contains e.g. $glacier[0] = testname
  Array with category names coming out of db is:   $category //
contains
 e.g.
  $category[0] = glacier
 
   echo $categories[0]; // returns glacier
   echo $glacier[0];  // returns testname
 
  I tryed $categories[0][0] but it returns only the first letter of
glacier
  (g)
 
  Any ideas??
 
  Thanx, Andy
 
 
 





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


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




RE: [PHP] Tricky array question

2002-02-05 Thread Niklas Lampén

Ahem... So you want to have a two dimensional variable?

?
$Array = array(110, 220); // You array to add to $TwoDimensional
array
$TwoDimensional = array(); // Define $TwoDimensional to be an array
$TwoDimensional[0] = $Array; // Insert values from $Array to
$TwoDimensional
print Var: .$TwoDimensional[0][0].brbr; 
?


Is this what you are looking for?


Niklas

-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]] 
Sent: 5. helmikuuta 2002 12:54
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Tricky array question


This was just an error in my explenation I ment categories.

Meanwhile I tryed var vars, but it does not work for any reason?!?!?

My code looks like:

 $field = $categories[0].[0];
 echo $field;// returns glacier[0]
 echo 'var '.$$field.'br'; // returns bluddy nothing
 echo $categories[0]; // returns  glacier
 echo $glacier[0];// returns 110

Does anybody know how to get the 110 out of the array?

Thanx for any help,

Andy



Niklas lampén [EMAIL PROTECTED] schrieb im Newsbeitrag
008101c1ae2d$a9df7580$ba93c5c3@Niklas">news:008101c1ae2d$a9df7580$ba93c5c3@Niklas...
 It should be $category[0] = $glacier;
 ^--- ERROR in you code


 Niklas


 -Original Message-
 From: Andy [mailto:[EMAIL PROTECTED]]
 Sent: 5. helmikuuta 2002 11:59
 To: [EMAIL PROTECTED]
 Subject: [PHP] Tricky array question


 Hi there,

 I have a tricky array question.

 My app is passing via post a array variable called glacier. Now I am 
 checking for the content of this array. Because there are more of 
 those arrays, I am getting all the names out of a db.

 How is it possible to get the value and keep the name of the array 
 dynamic?

 e.g:
 Array name passed by post is: $glacier
 //
 contains e.g. $glacier[0] = testname
 Array with category names coming out of db is:   $category // contains
 e.g.
 $category[0] = glacier

  echo $categories[0]; // returns glacier
  echo $glacier[0];  // returns testname

 I tryed $categories[0][0] but it returns only the first letter of 
 glacier
 (g)

 Any ideas??

 Thanx, Andy




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




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


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




RE: [PHP] Checkboxe problem

2002-02-05 Thread Niklas Lampén

There is no way. How would you then know if the checkbox was checked or
not?
I use 'em like this
input type=checkbox name=private value=myValue
and then check if $private is myValue or not.

If you really have to get some data thru, use hidden inputs.


Niklas


-Original Message-
From: Gaylen Fraley [mailto:[EMAIL PROTECTED]] 
Sent: 6. helmikuuta 2002 6:41
To: [EMAIL PROTECTED]
Subject: [PHP] Checkboxe problem


I have a form with 1 checkbox and have coded it like this:

input type=checkbox name=private

When the form is submitted, $HTTP_POST_VARS[private] only exists IF
checkbox is checked.  It doesn't exist otherwise, which is causing a
problem because there are several other elements before and after.  What
happens is the value AFTER private is actually populating private if
private is empty (not checked).  I am, no doubt, missing something
small, but critical here. Can someone point out the error of my ways and
explain how to get the checkbox key/value pair into the post vars array
when the value is not checked?

TIA,

--
Gaylen
PHP KISGB v3.22 Guest Book http://www.gaylenandmargie.com/phpwebsite/




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


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




RE: [PHP] Problem...header already sent by

2002-02-04 Thread Niklas Lampén

There can't be _anything_ before headers. Even a single space and/or
linebreak causes an error.


Niklas


-Original Message-
From: Peter Ruan [mailto:[EMAIL PROTECTED]] 
Sent: 5. helmikuuta 2002 7:42
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] Problem...header already sent by



I tried it w/o the html tag and I get the BAD Header message.

-Peter

From: Jeff Sheltren [EMAIL PROTECTED]
To: Peter Run [EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: Re: [PHP] Problem...header already sent by
Date: Mon, 04 Feb 2002 21:30:42 -0800

You can't send anything before you send headers...  the html tag is 
messing you up I believe.

Jeff

At 08:24 PM 2/4/2002 -0800, Peter Run wrote:
Hi,
   I get the warning message (see below), whenever I try anything with

authentication/session with PHP.  This is tried under Windows
(PHPTriad).
I
get the same message with my Linux drive as well.  I appreciate your
help.
Please reply here and cc: to my personal email [EMAIL PROTECTED]

Thanks in advance,
-Peter
**
Warning: Cannot add header information - headers already sent by 
(output started at C:\apache\htdocs\proj\sports\phps\verify.php:2) in 
C:\apache\htdocs\proj\sports\phps\verify.php on line 26
***

1. html
2. ?php
 


  23.   if (!$auth) {
  24.  header(www-Authenticate: Basic realm='Private');
  25.  header(HTTP/1.0 401 Unauthrized);
...
?
/html






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






_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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


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




RE: [PHP] Re: Anyone Up?

2002-02-01 Thread Niklas Lampén

You're wrong here, my friend. You can have any value you like.
value=@£$ASDFSDF   ASDP fosifu @}{$#%/@would work.


Niklas

-Original Message-
From: hugh danaher [mailto:[EMAIL PROTECTED]] 
Sent: 1. helmikuuta 2002 10:48
To: Luke Welling
Cc: Php-General
Subject: Re: [PHP] Re: Anyone Up?


I think you'll need something like this:
VALUE=\'Your Name1\'   / /single quote marks I believe (and I
certainly
could be wrong).
otherwise it'll truncate at 'Your'
of course, if this is what you want...
Hugh

- Original Message -
From: Luke Welling [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 31, 2002 11:50 PM
Subject: [PHP] Re: Anyone Up?



 Jtjohnston [EMAIL PROTECTED] wrote in message 
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Luke is that 6:47 pm tomorrow? :) You lost an entire day! Enough Oz 
  Jokes. Here is my predicament in Canada :-)
 
  $varname = Check.$i;
 
  $varname = Check1 but I want $varname = Your Name1 to Your 
  Name12.
 
  One more try? :)
 
  INPUT TYPE=checkbox NAME=Check1 VALUE=Your Name1 INPUT 
  TYPE=checkbox NAME=Check2 VALUE=Your Name2 INPUT 
  TYPE=checkbox NAME=Check3 VALUE=Your Name3 etc.
 
  for ($i = 1; $i = $NMax; $i++)
  {
  #$varname = $Check.$i;
  $varname = Check.$i
  #echo $varname;
  if ($varname)
  echo $varname = $ibr;
  }

 In that case it is easy, I did not know that the ids were just 1 to 
 12, I thought they could be anything spat out by the database.

 How about something like this:

 for ($i = 1; $i = $NMax; $i++)
 {
   $varname = Check.$i
   if (isset($$varname)
 echo $$varname.br;
 }

 Luke Welling.
 --
 PHP and MySQL Web Development
 by Luke Welling and Laura Thomson 
 http://www.amazon.com/exec/obidos/ASIN/0672317842





 --
 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: Anyone Up?

2002-02-01 Thread Niklas Lampén

Well, Netscape breaks value=This is to This, but IE understands that
as This%20is. so if you set the value to be This%20is, both Netscape
and IE understands that as This is. There are many other chars that
can f**k up the value, so use htmlspecialchars() to correct that.


Niklas


-Original Message-
From: hugh danaher [mailto:[EMAIL PROTECTED]] 
Sent: 1. helmikuuta 2002 11:21
To: Php-General
Subject: Re: [PHP] Re: Anyone Up?


Not familiar with anything but php and html.  I know that in a type=text
(obviously not a checkbox) if you don't use the escape backslashes, the
value written into the box is 'Your' without the 'Name #'  I am told
this is because the browser views the space after 'r' in 'Your' as a
break and is looking at Name # as the next instruction, which it isn't.
My two cents for the evening. Hugh

- Original Message -
From: Brian Clark [EMAIL PROTECTED]
To: PHP is not a drug. [EMAIL PROTECTED]
Sent: Friday, February 01, 2002 12:54 AM
Subject: Re: [PHP] Re: Anyone Up?


 * hugh danaher ([EMAIL PROTECTED]) [Feb 01. 2002 03:48]:

  I think you'll need something like this:
  VALUE=\'Your Name1\'   / /single quote marks I believe (and I
certainly
  could be wrong).
  otherwise it'll truncate at 'Your'
  of course, if this is what you want...

 (Not trying to pick on you, Hugh. g)

 It'd be better just to write proper HTML/XHTML and use double quotes.

 ?php
 /* php scripting */
 ?
 !-- HTML --
 ?php
 /* back to php scripting */
 ?

 or just:

 print 'input type=checkbox value=Your Name1';

 But it would work with single quotes around attributes. I don't know 
 if it'd validate though.

 --
 Brian Clark | Avoiding the general public since 1805!
 Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8 5 out 
 of 4 people have trouble with fractions.


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




  1   2   >