If I understood you correct, you want to know the amount of the rows in
your table.
Here you go (Assuming ID is the field you use to ident your rows):
...count(ID) AS CountValue...
then treat CountValue as any field in a table.
Niklas
-Original Message-
From: Mason Batley
I think it won't work.
If you don't want to trim the actual variable, but check if the trimmed
variable is longer than 50 chars, here you go:
if (strlen(trim($cust_adres)) 50)
{
}
Niklas
-Original Message-
From: B. Verbeek [mailto:[EMAIL PROTECTED]]
Sent: 31.
var must stay trimmed!
-Oorspronkelijk bericht-
Van: Niklas Lampén [mailto:[EMAIL PROTECTED]]
Verzonden: donderdag 31 januari 2002 11:55
Aan: Php-General
Onderwerp: RE: [PHP] question reg trim-strlen
I think it won't work.
If you don't want to trim the actual variable, but check
You could do it like this:
?
$aTextFileArray = file(your_file.txt);
$firstLineToPrint = 5;
$lastLineToPrint = 10;
for ($i = $firstLineToPrint; $i count($aTextFileArray) || $i
$lastLineToPrint; $i++)
{
print Line $i: .$aTextFileArray[$i].br;
};
?
Niklas
-Original Message-
eval() is your solution.
for ($i = 1; $i = $NMax; $i++)
{
$variable = \$Check$i;
eval(\$string = \$variable\;);
echo $string.br;
}
Niklas
-Original Message-
From: jtjohnston [mailto:[EMAIL PROTECTED]]
Sent: 1. helmikuuta 2002 9:16
To: [EMAIL PROTECTED]
fwrite()?
Niklas
-Original Message-
From: Harphajan Singh [mailto:[EMAIL PROTECTED]]
Sent: 22. tammikuuta 2002 9:51
To: [EMAIL PROTECTED]
Subject: [PHP] Writing to text file from Radio Buttons
Greeting dudes ! I`m a fresh user of PHP and need some technical
assistance from you
I recommend you to use javascript for this one. That way you can make
sure that client sees the message exactly for time you've decided (like
3 seconds).
So:
a) Just do It
b) Just do It
c) JavaScript for this one, launched _after_ page has loaded completely
(use Body onLoad=script() -tag for
No good, since meta starts counting when page is first opened, so
clients with slow connection might not never see the message. I'd rather
use
body onLoad=setTimeout(\location.href='http://domain.com/page.html',
5000\);
which will execute right after the page is completely loaded and move to
the
Well, there could be a problem with connection due to the ISP.
Maybe this is not relevant with this case, but good to know for future
use.
I.e. if you have a picture on a page which will take more than 5 seconds
to download (maybe due to a problem with connection), meta will
redirect you after 5
,
Hugh
- Original Message -
From: Niklas Lampén [EMAIL PROTECTED]
To: Php-General [EMAIL PROTECTED]
Sent: Thursday, January 17, 2002 10:29 PM
Subject: RE: [PHP] Getting the last record in a mysql table
If you have ID that is a incrementing number, you could just query
like
this:
'SELECT ID
!!
Niklas,
I needed to change the statement slightly, but it did put me on the
right track. Thanks again, Hugh
$result=mysql_query(SELECT id FROM my_table ORDER BY id DESC, id limit
1); $id=mysql_result($result,0);
- Original Message -
From: Niklas Lampén [EMAIL PROTECTED]
To: Php-General [EMAIL
This is because it creates a new thread, atleast I think it so. Use
global variables to prevent this from happening:
i = 0;
function change_check_all(tree_item) {
a = document.all[tree_item + _check];
b = document.all[tree_item + _count];
// changed the line below
for(i =
Foreach works in PHP just like I told.
foreach($emails as $this_is_one_address) is the correct form where
$emails is an array and $this_is_one_address gets one element from
$emails.
This is similar to this (technically):
for ($i = 0; $i count($emails); ++$i)
{
$this_is_one_address =
-Original Message-
From: Niklas Lampén [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 09, 2002 10:15 AM
To: Php-General
Subject: RE: [PHP] foreach statement
Foreach works in PHP just like I told.
foreach($emails as $this_is_one_address) is the correct form where
$emails
I think this is what you want to do:
?
$sms_list = test_number; // This is the file with one e-mail address
per line?
$emails = file($sms_list);
foreach($emails as $this_is_one_address) {
// Do what ever you want to.
// $this_is_one_address contains one element from $emails
};
To test your PHP scripts you do need a server with PHP. It's very easy
to setup one on to you local machine + there is many completely free
ones.
Niklas
-Original Message-
From: Fady Fouad Shehata [mailto:[EMAIL PROTECTED]]
Sent: 31. joulukuuta 2001 4:34
To: [EMAIL PROTECTED]
)
Martin
At 13:24 02.01.02 +0200, Niklas Lampén wrote:
To test your PHP scripts you do need a server with PHP. It's very easy
to setup one on to you local machine + there is many completely free
ones.
Niklas
-Original Message-
From: Fady Fouad Shehata [mailto:[EMAIL PROTECTED
Your code runs more than 30 seconds.
Try using set_time_limit(n) function.
Niklas
-Original Message-
From: Rick [mailto:[EMAIL PROTECTED]]
Sent: 18. joulukuuta 2001 2:46
To: [EMAIL PROTECTED]
Subject: [PHP] php in free()
I'm running a script that times out durring a certian action.
This time VERY non-php, but I trust you guys! ;)
Are Java applets stored automatically to cache? Can I prevent it
somehow?
Niklas
Funny, I quickly tried this:
?
$date1 = 12/12/2001;
$date2 = 15/01/2002;
$date1 = date(D M j Y, strtotime($date1));
$date2 = date(D M j Y, strtotime($date2));
print $date1.br;
print $date2.br;
print date(Y-m-d, strtotime($date1)).br;
print date(Y-m-d, strtotime($date2)).br;
?
And the result
strtotime problem
Even more funny...
I cut and pasted your code and I got;
Wed Dec 12 2001
Sat Mar 1 2003
2001-12-12
2001-03-01
What version of Php and OS are you using??
John
Niklas lampén [EMAIL PROTECTED] wrote in message
000301c16369$6817a320$ba93c5c3@Niklas">news:000301c16369$
I'm having a wierd problem with mySQL query.
$Query = SELECT UCASE(Company), Icons, ID, LogoD FROM feComps;
returns right amount of rows, but field Company is empty.
$Query = SELECT Company, Icons, ID, LogoD FROM feComps.;
works fine.
First query works great when I run it in
What happens there is this:
$email = 1. row;
$email = 2. row;
$email = 3. row;
echo $email;
You really need to put echo $email inside the loop or use '.=' to set up
values to $email.
Niklas
-Original Message-
From: Richard Kurth [mailto:[EMAIL PROTECTED]]
Sent: 26. lokakuuta 2001
mysql_data_seek();
Niklas
-Original Message-
From: Adam Douglas [mailto:[EMAIL PROTECTED]]
Sent: 23. lokakuuta 2001 21:48
To: PHP-DB (mailing list) (E-mail); PHP-General (mailing list) (E-mail)
Subject: [PHP-DB] Using A Query Results Multiple Times
I have an instance where I
How about some code to see?
Niklas
-Original Message-
From: Srinivasan Ranganathan [mailto:[EMAIL PROTECTED]]
Sent: 23. lokakuuta 2001 15:22
To: [EMAIL PROTECTED]
Subject: [PHP] Update Query - Urgent
Hi
I have a php script generate a sql update statement.
when i query the database,
Well, not sure if this is a solution for you but I've done it with
something like this:
If ($Page == Form) {
// Form itself with hidden field Page=Mailer
} else if($Page == Mailer) {
// Send the mail
header(Location: youraddress?Page=Form);
};
Hope this helps.
Niklas
That won't do if the list is 'R001,23,2,5'.
I'd break that to parts with preg_match_all().
Niklas
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 3. lokakuuta 2001 15:08
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] Parsing a CSV file
If nothing is beeing sent to output on the page then use header() else you
need to use javascript.
Niklas
-Original Message-
From: Daniel Alsén [mailto:[EMAIL PROTECTED]]
Sent: 21. syyskuuta 2001 15:51
To: php
Subject: [PHP] Quickie
How do i send the user on to another page at the
source name not
found and no default driver specified, SQL state IM002 in SQLConnect in
C:\Inetpub\wwwroot\odbc.php on line 3.
Any ideas?
Thanks,
Alex
Niklas lampén [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
I think that ODBC is your solution.
How big difference does it make in speed in these:
?
for ($i = 0; $i mysql_num_rows($Results); $i++) {
blah
};
?
or
?
$n = mysql_num_rows($Results);
for ($i = 0; $i $n; $i++) {
blah
};
?
So actually I'm asking how much more/less it takes time to do the comparing
against
I think that ODBC is your solution.
Niklas
-Original Message-
From: A. op de Weegh [mailto:[EMAIL PROTECTED]]
Sent: 15. syyskuuta 2001 13:05
To: [EMAIL PROTECTED]
Subject: [PHP] Can I use Microsoft Access as a database?
Hi all,
for testing purposes in a school environment, I would
Code:
?
$Query = UPDATE feRegUsers SET Constructor='2001-09-17',
Enertec='2001-09-17', Seatec='2001-09-17' WHERE ID LIKE '288';
mysql_quory($Query);
print mysql_error();
?
That results
You have an error in your SQL syntax near 'Constructor='2001-09-17',
Enertec='2001-09-17', Seatec='2001-09-17''
mysql_quory($Query);
typos
i can't also see more errors...
Niklas lampén [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Code:
?
$Query = UPDATE feRegUsers SET Constructor='2001-09-17',
Enertec='2001-09-17', Seatec='2001-09-17' WHERE ID LIKE '288';
mys
I'd use preg_match().
Something like should do the trick:
if ($file != .htaccess $file != . $file != ..
!preg_match(/(.*)\.php/i, $file))
Niklas
-Original Message-
From: --- [mailto:[EMAIL PROTECTED]]
Sent: 14. syyskuuta 2001 11:09
To: [EMAIL PROTECTED]
Subject: [PHP] R: File
Heh, sure not related to PHP but one search engine in finland sends a
variable e with value mc2. :)
Niklas
-Original Message-
From: Jason Murray [mailto:[EMAIL PROTECTED]]
Sent: 14. syyskuuta 2001 8:59
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: [PHP] cookies
Don't they
If a user enters a quota ( ) to a form field and sends it, the page trying
to process values gets only a backslash ( \ ). No matter if I use GET or
POST. How to get the right kind of a value?
Niklas
This is what my form returns with search 'great port':
http://domain/file.php4?Parent=1Keyword=\
and this with search 'great port' (no quotas):
http://domain/file.php4?Parent=1Keyword=great
portName=Province=---Submit=SearchType=text
I need to get quotas to the keyword-field, so I can create
How to do anything to the strings in php BEFORE the form is sent?
Niklas
-Original Message-
From: James Holloway [mailto:[EMAIL PROTECTED]]
Sent: 12. syyskuuta 2001 11:28
To: Niklas lampén
Subject: Re: problem with form values
Hi Niklas,
use htmlentities() or htmlspecialchars
like
onSubmit=blah().
Niklas
-Original Message-
From: James Holloway [mailto:[EMAIL PROTECTED]]
Sent: 12. syyskuuta 2001 12:01
To: Niklas Lampén
Cc: [EMAIL PROTECTED]
Subject: [PHP] Re: problem with form values
Sorry,
I didn't mean it quite like that. After the user presses submit
: _lallous [mailto:[EMAIL PROTECTED]]
Sent: 11. syyskuuta 2001 13:09
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Sessions Getting Broken
Maybe it's getting timed out?
Niklas lampén [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
I have a database update syst
page with an error
code.
Niklas
-Original Message-
From: _lallous [mailto:[EMAIL PROTECTED]]
Sent: 11. syyskuuta 2001 14:35
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Sessions Getting Broken
Can't tell like that
No more ideasmaybe somecode would help?!
Niklas lampén [EMAIL
I have a problem with sessions. My sessions work well except for one thing:
they keep getting broken from time to time. I have found no common thing
with these brokes so I'm quite lost with this problem. Any ideas?
It seems that all of the sessions brake at the same time. (I have a collegue
with
If you wish $shoplist[$pid] have $price in it with $units, you have to make
$shoplist a multidimensional array which is simpple:
?
$shoplist = array();
$shoplist[$pid][$units] = 1;
$shoplist[$pid][$price] = 100;
print_r($shoplist);
?
Try that out, it should give you the idea. You can make it
Which is faster (and/or smarter), using function mail() or doing it by
popen(/blah/sendmail)?
Niklas
This helped me out (at least made my site look nicer :), but is there a way
set text area's width like this? Doesn't seem to work with same code. IE
however works great.
Why the hell there can not be just ONE standard?!?
Niklas
-Original Message-
From: * RzE: [mailto:[EMAIL
If line 22 is '$message = blah!!' it should be '$message = blah!!;' or
then you're missing a ';' from the end of previous line.
Niklas
-Original Message-
From: Kyle Smith [mailto:[EMAIL PROTECTED]]
Sent: 4. syyskuuta 2001 23:19
To: [EMAIL PROTECTED]
Subject: [PHP] Another script
Is it possible to write this shorter:
if ($Var != No1 $Var != No2 $Var != No3) {
code
};
Niklas
but it is VERY long. I also have to compare several words to
one field so I've done many of those Field LIKE '%blah%' for those too.
Is there any smarter way to do this?
Niklas Lampén
Internet Developer
PubliCo Oy
Ruoholahdenkatu 8 A
FIN-00180 HELSINKI
P. +358 - 9 - 6866 2541
F. +358 - 9 - 685 2940
E
It just crossed my mind: I don't know what PHP stands for...so anyone? :)
Niklas
Funny that there is no meanin for the first P.
Niklas
-Original Message-
From: Jon Haworth [mailto:[EMAIL PROTECTED]]
Sent: 28. elokuuta 2001 13:57
To: 'Niklas Lampén'; Php-General
Subject: RE: [PHP] What does PHP stand for?
PHP Hypertext Preprocessor (yes, it's recursive)
HTH
Jon
You could do this if your $GrabStart and $GrabStop are ALLWAYS the same
(Like:
###START###
10pm
Blah
###STOP###
###START###
12pm
Blahblah
###STOP###
)
$file = file(url.txt);
$str = join(\n, $file); // You can use whatever to join the rows
$GrabStart = ###START###;
$GrabEnd = ###STOP###;
then
That file doesn't exist. Put it there again so I can take a look at it. And
pls notify me when it's there. :)
Niklas
-Original Message-
From: Ben Quinn [mailto:[EMAIL PROTECTED]]
Sent: 27. elokuuta 2001 11:41
To: Php-General
Cc: Niklas Lampén; [EMAIL PROTECTED]
Subject: Re: [PHP] Web
I have problem with reading files from directory.
This is the code:
?
$Handle = opendir('/www/publico2/docs/map');
while ($file = readdir($Handle)) {
print $filebr\n;
};
?
That is ALL code on a script file.
These are the file in directory:
.
..
array_maker.php4
map.php4
renamer.php4
, 0, 3) == md_) {
$split = explode(_, $file);
if ((time() - $split[1]) 300) {
unlink($file);
};
};
};
What this does is return a Internal Server Error! If add do
unlink(map/.$file); it returns file not found. What to do? What is wrong?
Niklas Lampén
Solved it by myself. :)
unlink($file); needs to be *exact* address to the file to be unlinked like
/www/dir/map/$file.
Just in case if someone else meets this problem!
Niklas
-Original Message-
From: Niklas Lampén [mailto:[EMAIL PROTECTED]]
Sent: 23. elokuuta 2001 15:17
To: Php
What I need to do is to compare if one field matches a value from a huge
list of values.
Do I need to query like
SELECT * FROM table WHERE field LIKE '%value1%' || field LIKE '%value2%'
or can I do it something like this
SELECT * FROM table WHERE field LIKE ('%value1%' || '%value2%')?
Niklas
% works as a wildcard in mySQL.
Example:
SELECT * FROM table WHERE Question LIKE '%life%' would return all rows
with field Question containing string life.
Niklas
-Original Message-
From: Wolfgang Schneider [mailto:[EMAIL PROTECTED]]
Sent: 20. elokuuta 2001 13:22
To: php-general
This can be solved by building a function to split users entry to pieces so
that the query will be like
SELECT * FROM table WHERE Question LIKE '%word1%' || Question LIKE
'%word2%' || Question.
if only one of the words have to match the Question field.
Niklas Lampén
-Original Message
101 - 158 of 158 matches
Mail list logo