[PHP] trans_sid? (was: SV: [PHP] Quickie)

2002-10-01 Thread Daniel Alsén

John W. Holmes propably said:

 Do you have a session_start() on the page? It looks like you have a
 trans_sid enabled. PHP will add that to all of your URLs
 automatically. Can you disable it in php.ini?

Yes trans_sid is enabled and i have a session_start on the page. What is
trans_sid doing exactly? I tried looking it up in the documentation but
don't really get it.

What would i loose if i disabled trans_sid (or actually - tried to persuade
my webhotel to disable it).

The strange thing is also that it only adds the session id to url:s when the
page is first loaded. After the first click it goes away.

- D






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




SV: [PHP] trans_sid? (was: SV: [PHP] Quickie)

2002-10-01 Thread Daniel Alsén

To reply to myself .)

I disabled trans_sid on the actual site by using:

ini_set('session.use_trans_sid',false);
session_start();

But i still want to know what trans_sid does for me. What am i missing out
on when not using it?

- D, loves google




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




SV: [PHP] trans_sid? (was: SV: [PHP] Quickie)

2002-10-01 Thread Daniel Alsén

Justin French propably said:

 You'd loose session for those without cookies.  The work around for
 this would be to hard-code the session ID to all URLs across your
 site for all pages you wish to carry a session through -- a real pain.

Indeed.

 It HAS TO use a session ID from the first page to the second, to be
 sure that the session is being carried... on the second page, it
 assesses if the cookie was set, and if so, doesn't bother rewriting
 any of the URLs, else, it continues.

Aha...i got a bit confused first when i read your answer since i _know_ i
have cookies enabled. But isn´t there any other way to work around this? Can
i check if the cookie is set myself and if it is disable trans_sid with
'ini_set('session.use_trans_sid',false);'?

 Most people beg to HAVE trans_sid enabled on their server, not to
 have it removed.  It ensures the widest array of people can access
 your site without breaking sessions, and without the need for you to
 include (pass around) a session ID throughout your site via URLs.

Thanks.

- D




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




SV: SV: [PHP] trans_sid? (was: SV: [PHP] Quickie)

2002-10-01 Thread Daniel Alsén

Justin French propably said:

 In order to set and then check a cookie, you need to go through a
 page... so you'd have to set something in the URL like ?cookieset=1
 anyway, in order to knwo you had set it, in order to check it.
 
 In other words, you'll need some guff in the URL, in order for it to
 all work, so why not let it be the session key, and let trans_sid do
 the work? 
 
 Without trying to sound rude, get over it or deal with it :)

Guess i'll have to ;)

- D




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




[PHP] Quickie

2002-09-30 Thread Daniel Alsén

Guys,

i've been away for a while - enjoying a much needed vacation in lovely
Hungary and expanding my company. Now im back to bother you with easy
questions ;)

I am doing a small site multilingual and will display different content
depending on what language the user choses. When the user comes to the site
i want the default language to be swedish and is setting it in a session:

session_start();
session_register(lang);
if (!isset($lang)) { $lang = 'se'; }

However - i can´t change the value for $lang after that. It gets set to 'se'
every time the page loads. Shouldn't row 3 only be executed if $lang isn't
already assigned a value?

Regards
- D




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




SV: [PHP] Quickie

2002-09-30 Thread Daniel Alsén

John W. Holmes propably said:

 Is register globals on or off?

On.

Now - without doing anything - i managed to change the value of $lang to
'en' with a link (pagesname.php?lang=en). But i can't change it back with
?lang=se. Should i get someting to eat to get my brain working?

- D




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




SV: SV: [PHP] Quickie

2002-09-30 Thread Daniel Alsén

Thanks guys! That did the trick. Time to study these sessions a bit more
thourough it seems :)

Another thing - the first time the page is loaded every link on the page
gets a '?PHPSESSID=...etc...' attached to itself. But only the first time.
It dissapears after the first click i make.

I've never seen that before. Can i get rid of it?

- D





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




[PHP] Passing a variable invisibly via a href?

2002-04-02 Thread Daniel Alsén

Hi,

i need to pass a variable by letting the user click on a link. Right now i
do it like: page.php?variable=value

However, i don´t want the variable, and it´s value to appear in the adress
bar of the browser. And i don´t want people to be able to pass the same
variable by reloading the destination page.

Any pointers on how i can do this?

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 705 38 10 30 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


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




SV: [PHP] Passing a variable invisibly via a href?

2002-04-02 Thread Daniel Alsén

 You could use a form and have a hidden vield that contains a value.  The
 user would have to click the submit button for the variable/value to carry
 over though.

I thought about that. But i have two possible values (via two links) that
could be passed and i can´t really get it together. Two forms?

- Daniel


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




SV: SV: [PHP] Passing a variable invisibly via a href?

2002-04-02 Thread Daniel Alsén

 Yes, there is a way to do it without using any forms.  I may be able to
 help you better if you could show me the relevant code -- I'm not sure
 if what I have in mind is really applicable to what you want to do.

It´s not really advanced:

session_start();
session_register('text_size');

if ($change == inc) {
$text_size++;
}
elseif ($change == dec) {
$text_size--;
}

I use the variable $change to set the text size in my stylesheet:

if (isset($text_size)) {echo $text_size;} else {echo 10; $text_size = 10;}

And i set the variable via a link:

a href=? echo $PHP_SELF; ??change=inc (or change=dec)

Now - i don´t want the variable to be visible. And i would prefer if the
variable didn´t get set every time someone hit reload.

Or am i attacking this changing-text-size-thingy the wrong way?

- Daniel


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




[PHP] Receipts

2002-03-20 Thread Daniel Alsén

This may seem a bit off topic - but i am getting really tired of this...

I am subscribing to a variety of mailing lists and receives hundreds, and
sometimes thousands, of e-mails every day. One thing - that is almost unique
to this list - is that some of you send a request for a read receipt with
every mail. Why? Dou you really want read receipts from thousands of
subscribers?

It is not only annoying. It´s rude!

And no - i am not considering to deny or automatically send read receipts.
It is, when properly used, a good function. And i want to choose when to
send them. Although not being forced to deny receipts from a mailing list.

# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 705 38 10 30 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


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




[PHP] URL cloaking?

2002-03-01 Thread Daniel Alsén

Hi,

my webhost offers wildcard dns for subdomains. However - the subdomains only
redirects from sub.domain.com to domain.com/sub.

I want to cloak the url to remain sub.domain.com. Is there any easy way to
do that with a php-snipplet?

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 705 38 10 30 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


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




[PHP] PHP features

2002-02-26 Thread Daniel Alsén

Hi!

Which function should i turn on in the PHP installation to get rid of
variables being sent in the url (if i don´t explicitly want them there of
course)?

- D



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




[PHP] Return values?

2002-02-25 Thread Daniel Alsén

Hi,

how do i display return values from functions?
Ie i want to see whether mail() returns TRUE or FALSE.

- D



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




Re: [PHP] Difference between two dates

2002-02-19 Thread Daniel Alsén

Read this article at PHPbuilder:

http://www.phpbuilder.com/columns/akent2610.php3

- D


- Original Message - 
From: Uma Shankari T. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 19, 2002 9:50 AM
Subject: [PHP] Difference between two dates


 
 
  Hello,
 
  How can i find out the difference between two dates.
 
 I am having the date like this
 
 $str=10-01-2001;
 $str1=01-02-2002;
 
 I need to find out the difference between the date,month and year.
 
 If anyone know the solution for this problem plz tell me
 
 
 -Uma 
 
 
 -- 
 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] please reply -copy right

2002-02-19 Thread Daniel Alsén

You don´t have to register anywhere. You don´t even have to add a copyright
notice. But if you do you are signalling that the content of the website is
protected by copyright laws. No more complicated than that...

- D


- Original Message -
From: Dani [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 19, 2002 3:24 PM
Subject: [PHP] please reply -copy right


 I just send this again, just incase my email doesn't get through.

 thanks

 Dani wrote:

  Hi!
  I have seen lots of webiste with a sign [EMAIL PROTECTED] 2002 etc...
 
  if I would like to do that, do I have to register myself to a certain
  company or.. I just put it on my website?
 
  Thanks!
 
  regards
 
  --
  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] Help with query

2002-02-09 Thread Daniel Alsén

Hi,

i can´t seem to get my head to wake up...

How would i do to count how many different values that exists in a mysql
field? Ie i have a date-field and need to know how many different dates that
exists in the table.

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


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




SV: [PHP] Help with query

2002-02-09 Thread Daniel Alsén

Thanks guys!

- Daniel

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




[PHP] One more quickie

2002-02-09 Thread Daniel Alsén

Don´t really want to bother you with these quickies - but:

If i have a result from mysql that is a date (2002-02-09) - how do i change
that into a variable with only the first 7 characters (2002-02)?

Thanks
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


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




[PHP] Number of rows reurned?

2002-01-20 Thread Daniel Alsén

Hi,

how can i get the number of rows reuturned by this query?

$sql = select date from statistik where shooter='$shooter_login' group by
date;

I want to add a page function and limit the returned rows on each page - but
i can´t get the total number of rows.

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


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




SV: [PHP] Number of rows reurned?

2002-01-20 Thread Daniel Alsén

Thanks. I knew that - really. Meltdown upstairs :)

- D

 -Ursprungligt meddelande-
 Från: Jason Wong [mailto:[EMAIL PROTECTED]]
 Skickat: den 20 januari 2002 18:53
 Till: Daniel Alsén; PHP List
 Ämne: Re: [PHP] Number of rows reurned?


 On Monday 21 January 2002 01:45, Daniel Alsén wrote:
  Hi,
 
  how can i get the number of rows reuturned by this query?
 
  $sql = select date from statistik where
 shooter='$shooter_login' group by
  date;
 
  I want to add a page function and limit the returned rows on each page -
  but i can´t get the total number of rows.

 Check out the relevant chapter in the manual for the db that
 you're using.
 Some dbs have a function returning the number of rows.

 If you're using MySQL then mysql_num_rows() is what you want.

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

 /*
 If a man has talent and cannot use it, he has failed.
   -- Thomas Wolfe
 */

 --
 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] While on array?

2002-01-20 Thread Daniel Alsén

Hi,

i am fiddling with a script and need to change a while-loop from running on
mysql_fetch_array to a normal array?

ie - i have:
while($myrow=mysql_fetch_array($result)) { etc...

But i want the loop to run with an array i created earlier ($anotherarray =
[key1] = value1, [key2] = value2).

How would i do that? Does the loop behave the same way - running until the
array is out of data?

Thanks!
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


-- 
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] Need a quick tip...

2002-01-16 Thread Daniel Alsén

Hi,

i need a quick tip.

I need a page containing links to get information from a database from
different timeperiods. I want the links to start from a given month, ie
November 2001, and stretch to the present month.
However - i don´t want to manually add a new link every month.

How do i approach this? I obviously need some sort of function that can
check todays date and count how many months it needs to print from the given
startdate.

Thanks
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


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




SV: SV: [PHP] Re: Still need help with miscount

2002-01-06 Thread Daniel Alsén

 I don't know if this is actually it, but the line
 $num_vals[$i] = mysql_fetch_array($result);
 seems strange to me - doesn't mysql_fetch_array return an array?
 You should try
 list($num_vals[$i]) = mysql_fetch_array($result);
 and see if you get any improvements...

No, that was not it. It gave me different results - but still wrong.
I have, however, got a little closer by extending the loop to 0-11,
for ($i=0; $i11; $i++), and changing the display, starting with: echo
$num_vals[1][0];;. I had alla numbers shifted one step to the right before
when counting zeroes as well.

But - still the same problem. It doesn´t count correctly - and i can´t
figure out why...

- Daniel


-- 
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] Printing return value of array_count_values?

2002-01-05 Thread Daniel Alsén

Hi!

How do i echo the return values of array_count_values?

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


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




SV: [PHP] Re: Still need help with miscount

2002-01-05 Thread Daniel Alsén

I have worked this over in my head over the holidays and still haven´t got a
solution. Can anyone help?

I have a MySql table populated with numerical values from 0 to 10 in five
different fields. I need a function that counts all occurances of each
value, ie: 1: 12, 2: 3, 4: 74 etc...

I have worked with this code:

$num_vals = array ();
for ($i=0; $i10; $i++)
{
$shot_count = SELECT COUNT(*) FROM statistik WHERE shooter='$shooter_login'
AND ((shot_one = '$i') OR
(shot_two = '$i') OR (shot_three = '$i') OR
(shot_four = '$i') OR (shot_five = '$i'));

$result = mysql_query($shot_count);
$num_vals[$i] = mysql_fetch_array($result);
}

The code works...but returns the wrong results. If i count from the database
manually there is always some occurances missing.

So, today i tried to count the values from an array instead:

$shotcount = SELECT shot_one, shot_two, shot_three, shot_four, shot_five
FROM statistik WHERE shooter='$shooter_login';
$results = mysql_query($shotcount);
$bam = mysql_fetch_array($results);

$count = array_count_values ($bam);

while (list($key,$value) = each($count)) {
echo $key : $valuebr;
}

But this works even worse...it seems to stop populating the array (or
counting the values) after only a couple of rows from the db. The result
looks like:
3 : 4
5 : 2
7 : 2
9 : 2
And there should be alot more of those keys...and a couple of keys more as
well...

I would appreciate any help on this guys. I am s stuck :(

# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


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

2001-12-14 Thread Daniel Alsén

Hi guys,

still seem to have some trouble with this code. I solved the earlier issues,
with your valuable help. But when i echo the results of the query it gives
me the wrong results. I have never encountered a faulty count from mysql
earlier. Are there any issues with the query i should consider?

$t = 6;
$shot_counts = SELECT COUNT(*) FROM statistik WHERE
shooter='$shooter_login'  shot_one = '$t' || shooter='$shooter_login' 
shot_two = '$t' || shooter='$shooter_login'  shot_three = '$t' ||
shooter='$shooter_login'  shot_four = '$t' || shooter='$shooter_login' 
shot_five = '$t';
$results = mysql_query($shot_counts);
$bam = mysql_fetch_array($results);

# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


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

2001-12-14 Thread Daniel Alsén

Nope,

that didn´t help. I am baffled here.

One more interesting thing is that these two queries deliver different
results.

$num_vals = array ();
for ($i=0; $i10; $i++)
{
  $shot_count = SELECT COUNT(*) FROM statistik WHERE
(shooter='$shooter_login'  shot_one = '$i') ||
(shooter='$shooter_login'  shot_two = '$i') ||
(shooter='$shooter_login'  shot_three = '$i') || (shooter='$shooter_login'
 shot_four = '$i') || (shooter='$shooter_login'  shot_five = '$i');
  $result = mysql_query($shot_count);
  $num_vals[$i] = mysql_fetch_array($result);
}



$t = 7;
$shot_counts = SELECT COUNT(*) FROM statistik WHERE
(shooter='$shooter_login'  shot_one = '$t') ||
(shooter='$shooter_login'  shot_two = '$t') ||
(shooter='$shooter_login'  shot_three = '$t') || (shooter='$shooter_login'
 shot_four = '$t') || (shooter='$shooter_login'  shot_five = '$t');


I am really stuck. Any suggestions?

- Daniel


 -Original Message-
 From: Kevin Stone [mailto:[EMAIL PROTECTED]]
 Sent: den 14 december 2001 23:53
 To: Daniel Alsén; PHP
 Subject: Re: [PHP] Miscount


 I do not know if this will solve your problem but you should enclose each
 logical query segment with parenthesies...


-- 
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] Call to undefined function: bcdiv()

2001-12-13 Thread Daniel Alsén

Hi,

i when i run a script that contains a bcdiv() calculation i get this error:
Call to undefined function:  bcdiv()

I am using bcdiv() successfully in other scripts. However i vaguely remember
getting an error message some time for some operation in bcdiv...

Any ideas?

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


-- 
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] Can i do this?

2001-12-13 Thread Daniel Alsén

Hi,

can i do this?

$num_vals = array ();
for ($i=0; $i10; $i++)
{
  $shot_count = SELECT COUNT(*) FROM statistik WHERE
shooter='$shooter_login'  shot_one = '$i' || shooter='$shooter_login' 
shot_two = '$i' || shooter='$shooter_login'  shot_three = '$i' ||
shooter='$shooter_login'  shot_four = '$i' || shooter='$shooter_login' 
shot_five = '$i';
  $result = mysql_query($shot_count);
  $num_vals[$i] = mysql_fetch_array($result);
}

I guess it´s the last row that is troubling - getting an array into an
array. If the code is good - how do i echo the results?

# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


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




RE: [PHP] Can i do this?

2001-12-13 Thread Daniel Alsén

Yep...

And i don´t get any wiser. I have tried all sorts of combinations. But i
can´t get the damn values printed.

This is how the print_r of $num_vals looks:

( [0] = Array ( [0] = 0 [COUNT(*)] = 0 )
[1] = Array ( [0] = 0 [COUNT(*)] = 0 )
[2] = Array ( [0] = 5 [COUNT(*)] = 5 )
[3] = Array ( [0] = 6 [COUNT(*)] = 6 )
[4] = Array ( [0] = 7 [COUNT(*)] = 7 )
[5] = Array ( [0] = 7 [COUNT(*)] = 7 )
[6] = Array ( [0] = 9 [COUNT(*)] = 9 )
[7] = Array ( [0] = 11 [COUNT(*)] = 11 )
[8] = Array ( [0] = 8 [COUNT(*)] = 8 )
[9] = Array ( [0] = 9 [COUNT(*)] = 9 ) )

Ideas?

Regards
Daniel

 -Original Message-
 From: Jack Dempsey [mailto:[EMAIL PROTECTED]]
 Sent: den 13 december 2001 16:30
 To: Daniel Alsén; PHP
 Subject: RE: [PHP] Can i do this?


 didn't check your code specifically, but you can definitely have arrays
 nested inside of arrays...to see how to print them out use something like
 print_r to look  at the structure...

 -Original Message-
 From: Daniel Alsén [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 13, 2001 10:12 AM
 To: PHP
 Subject: [PHP] Can i do this?


 Hi,

 can i do this?

 $num_vals = array ();
 for ($i=0; $i10; $i++)
 {
   $shot_count = SELECT COUNT(*) FROM statistik WHERE
 shooter='$shooter_login'  shot_one = '$i' || shooter='$shooter_login' 
 shot_two = '$i' || shooter='$shooter_login'  shot_three = '$i' ||
 shooter='$shooter_login'  shot_four = '$i' ||
 shooter='$shooter_login' 
 shot_five = '$i';
   $result = mysql_query($shot_count);
   $num_vals[$i] = mysql_fetch_array($result);
 }

 I guess it´s the last row that is troubling - getting an array into an
 array. If the code is good - how do i echo the results?

 # Daniel Alsén| www.mindbash.com #
 # [EMAIL PROTECTED]  | +46 704 86 14 92 #
 # ICQ: 63006462   | +46 8 694 82 22  #
 # PGP: http://www.mindbash.com/pgp/  #


 --
 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] Arrays...

2001-12-12 Thread Daniel Alsén

Hi,

im trying to fill a chart with some data.

I am using a mysql query:
$query = SELECT serie_tot, COUNT(*) FROM statistik WHERE shooter='mindbash'
GROUP BY serie_tot;
$series = mysql_query($query)

It returns the results i want, ie
value - count
value2 - count
etc...

Now - i am trying to get this data into an array and is using:
$data = mysql_fetch_array($series);

But that doesn´t work! If i do it manually:
$data = array(
value = 4,
value2 = 2);

...it works like a charm. What´s the difference between these arrays?

I would also, very much, appreciate a tip on where i could learn how to
master arrays. I am tearing my hair out here.

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


-- 
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] Help with mysql query

2001-12-11 Thread Daniel Alsén

Even if this isn´t a mysql forum i hope to get some help on this:

I have a table with 5 columns (named one to five) which contains numerical
values between 1 and 10.
I am trying to construct a query that gives me the count of the
representation of each numerical value (ie how many fives that are stored).

Can i do this in a smart way without having to write fifty queries and add
every fifth of them up?

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


-- 
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] Doing statistics with MySql data?

2001-12-09 Thread Daniel Alsén

Hi,

i have a MySql table with five columns that are filled with different
numerical values. I need some pointers to where i can learn how to build
statistics out of this data (ie the average value of a column, how many
instances there is of a certain value etc).

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


-- 
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] Stripping slashes from db-insert?

2001-12-01 Thread Daniel Alsén

Hi,

i know this has been asked before - but:

When i add entries to MySql (varchar and text) all  and ' gets a slash in
front of them. How do i get rid of these slashes?

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


-- 
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] Strange problem...

2001-11-30 Thread Daniel Alsén

Hi,

i have a strange problem.

I get a users birthdate with three dropdown menus (year, month and day of
month). I get these values into one string with:

$user_birthdate = $birth_year . $birth_month . $birth_day;

If i echo $user_birthdate after this it is correct (mmdd). But when i
insert the value of $user_birthdate into MySql it gets the value '8388607'.
It doesn´t matter what value $user_birthdate had originally - it always
inserts as 8388607.

Any ideas???



The db question looks like this btw:

$query = INSERT INTO users ;

$query .= (user_name, user_birthdate, user_city, user_mail, user_icq,
user_msn, user_www, user_login, user_password) ;

$query .=  values('$user_name', '$user_birthdate', '$user_city',
'$user_mail', '$user_icq', '$user_msn', '$user_www', '$user_login',
'$user_password');


Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   | +46 8 694 82 22  #
# PGP: http://www.mindbash.com/pgp/  #


-- 
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] Redirect upon execution of script...

2001-11-25 Thread Daniel Alsén

Hi,

is there a way to redirect after a script has run?

I have a form whos result is being put into a database. When, or if, the
operation is sucessful i set a variable $done to 1.

Now, i need a redirection from here (if $done is 1). But since i cant send
out headers that far down on the page - what do i do?

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


-- 
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] Redirect upon execution of script...

2001-11-25 Thread Daniel Alsén

 2. User fills in a form, clicks submit which calls the same script,
 passing itself the values. Depending on the value passed by the submit
 button, the script processes the information (INSERT or UPDATE) and sets
 $done = 1 if successful.

 The second scenario is easier to handle.
 Call the same script, passing it $done, and depending on whether or not
 $done is set you redirect.

 Juli Meloni has done an excellent tutorial on just this at
 http://www.thickbook.com. look in the tutorials for something like Form
 With Error Message. You just have to adapt the logic to suit your needs.

The second scenario is correct. I am actually already using the method in
Melonis tutorial for error messages. But i can´t do a redirection that way
since $done isn´t set until after the db INSERT. My if-statement for the
header is at the top of the page (wich is the only place i can put it) and
will never know if $done is set or not below.

- Daniel


-- 
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] Redirect upon execution of script...

2001-11-25 Thread Daniel Alsén

Thanks for all the help guys! I am sure i will solve this when i have a go
at it again :)

- Daniel


-- 
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] Check contents of variable

2001-11-20 Thread Daniel Alsén

 How about:

 if (substr($url,0,7)  http://;)
 $url = http://; . $url;

Thanks!

That´s just the function i am looking for. I looked it up in the manual.
Correct me if i am wrong - if i don´t set the second parameter in substr it
just continues to read until the variable is finished? If i set it to 7 (as
above) it stops reading after 7 characters?

- Daniel


-- 
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] Session problem

2001-11-16 Thread Daniel Alsén

Hi,

i am writing a simple postcard-script. I use php 4 sessions and stores the
data in MySql with the sessionid as a unique id for the card.

The problem is - i can´t send more than one card with the same id. I can´t
find any way to get a new session id without closing the browser. In the
manual there only seems to be functions to unset or unregister the actual
data inside the session - not the id itself.

Any ideas?

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


-- 
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] Session problem

2001-11-16 Thread Daniel Alsén

Nope. That is just the problem. session_destroy() only destroys the data
inside the session. Not the id.

But i actually solved it now. I am using the same algorithm as php itself to
create a new id everytime the page is loaded:

   session_id( md5( uniqid( , 1 ) ) );
   session_start();

- Daniel

 -Original Message-
 From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED]]
 Sent: den 16 november 2001 15:40
 To: Daniel Alsén
 Subject: Re: [PHP] Session problem


 I think you can set a new session id using session_start()
 so if you need a new id just destroy the old one using session_destroy()
 then call sessio_start(your new id)  and that should work fine now.

 - Original Message -
 From: Daniel Alsén [EMAIL PROTECTED]
 To: PHP [EMAIL PROTECTED]
 Sent: Friday, November 16, 2001 9:05 AM
 Subject: [PHP] Session problem


  Hi,
 
  i am writing a simple postcard-script. I use php 4 sessions and
 stores the
  data in MySql with the sessionid as a unique id for the card.
 
  The problem is - i can´t send more than one card with the same
 id. I can´t
  find any way to get a new session id without closing the browser. In the
  manual there only seems to be functions to unset or unregister
 the actual
  data inside the session - not the id itself.
 
  Any ideas?
 
  Regards
  # Daniel Alsén| www.mindbash.com #
  # [EMAIL PROTECTED]  | +46 704 86 14 92 #
  # ICQ: 63006462   |  #
 
 
  --
  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] User authentication?

2001-11-04 Thread Daniel Alsén

Hi,

do aonyone know of any comprehensive tutorial for user authentication
session managment with php4 sessions and mysql? Preferably with some sort of
code examples?

I have tried searching the larger code libraries but haven´t found anything
that suits me (the ones i actually got interested in was dead links).

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


-- 
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] Hotel booking/managment system?

2001-11-02 Thread Daniel Alsén

Hi,

does anyone have the script that is supposed to be stored at
http://hrs.rics.ru/?

Or does anyone know of any other hotel booking system or a similar script in
php? I am mainly interested in the concept of the system. Database relations
and buildup.

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


-- 
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] Loading message

2001-10-25 Thread Daniel Alsén

Hi,

is there a easy way in php to display text like Loading... while elements
on a page is being loaded from the server?

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


-- 
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: Loading message

2001-10-25 Thread Daniel Alsén

I will try experimenting with that.

But my situation is:

A page with multiple php file includes. The page loads on to the includes,
loads them and continues to load the includes below.
I want to display some sort of text while the include still isn´t loaded.

Likewise i would like to display some sort of loading message while a
database search is active.

- Daniel

 -Original Message-
 From: _lallous [mailto:[EMAIL PROTECTED]]
 Sent: den 25 oktober 2001 13:14
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Loading message


 the page won't ever showup unless the webserver finishes
 processing the PHP
 file, therefore the Loading ... will appear while the page is
 waiting for
 its component to finish loading (images, javascripts, flash files, )

 therefore what you're asking for has a javascript solution:

 1)make a div with width and height about 1000 and absolute position w/
 z-index=1000
 2)add a body.onload event so that when the pages loads you hide
 that layer.
 3)that layer can hold any text or tags as you want like: Please wait

 this division's code:
 div id='loadinglayer'
 style='left:0;top:0;width:1000;height:1000;position:absolute;z-ind
ex:1000;ba
 ckground:black'Please wait/div

 body onload='hidelayer()'
 /body

 script
 function hidelayer()
 {
   if(document.all)
 document.all['loadinglayer'].style.visibility=hidden;
   else
 document.layers['loadinglayer'].visibility=hide;
 }
 /script

 hope that helps
 Daniel alsén [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi,
 
  is there a easy way in php to display text like Loading... while
 elements
  on a page is being loaded from the server?
 
  Regards
  # Daniel Alsén| www.mindbash.com #
  # [EMAIL PROTECTED]  | +46 704 86 14 92 #
  # ICQ: 63006462   |  #
 



 --
 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: Loading message

2001-10-25 Thread Daniel Alsén

 Is your script really taking that long to be parsed that you need
 a loading
 progress bar or is the html (including graphics etc) just very big?

Parts of the page is rather heavy loaded. The main php file loads fine and
displays it´s contents until it reaches one of the heavy includes (heavy
because it gets data from another website).
So, in effect, the page loads and displays all content, make pauses when
hitting heavy includes, and then continues.

- Daniel


-- 
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: Loading message

2001-10-25 Thread Daniel Alsén

 I agree with you Derek,
 It also depends on the webserver and your connection speed...

 perhaps the pages is already parsed and processed but your connection is
 slow somehow and you're getting the page partially as if it is beeing show
 while it is beeing processed/parsed.

Actually i know why parts of the page is loading slow. I have a included php
file that gathers data from another website. While that script is going off
to the other website the main file make a pause parsing.

- Daniel


-- 
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: Loading message

2001-10-25 Thread Daniel Alsén

Could i have a hint of what you have done Jon?

- Daniel

 Totally incorrect. I have a page on our intranet that checks whois
 information against about 10 whois servers. Right at the top of 
 the page it
 says Checking. As soon as a response comes back from a 
 whois server it
 shows in the browser ie :-
 
 domain.com available
 domain.net unavailable
 
 The list grows as the results come back.. As soon as all the results have
 been returned the message Checking... changes to Finished even if all
 the images etc have not loaded yet...
 
 All done with PHP and a one line javascript call.
 
 Regards
 
 jon
 ]
 
 --
 --
 Jon Farmer
 Systems Programmer, Entanet www.enta.net
 Tel 01952 428969 Mob 07763 620378
 PGP Key available, send blank email to [EMAIL PROTECTED]
 --
 Jon Farmer
 Systems Programmer, Entanet www.enta.net
 Tel 01952 428969 Mob 07763 620378
 PGP Key available, send blank email to [EMAIL PROTECTED]
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

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




[PHP] Adding zeros to date

2001-10-05 Thread Daniel Alsén

Hi,

is there a easier way to add zeros to date than the script below? (ie to get
20011005 instead of 2001105). I wrote a long string replace. But it seems
kind of unecessary to me. Is it?


$date_time_array = getdate (time());
$date = $date_time_array[ mday];
$month = $date_time_array[ mon];
$year = $date_time_array[ year];


if ($month  10) {
$month = str_replace(1, 01, $month);
$month = str_replace(2, 02, $month);
$month = str_replace(3, 03, $month);
$month = str_replace(4, 04, $month);
$month = str_replace(5, 05, $month);
$month = str_replace(6, 06, $month);
$month = str_replace(7, 07, $month);
$month = str_replace(8, 08, $month);
$month = str_replace(9, 09, $month);
}

if ($date  10) {
$date = str_replace(1, 01, $date);
$date = str_replace(2, 02, $date);
$date = str_replace(3, 03, $date);
$date = str_replace(4, 04, $date);
$date = str_replace(5, 05, $date);
$date = str_replace(6, 06, $date);
$date = str_replace(7, 07, $date);
$date = str_replace(8, 08, $date);
$date = str_replace(9, 09, $date);
}

$datemonth = $year . $month . $date;

echo $datemonth;

# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


-- 
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] REPLACE problem

2001-10-03 Thread Daniel Alsén

Hi,

i need help with a, seemingly, simple problem...

I have a form that is supposed to update a MySql table with only two fields
(id and show_id). I use show_id to determine what is showing on my first
page and never store more than one value in the table.

Now - i cant seem to get the REPLACE to work. First it only added more rows
in the table with a new value each time. I solved that by inserting
I inserted a hidden value into the form to make sure that the correct (and
only) value will be replaced:

input type=hidden name=fid value=1

But, that´s when it stopped working.
Show_id is determined by radio buttons in the form and that part is working.
In the actual query i REPLACE the value of show_id:

$query = REPLACE INTO puff;
$query .= (id, show_id);
$query .=  values('$fid''$show_id');

I am sure it´s a simple solution. But please point it out for me.

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


-- 
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] REPLACE problem

2001-10-03 Thread Daniel Alsén

 A quick look at the REPLACE syntax tells me that

 REPLACE works exactly like INSERT, except that if an old record in the
 table has the same value as a new record on a unique index, the old
 record is deleted before the new record is inserted.

 So if id isn't a unique index, you could expect the values to be added.

The id is a unique index.
But - as often before. Asking something here triggers my brain to work. I
found the problem. I simply forgot a comma in my query:
$query .=  values('$fid''$show_id');

I got a little disappointed at first when the query started adding
additional values again. But it only did that one time. For some reason it
wanted id to have a row with the value 0. After that it started to replace
the row with id 1. And now it works :)

- Daniel



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

2001-09-21 Thread Daniel Alsén

Hi,

iam trying to grab info from a webpage.

This snippet is the part that does the actual searching...

$site = www.whatever.com/something.html;
$open = fopen($site, r);
$search = fread($open, 2);
fclose($open);
$search = ereg($begin(.*)$end, $search, $content);

What i find strange is that the search only works on the actual text in the
html-document. It doesn´t seem to be able to use htmltags as $begin or $end.

And another question: does  the search of $end begins from $begin? Or does
it scan the whole document for both strings?

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


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

2001-09-21 Thread Daniel Alsén

How do i send the user on to another page at the end of the execution of a
script?

# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


-- 
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] More Image gallery

2001-09-20 Thread Daniel Alsén

A little contribution from me as well...

I have altered the Todd Kennedy script a bit.
Instead of reading a textfile for the filenames it scans the directory and
displays all pictures (jpegs) that are there.

Go get it at: http://www.mindbash.com/scripts/mygallery.zip

# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


-- 
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] about image gallery

2001-09-20 Thread Daniel Alsén

 yours doen't need a text file with the image file names
 but this is usefull when you want to establish the order
 thumbs are shown

A matter of taste i guess. I wanted a script that needed as little work as
possible after i uploaded it.

Next thing to do is add page numbers for faster navigation. Coming up :)

 little trick:
 both, big imgs and thumbs should be same file type but
 I use jpg for big ones and gif for thumbs. after procesing
 them (thumbs) in image software I change the .gif extension
 to .jpg and it works!
 Gif is better for little images using a few colors so little image size

I have actually played around with that a bit. I found that jpegs actually
get smaller than the gifs if you want some sort of quality.

- Daniel


-- 
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] Even more image gallery

2001-09-20 Thread Daniel Alsén

Updated the Todd script again...

Now there are page numbers added with the next and prev links.

http://www.mindbash.com/scripts/mygallery.zip

Hepp!
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


-- 
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] Combining strings?

2001-09-19 Thread Daniel Alsén

Hi,

i was trying to figure this out myself. But since the php-manual is down...

I want to create a string with todays date and month in the format day/month
(19/9).

If i do:

$date_time_array = getdate (time());
$date = $date_time_array[ mday];
$month = $date_time_array[ mon];

I get the day and month in numbers. But how do i join $date and $month and
put a / in between them in a new string?

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


-- 
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] Combining strings?

2001-09-19 Thread Daniel Alsén

Thanks guys!

-- 
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] Replacing datafile with array

2001-09-18 Thread Daniel Alsén

Hi,

i am trying to replace a datafile wich contains the contents of a directory
with an array.
I am reading the directory and am trying to pass the value to an array. What
am i doing wrong? Shouldn´t $retVal contain the direcory info?

Also, is there a way to use the content of an array without getting the word
'Array' at the start?

$handle=opendir('.');
while (false !== ($file = readdir($handle)))

if ($file != .  $file != ..  ereg(.jpg,$file)) {

 $retVal[count($retVal)] = $file;

}

# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


-- 
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: Replacing datafile with array

2001-09-18 Thread Daniel Alsén

Hmm...

it still doesn´t work.

If i echo $retVal i just get the word 'Array' (the same number of times that
the number of files in the directory).

If i echo $file i get the file listing...however, it doesn´t pass on the
content to the rest of my script.

Maybe someone could help me out with the whole script? I downloaded this
from some script archive and it works if i use the list.photos datafile. But
i don´t want to change that file every time a new photo is uploaded.
I am trying to read the directory and use the directory handle listing
instead.

If anyone wants to help me out making this databasedriven instead youre very
welcome :)

?PHP

$retVal = array ();
//Load Directory Into Array
$handle=opendir('.');
while (false !== ($file = readdir($handle)))

if ($file != .  $file != ..  ereg(.jpg,$file)) {

$retVal [count($retVal)] = $file;

echo $retVal br\n;

}

//initialize variables
//$data_file = list.photos;
$thumbnail_dir = thumbs/;
$num_rows = 3;
$photos_per_row = 3;
$photos = file($retVal);  //$retVal used to be $data_file
$total_photos = sizeof($photos);
$photos_per_page = $num_rows * $photos_per_row;
//check to see if the start variable exists in the URL.
//If not, then the user is on the first page - set start to 0
if(!isSet($start)){
$start = 0;
}
//init i to where it needs to start in the photos array
$i = $start;
$prev_start = $start - $photos_per_page;
$next_start = $start + $photos_per_page;


for ($row=0; $row  $num_rows; $row++){
  print(tr\n);
  for ($col=0; $col  $photos_per_row; $col++){
  if($i  $total_photos){
$thumbnail = $thumbnail_dir.trim($photos[$i]);
$thumb_image_size = getimagesize($thumbnail);
$image_size = getimagesize(trim($photos[$i]));
print(td align=\center\
a
href=\javascript:photo_open('photo_display.php?photo=.trim($photos[$i]).'
,'.$image_size[0].','.$image_size[1].');\img src=\.$thumbnail.\
.$thumb_image_size[3]. border=\0\/a/td\n);
  } else {
print(td/td\n);
  }
  $i++;
}
print(/tr\n);
}


//Clean up directory array
closedir($handle);
return $retVal;


//end table
?

 -Original Message-
 From: _lallous [mailto:[EMAIL PROTECTED]]
 Sent: den 18 september 2001 13:46
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Replacing datafile with array


 works like a charm

 just initializet the $retVal function...

 $retVal = array();
 rest of script here


-- 
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: Replacing datafile with array II

2001-09-18 Thread Daniel Alsén

Woops!

I actually got the listing to work by replacing $photos = file($retVal);
with $photos = $retVal; :)

But, there´s still a problem. The script doesn´t seem to be able to use the
navigation part (print out the next and previous links). That part of the
script looks like this:

?PHP
//print out navigation links
if(($start == 0)  ($next_start  $total_photos)){

//you're at the beginning of the photo gallery

?

  font face=arial, helvetica size=2b
  a href=galleri.php?start=?PHP print($next_start);?next page/a
  /font/b


?PHP
}
elseif (($start  0)  ($next_start  $total_photos)){

//you're in the middle of the photo gallery

?

  font face=arial, helvetica size=2
  bfont color=#FF#171;/font
  a href=galleri.php?start=?PHP print($prev_start); ?prev
page/a/b/font
  b|/b
  font face=arial, helvetica size=2
  ba href=galleri.php?start=?PHP print($next_start); ?next page/a
font
  color=#FF#187;/font/b/font

?PHP
}
elseif(($start == 0)  ($next_start  $total_photos)){

//you're in a photo gallery with only one page of photos

?

?PHP
}
else {

//you're at the end of the photo galley

?
  font face=arial, helvetica size=2
  bfont color=#FF#171;/font
  a href=galleri.php?start=?PHP print($prev_start); ?prev
page/a/b/font
?PHP
}
?

 -Original Message-
 From: _lallous [mailto:[EMAIL PROTECTED]]
 Sent: den 18 september 2001 13:46
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Replacing datafile with array


 works like a charm

 just initializet the $retVal function...

 $retVal = array();
 rest of script here

 Daniel alsén [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi,
 
  i am trying to replace a datafile wich contains the contents of a
 directory
  with an array.
  I am reading the directory and am trying to pass the value to an array.
 What
  am i doing wrong? Shouldn´t $retVal contain the direcory info?
 
  Also, is there a way to use the content of an array without getting the
 word
  'Array' at the start?
 
  $handle=opendir('.');
  while (false !== ($file = readdir($handle)))
 
  if ($file != .  $file != ..  ereg(.jpg,$file)) {
 
  $retVal[count($retVal)] = $file;
 
  }
 
  # Daniel Alsén| www.mindbash.com #
  # [EMAIL PROTECTED]  | +46 704 86 14 92 #
  # ICQ: 63006462   |  #
 



 --
 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: Replacing datafile with array Sorry... .)

2001-09-18 Thread Daniel Alsén

Sorry,
It seems like every time i posted a question i was able to solve it myself
:) Something strange going on in my problem solving part of the brain.

I got the whole script to work. The navigation part solved itself when i
moved the 'cleaning up' part to the very end of the script.

Still, if anyone wants to help out, or has a good solution, to make this
databasedriven - please e-mail me.

Regards
# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


-- 
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] Help with database queries

2001-09-17 Thread Daniel Alsén

Hi,

need some help with the code below. I am thinking of reusing this for
building a thumbnail gallery from a database.

First, is the code actually good? Do i do something that will slow down the
responses?

Second, can anyone help me with a code sample to implement that will limit
how many records the query is displaying? (break the database response into
pages)

Third, any good ideas on how to do this the easiest way is appreciated :)

Thanks!
- Daniel


$db = mysql_connect(localhost, xxx, xxx);

mysql_select_db(xxx,$db);

$result = mysql_query(SELECT * FROM film WHERE artnr LIKE '$avd',$db);

if ($myrow = mysql_fetch_array($result)) {

echo TABLE cellSpacing=3 cellPadding=5 width=600 border=0\n;
echo TRTDspan class='text2'Art.nr/span/TD\n;
echo TDspan class='text2'Titel/span/TD\n;
echo TDspan class='text2'/span/TD/TR\n;

do {

printf(TRTD bgColor=#efefefspan class='text'%s/span/TD
TD bgColor=#efefefspan class='text'b%s/b/span/TD
TD bgColor=#efefefspan class='text'%smin/span/TD
/TR\n, $myrow[artnr], $myrow[titel], $myrow[dur]);

} while ($myrow = mysql_fetch_array($result));
echo /table\n;

} else {
echo span class='text2'No records available.../span;
}

# Daniel Alsén| www.mindbash.com #
# [EMAIL PROTECTED]  | +46 704 86 14 92 #
# ICQ: 63006462   |  #


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