Re: [PHP] Date Formatting

2002-12-13 Thread Support @ Fourthrealm.com
Use this:
function makedate($format, $indate)
{
$temp = explode(-, $indate);
$fulldate = mktime(0, 0, 0, $temp[1], $temp[2], $temp[0]);
$temp = date($format, $fulldate);
return ($temp);
}

and call it with this:
makedate(F d, Y, $row-datefield);

where $row-datefield is the variable of the date field in your table.


Peter


At 11:55 AM 12/13/2002 -0600, you wrote:

How can I format a date coming out of a MySQL? I know how to format 
today's date but not a date coming out of MySQL. I have looked through the 
manual, but I must be blind because I cannot figure it out.

Thanks,
Clint

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




Re: [PHP] Show only user that variable musiccontain pop

2002-11-27 Thread Support @ Fourthrealm.com

If you only have one condition, then get rid of the AND in the where statement;

Select only the fields that you need, instead of *

Like this:

SELECT id FROM $TBL_NEWS WHERE music LIKE '%pop%'  ORDER BY name


Peter

At 03:16 PM 11/27/2002 -0500, Benjamin Trépanier wrote:

Hi, I need information about  a simple command...

I have a DB (of course...) and I need to show only ID that variable
musiccontain  pop

I found this example that is suppose to do a similar thing in a msql
query...

SELECT * FROM $TBL_NEWS WHERE music LIKE '%pop%' AND  ORDER BY name


So it's not working properly...

Thanks for your help

Ben


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


- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




Re: [PHP] scrolling data from db

2002-11-20 Thread Support @ Fourthrealm.com
Eddie,
I use the attached on a site of mine... works with JavaScript and DIV tags.

There are 2 parts to the file - the javascript, and then the HTML code to 
make it happen.  Tweak according to your needs.

Peter


At 11:00 AM 11/20/2002 -0500, you wrote:
I have a large amount of data to present to the user.  Currently, I am just
putting it in a table and displaying it on the page, if it is more than a
page of course the page just scrolls.  Is there a way o, without using
frames, to put all the data from the db in the middle of the page with a
scroll bar on the side that just scrolls the data, I mean the header and
footer of the php page do not move?  I am sure I will need javascript for
this...right?

Thanks,
Eddie


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


- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -

!-- TWO STEPS TO INSTALL LAYER SCROLLER:

  1.  Insert the first code in a new file, save as popup.html
  2.  Add the opening code to the BODY of your main HTML document  --

!-- STEP ONE: Insert the first code in a new file, save as popup.html  --

HTML
HEAD

SCRIPT LANGUAGE=JavaScript
!-- Begin

//verScroll('up','1','true')

function verScroll(dir, spd, loop) {
loop = true;
direction = up;
speed = 10;
scrolltimer = null;
if (document.layers) {
var page = eval(document.contentLayer);
}
else {
if (document.getElementById) {
var page= eval(document.getElementById('contentLayer').style);
}
else {
if (document.all) {
var page = eval(document.all.contentLayer.style);
  }
   }
}
direction = dir;
speed = parseInt(spd);
var y_pos = parseInt(page.top);
if (loop == true) {
if (direction == dn) {
page.top = (y_pos - (speed));
} else {
if (direction == up  y_pos  10) {
page.top = (y_pos + (speed));
} else {
if (direction == top) {
page.top = 10;
  }
   }
}
scrolltimer = setTimeout(verScroll(direction,speed), 1);
   }
}
function stopScroll() {
loop = false;
clearTimeout(scrolltimer);
}
//  End --
/script
/head
body
div id=contentLayer style=position:absolute; width:300px; z-index:1; left: 39px; 
top: 51px 


insert your text here !!



/div
div id=scrollmenu style=position:absolute;width:200px;height:30px;z-index:1; 
left:400px; top: 40px
table border=1trtd
table
tr
td align=leftUp/td
td /td
td align=rightDown/td
/tr
tr
td colspan=3
a href=# onMouseOver=verScroll('up','25','true') 
onMouseOut=stopScroll()/a 
a href=# onMouseOver=verScroll('up','5','true') onMouseOut=stopScroll()/a 
a href=# onMouseOver=verScroll('up','1','true') onMouseOut=stopScroll()/a |
a href=# onMouseOver=verScroll('dn','1','true') onMouseOut=stopScroll()/a 
a href=# onMouseOver=verScroll('dn','5','true') onMouseOut=stopScroll()/a 
a href=# onMouseOver=verScroll('dn','25','true') onMouseOut=stopScroll()/a
/td
/tr
/table
/td/tr/table
/div
/body
/html







!-- STEP TWO: Add the opening code to the BODY of your main HTML document  --

BODY

center
form name=scrollwindow
input type=button value=Open Scroll Window 
onClick=window.open('popup.html','scrollwindow','top=100,left=100,width=575,height=400');
/form
/center

pcenter
font face=arial, helvetica SIZE=-2Free JavaScripts providedbr
by a href=http://javascriptsource.com;The JavaScript Source/a/font
/centerp

!-- Script Size:  7.99 KB --

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


RE: [PHP] scrolling data from db

2002-11-20 Thread Support @ Fourthrealm.com
Hi Eddie,
iFrames do offer a really nice solution, but they are an IE only 
tag.  Although I can't vouch for the latest Netscape, I know that the older 
versions simply ignore the iFRAME... tag, and leave a blank spot in its 
place.

If you know that your client base will ever only use IE, then go for 
it.  Otherwise, you'll have to avoid the iframe.


Peter

At 03:17 PM 11/20/2002 -0500, Edward Peloke wrote:
Thanks Peter!

I will take a look.  As I am new to javascript, why would someone use
javascript when iframes are easier?  Will I be able to use the javascript on
more browsers?  Are the iframes limited?

Thanks,
Eddie

-Original Message-
From: Support @ Fourthrealm.com [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 20, 2002 11:23 AM
To: Edward Peloke; [EMAIL PROTECTED]
Subject: Re: [PHP] scrolling data from db


Eddie,
I use the attached on a site of mine... works with JavaScript and DIV
tags.

There are 2 parts to the file - the javascript, and then the HTML code to
make it happen.  Tweak according to your needs.

Peter


At 11:00 AM 11/20/2002 -0500, you wrote:
I have a large amount of data to present to the user.  Currently, I am just
putting it in a table and displaying it on the page, if it is more than a
page of course the page just scrolls.  Is there a way o, without using
frames, to put all the data from the db in the middle of the page with a
scroll bar on the side that just scrolls the data, I mean the header and
footer of the php page do not move?  I am sure I will need javascript for
this...right?

Thanks,
Eddie


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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




Re: [PHP] scrolling data from db

2002-11-20 Thread Support @ Fourthrealm.com
Justin,
Creative thinking to a smart solution.  I will keep that in mind for future 
sites.

Peter

At 10:35 AM 11/21/2002 +1100, Justin French wrote:
 If you know that your client base will ever only use IE, then go for
 it.  Otherwise, you'll have to avoid the iframe.

That sounds a little harsh!

You can put a message in place of the iframe, for those who don't support
it.

iframe src= blah blah
Sorry, your browser does not support iframes, to view the content of this
frame, a href=click here/a.
/iframe

Or better still, you can actually PUT SOME CONTENT IN THERE.

I have an iframe which lists multiple tour dates for a band, sorted in date
order... if the iframe can be used, the user gets ALL upcomming gigs ina
scroller, otherwise they just get the next 3 (using approximately the same
amount of space), with a link to view all gigs.


iframes CAN work in many cases, if you think about it.


- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




Re: [PHP] date

2002-11-19 Thread Support @ Fourthrealm.com
Eddie,
This is a function that I wrote to handle this same situation:

# --- Function to format date output ---
function makedate($format, $indate)
{
$temp = explode(-, $indate);
$fulldate = mktime(0, 0, 0, $temp[1], $temp[2], $temp[0]);
$temp = date($format, $fulldate);
return ($temp);
}


Call it like this:

echo makedate(m/d/Y, $myrow[departdate]); #  returns  11/30/2002
echo makedate(F d, Y, $myrow[departdate]); #  returns 
November 30, 2002


You can use any of the standard date formatting commands in the function call.

HTH!

Peter



At 10:10 AM 11/19/2002 -0500, Edward Peloke wrote:
I am pulling from a datetime field in mysql.  The actual data looks like
this: 2002-11-30 00:00:00  When I output the data to the page, I want it to
appear as 11/30/2002.  I want to use a php date format.  I do not want it
formatted as it comes out of the db. But date(m/d/y, $myrow[departdate])
returns 12/31/69.  How can I do this?

THanks,
Eddie


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


- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




Re: [PHP] Seconds to minutes

2002-11-19 Thread Support @ Fourthrealm.com
Bob,
Instead of dividing, use modulus to get the exact number of remaining 
seconds, and then determine the minutes from that.

Here is some code that I've quickly adapted from another language I use, to 
take the total minutes, and convert it to hours:minutes display.

$totalmins = 193;
$showmins = $totalmins%60;
$showhrs = ($totalmins-$showmins)/60;
echo $showhrs.:.$showmins;

I haven't tested this, but it might give you a start.  The same concept 
would apply to converting seconds to minutes...

Peter


At 12:16 PM 11/20/2002 +1100, Bob Irwin wrote:
Its seems far more reliable than what I am using (dividing by 60 for
minutes, 3600 for hours and doing rounding, exploding if its not a round
number etc).

Its only for measuring short times, so Matt's suggestion should work ok.
Ideally though, because it will crop up from time to time, it'd be the go to
do it right the first time.

Anyone else know of a better way?

Best Regards
Bob Irwin
Server Admin  Web Programmer
Planet Netcom
- Original Message -
From: John W. Holmes [EMAIL PROTECTED]
To: 'Matt' [EMAIL PROTECTED]; 'Bob Irwin' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Wednesday, November 20, 2002 12:09 PM
Subject: RE: [PHP] Seconds to minutes


  You can do something like this:
  ?php
   $seconds = 265;
   $time = date('i s',$seconds);
   $minSecs = explode(' ',$time);
   echo {$minSecs[0]} minutes and {$minSecs[1]} secondsbr\n;
  ?

 That doesn't work for anything over 3599 seconds, though...

 ---John Holmes...



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


 Scanned by PeNiCillin http://safe-t-net.pnc.com.au/

 Scanned by PeNiCillin http://safe-t-net.pnc.com.au/



Scanned by PeNiCillin http://safe-t-net.pnc.com.au/

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


- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




[PHP] Recommend a merchant/store product

2002-10-28 Thread Support @ Fourthrealm.com
Hey everyone,
For years I have used a fantastic merchant ( http://www.ihtmlmerchant.com 
), which is feature packed and easy to setup and use.  It's written in a 
competing language called iHTML ( http://www.ihtml.com ).

As I am getting considerably proficient at coding PHP, I find that I 
require a similar type merchant/store package that I can base future PHP 
e-commerce sites on.  I have mySQL and MS SQL Server available to me.

So... my questions to the list are:

1) What store product/package do you use?  Why?  URL?
2) What is purchase cost?  Is it one-time or per store?
3) What databases does it support?


Many thanks in advance.

Peter

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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



[PHP] Recommend a merchant/store product

2002-10-28 Thread Support @ Fourthrealm.com
Hey everyone,
For years I have used a fantastic merchant ( http://www.ihtmlmerchant.com 
), which is feature packed and easy to setup and use.  It's written in a 
competing language called iHTML ( http://www.ihtml.com ).

As I am getting considerably proficient at coding PHP, I find that I 
require a similar type merchant/store package that I can base future PHP 
e-commerce sites on.  I have mySQL and MS SQL Server available to me.

So... my questions to the list are:

1) What store product/package do you use?  Why?  URL?
2) What is purchase cost?  Is it one-time or per store?
3) What databases does it support?


Many thanks in advance.

Peter

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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



Re: [PHP] running slow on Win2k

2002-10-11 Thread Support @ Fourthrealm.com

More details on this...
As I pay more attention to when it is sluggish or not, I notice that it 
seems to run fine on a typical page, with or without mySQL connections.

But... the slowdown comes whenever I'm into my frame-based Admin, where 2-3 
frames are typically loading at the same time.  The same Admin structure 
written in another language is quick, but the PHP version seems slow.

I hope this can spark some new suggestions...

Thanks in advance...
Peter



At 11:19 AM 10/7/2002 -0400, you wrote:
Hi everyone,
I notice that my PHP runs really slow on Win2k Server w/ IIS 5, and even 
slower when accessing a mySQL database.  It's a PIII-800 with 256MB 
RAM.  It is otherwise a great machine, and fast.

Any suggestions?

Peter

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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




[PHP] HTTP_USER_AGENT - list of possibilities

2002-10-08 Thread Support @ Fourthrealm.com

Hey everyone... do you know where I can find a list of the common returns 
of the $_SERVER[HTTP_USER_AGENT] variable?

For example:
I.E. 5.0 = Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0; .NET CLR 
1.0.3705)
Netscape 4.08 = Mozilla/4.08 [en] (WinNT; U ;Nav)


Thanks,
Peter


- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




[PHP] running slow on Win2k

2002-10-07 Thread Support @ Fourthrealm.com

Hi everyone,
I notice that my PHP runs really slow on Win2k Server w/ IIS 5, and even 
slower when accessing a mySQL database.  It's a PIII-800 with 256MB 
RAM.  It is otherwise a great machine, and fast.

Any suggestions?

Peter


- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




Re: [PHP] running slow on Win2k

2002-10-07 Thread Support @ Fourthrealm.com

Edwin,
I have no interest in getting into a Win2K/Linux debate.  There are 
strengths and reasons for using both systems.

I run other applications (ASP, .NET, iHTML, MSSQL) without any problems, 
and they all work very quickly.  Win2K is my primary development 
environment as it matches the systems my clients use.

So, I just need to know if there are some tweaks I should be considering to 
speed up PHP?


Peter


At 12:31 AM 10/8/2002 +0900, @ Edwin wrote:
Hello,

On Tuesday, October 8, 2002 12:19 AM
Support @ Fourthrealm.com wrote:
  Hi everyone,
  I notice that my PHP runs really slow on Win2k Server w/ IIS 5, and even
  slower when accessing a mySQL database.  It's a PIII-800 with 256MB
  RAM.  It is otherwise a great machine, and fast.
 
  Any suggestions?
 

Perhaps, you can increase your RAM. Better yet, take Win2k and IIS off and
install Linux and Apache. I'm sure next time you'll ask, why is it faster?

- E

  Peter
 
 
  - - - - - - - - - - - - - - - - - - - - -
  Fourth Realm Solutions
  [EMAIL PROTECTED]
  http://www.fourthrealm.com
  Tel: 519-739-1652
  - - - - - - - - - - - - - - - - - - - - -
 
 
  --
  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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




RE: [PHP] Getting started with PHP

2002-09-26 Thread Support @ Fourthrealm.com

Sauron,
Since you're running Win2K, then you can use IIS already installed instead 
of Apache.  I use Win2K Server, with IIS, PHP 4, and mySQL on my local box, 
and it works just fine.

Peter



At 10:55 AM 9/26/2002 -0400, Steve Bradwell wrote:
Welcome Steve,

You'll need to do two things to get started, download apache and php for
windows, and configure 2 files - httpd.conf (apache), and php.ini. A good
tutorial can be found here :

http://softwaredev.earthweb.com/script/article/0,,12014_912381,00.html

After that create a .php file in apache's /htdocs dir (which is where you
will put your pages), the file should look like this:

?
phpinfo();
?

This will show you all of php's configuration settings.

 From there the world is your oyster ;)

HTH,
Steve.

-Original Message-
From: Sauron [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 25, 2002 12:53 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Getting started with PHP


Hi all

I am brand new to PHP, I have a friend that develops in it and I'm
interested in learning more about it. I am familiar with VB at the moment
and that's about it, but I'm always willing to learn!!

What do I need to get developing using PHP? I want to develop completely on
my machine rather than upload files to a web server. I have W2K installed.

Any help is much appreciated,

Regards,

Steve.




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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




RE: [PHP] Thoughts on a simple search engine...

2002-09-24 Thread Support @ Fourthrealm.com

Chuck,
Setup your form like this (assuming search.php is the name of your page):

FORM ACTION=search.php METHOD=post
INPUT TYPE=hidden NAME=step VALUE=2
.
/FORM


Then in your search.php page, use this structure:

# --- set $step to passed value, or else set to default ---
if (isset($_GET[step]))   { $step=$_GET[step]; }
elseif (isset($_POST[step]))  { $step=$_POST[step]; }
else{ $step=1; }


if ($step==2)
{
 # --- do the Search query and display results here ---


 # after displaying, then set step=1  to force the search form to 
come up again at the bottom of the page
 $step=1;
}

if ($step==1)
{
 # --- put the form here...  ---
}


I use the step variable all the time in controlling page flow, and 
allowing me to re-use the same .php file for many similar purposes to keep 
the file count of the site low.

HTH,

Peter



At 02:13 PM 9/24/2002 -0500, Jay Blanchard wrote:
[snip]
So I if I create the form, is there way that I can have it echo on the same
page if I am using a form?
[/snip]

Yes, using $PHP_SELF as your form action

HTH

Jay

Ever stop to think, and forget to start again?

*
* Texas PHP Developers Conf  Spring 2003*
* T Bar M Resort  Conference Center*
* New Braunfels, Texas  *
* Contact [EMAIL PROTECTED]   *
*   *
* Want to present a paper or workshop? Contact now! *
*


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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




Re: [PHP] How do I use a Javascript variable in PHP?

2002-09-23 Thread Support @ Fourthrealm.com

Tom,
JavaScript is a client side language, while PHP is server side.

This means that the PHP is parsed and evaluated before it ever reaches the 
surfers browser.  And since the JavaScript variable will not be available 
until it is created by the browser, there is no way to interact with it.


Peter


At 02:08 PM 9/23/2002 +0100, Tom wrote:
Hi all,



I hope this is the right place to pose my question, so here goes: -



I have a javascript function called calcMonth() and given a number it will
return a date i.e. month = calcMonth( 57 )   -  month will be 'sept 2002'



The problem I`m having is at the beginning of my PHP file I`m calling this
calcMonth() then doing a load of php stuff and then trying to use the
javascript month variable, but to no avail: -



print tdinput type=text class=claimreadonly readonly name=POST_monthdisp
value=javascript:month; size=10 tabindex=99/td;



The result is, the browser displays the words 'javascript:month;' - not a
month number



I`ve looked everywhere for an answer from persistent javascript data to
using framesets to hold the variable but to no avail.



I know its quite a bit of javascript, but its mixed in  with PHP too so I
thought it`d be the right place.



Anyways, I hope someone can provide the answer to my problem.



Thanks in advance,

Tom




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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




Re: [PHP] How do i assign Integers only and not real numbers?

2002-09-23 Thread Support @ Fourthrealm.com

Hi Tom,
Try this:
$years = round($years + ( $themonth / 12 ));


 From the manual:
float round ( float val [, int precision])
Returns the rounded value of val to specified precision (number of digits 
after the decimal point). precision can also be negative or zero (default).


ceil() and floor() also exist.



Peter


At 03:46 PM 9/23/2002 +0100, Tom wrote:
Hi all,

I have a line of code that assigns a new year number: -

$years = $years + ( $themonth / 12 );

but sometimes $years == 1998.08

or

$year == 2002.75

etc...

I cant find anything like a round() or floor() function in PHP so that year
would be 1998 or 2002 only.

Does anyone know what function would do this?  Sorry if I`m wasting your
time if its a really obvious one!

thanks in advance,
Tom



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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


Re: [PHP] date functions

2002-09-23 Thread Support @ Fourthrealm.com

Patrick

Off the top of my head... Convert both date1 and date2 to unix timestamps, 
and subtract one from the other.  That will give you the number of seconds 
between them.  Then, convert to hours, minutes, etc as required.

Peter


At 10:38 PM 9/23/2002 +0200, Patrick wrote:
i got 2 dates and i want to know how many minutes between em,, like:

$date1 = date(Y-m-j H:i);
$date2 = date(Y-m-j H:i, strtotime(now) + 1800);

$minutes = date_something($date1, $date2);

echo there are $minutes between, $date1 and $date2;

regards
patrick



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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




Re: [PHP] Re: PHP source code

2002-09-19 Thread Support @ Fourthrealm.com


A solution that I use is to put important information in an include file, 
and store it in a User-Authentication protected folder, ie. /admin/

This adds one extra layer of protection to your files, and keeps the 
average joe-surfer from being able to get the files.

Peter


At 08:24 PM 9/19/2002 +, Stephan Seidt wrote:
Then be sure that nobody is able to read it.
Should be no problem ;)
There is no possibility to read php source,
the webserver will always count it as php file
and the file will be parsed by php.

Sure its possible to get the file over ftp, ssh, imap, etc,
but this is the problem with all the secret-file stuff.

bye,
blizz

On Thu, 19 Sep 2002 20:15:06 +0200, [EMAIL PROTECTED] (Oliver Witt) 
wrote:

  Stephan Seidt schrieb:
 
   On Thu, 19 Sep 2002 16:50:16 +0200
   [EMAIL PROTECTED] (Oliver Witt) wrote:
  
Hi,
Is there any way to read php source code? I didn't think so until I
heard about people you have done that...
Kind regards,
Oliver
   
  
   If you mean php's source, download it ;)
 
  Well, but if I write a script with MySQl, there has to be my user name
  and password in the source code. If anybody could read it, anybody could
  have access to my databases!
  Oliver
 
 
 

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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




[PHP] Date(), adjusted for one year

2002-09-18 Thread Support @ Fourthrealm.com

Hi guys,

What is the easiest way to get the date of one year from today?
Accommodating for leap years is not essential (but would be a nice bonus).

Thanks,
Peter


- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




Re: [PHP] Date-format

2002-09-18 Thread Support @ Fourthrealm.com

Reformatting before an inserting/updating is one option, but how would we 
change the mySQL database to accept the other format?

Peter


At 04:18 PM 9/12/2002 +0800, Jacob Miller wrote:
Why can't you just reformat it before inserting it into the db?

 $date = 31.12.2002;

 $parts = split(\., $date);
 echo $parts[2].-.$parts[1].-.$parts[0];

- jacob

At 16:13 09/12/2002, Tommi Virtanen wrote:
Well, insert format in wrong, but in Finland enter format is dd.mm.,
so I cannot use other insert format (it have to do other way).

gustavus

 It looks to me like the database is interpreting your date
 incorrectly.  Try changing the format you use to insert, -mm-dd



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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




[PHP] Efficiency

2002-09-18 Thread Support @ Fourthrealm.com

Which is more efficient?

a) a sql loop where everything is displayed/formatted using echo stmts, 
like this:

$result = mysql_query(SELECT * FROM news WHERE active=1);
while ($row = mysql_fetch_object($result)) {
 echo TRTD$row-title /TD/TR;
}
mysql_free_result($result);

?


OR
b) a sql loop where you break in and out of php tags as needed:

?php
$result = mysql_query(SELECT * FROM news WHERE active=1);
while ($row = mysql_fetch_object($result)) {
?
TRTD
 ?php echo $row-title; ?
/TD/TR

?php
}
mysql_free_result($result);

?


Obviously, these are really simplified examples.  Typically the html code 
gets much more complicated.


Peter


- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




RE: [PHP] Date-format

2002-09-18 Thread Support @ Fourthrealm.com


Thanks everyone for the helpful answers.

I agree that manuals are useful, but there are times when an example works 
better.

I took all of this information, and some details from earlier posts about 
dates, and produced the following function to make it easy to format dates 
without have to go through and change sql stmts.

# --- Function to format date output ---
function makedate($format, $indate)
{
 $temp = explode(-, $indate);
 $fulldate = mktime(0, 0, 0, $temp[1], $temp[2], $temp[0]);
 $temp = date($format, $fulldate);
 return ($temp);
}


The function gets called like this:

makedate('Y/m/d', $row-articledate);or
makedate(F d, Y, $somedate);


Hopefully this will someone else with their date challenges.


Peter


At 02:55 PM 9/18/2002 -0400, Chuck Payne wrote:

I know everyone love to quote read the manual and forget that we[newbies]
are only asking here because we need help...so here you go...

You can do the following...

DATE_FORMAT IS THE MySQL Command

And let say you want to format your date as the following mm-dd-yy(US) or
dd-mm-yy(the rest of the world).

By the way this are format keys

%m the month in numbers,
%d the days in numbers,
%y the year in number
%M spells out the month
%D gives the date with th, rd, nd all that
%Y gives all four numbers

So you do the following sql statement...

SELECT DATE_FORMAT(yourdate, '%m-%d-%y') as youwanttocallit FROM yourtable;

So in your php code you can do this from your MySQL statement...

$youwantcallit = $myrow[youwanttoit];

? echo $youwanttocallit; ?

Advance note

then if you don't want to show 00-00-00 you can do this...

if ($youwanttocallit == 00-00-00) {
   $youwanttocallit = nbsp;;
}

that way you don't have a bunch of 00-00-00 showing up.

I hope that helps, because that is what the maillisting is for and not to
always quote Read the Book.

Chuck Payne
Magi Design and Support



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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




[PHP] use of mysql_free_result (was Re: [PHP] Efficiency)

2002-09-18 Thread Support @ Fourthrealm.com

Rick, or anyone,

Based on what you said below, can you describe for me when the 
mysql_free_result tag should be used, and when it is not necessary?

I'm fluent in other web languages (iHTML, ASP), but am fairly new to PHP, 
so I'm still learning the intricacies of the language, and the best way to 
use it

Many thanks,
Peter



At 04:02 PM 9/18/2002 -0600, you wrote:
If you aren't doing anything else in a script, mysql_free_result is not needed
in a script like this because the result set will be cleaned up by PHP when
the script ends.

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




[PHP] reuse database connections

2002-09-18 Thread Support @ Fourthrealm.com


Another question about efficiency / using server resources:

In another language I use, I can re-use an ODBC connection to make further 
queries/update/etc to the database to save the overhead of closing and 
reopening the connection to the db over and over.

It works sometime like this (in the other language):
iSQL DBNAME='xxx' LOGIN='xxx' SQL='some query'   # opens the connection
 ... display results...
iSQLMORE SQL='some other query'  # reuses the connection
 display other results
/iSQL   # closes the connection


Is there an equivalent in PHP to this, using the mySQL set of tags?


Peter


- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




Re: [PHP] Processing PHP in Template File

2002-09-12 Thread Support @ Fourthrealm.com

John

Include your template this way:

$file_name=templates/somefile.php
$New_Content1 = 'This is the new text';
$New_Content2 = 'This is the other text';
include $file_name;


In the template file, have ?php echo $New_Content; ? etc wherever the 
content should appear.

Then you can put other php code in the template file as well.

I use this all the time.


Peter


At 12:00 PM 9/12/2002 -0700, you wrote:

Hello everyone.

I want to implement templates in a site, but am having trouble processing
php within the template file. The application flow is as follow:

-open the template file (which has some place holders) with
$fileHandler =  file($file_name)

-Replace placeholders (within the template files) with
  $fileHandler = ereg_replace(--PlaceHolder--,New content,$Handler)
  //disregard syntax errors...

-Then display the content of the modified template
  $fileHandler = implode('',$fileHandler)
  echo $fileHandler;


The above process works, as far as replace the place holders, and printing
the new content (which is an HTML file). However, it will not process PHP
scripts, within the template.

For example, if my template has

.. ?php echo hello!; ?

blah blah blah
the above process will display the PHP code within the HTML file, without
processing.

How can I process the PHP codes that's in the template?


-john



=P e p i e  D e s i g n s
  www.pepiedesigns.com
  Providing Solutions That Increase Productivity

  Web Developement. Database. Hosting. Multimedia.



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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




Re: Fw: [PHP] Re:[PHP]question

2002-09-11 Thread Support @ Fourthrealm.com

Meltem,

You're much better off to use JavaScript to perform the form 
validation.  This way, when the user clicks on the Submit button, 
JavaScript can make sure that values are filled in, or that they are within 
range, and can then pop up a message advising them of any errors, and that 
they can't continue until the info is corrected.  This saves the hassle of 
you having to create a system that will send details to/from various pages, 
and the user doesn't have to fill in the entire form all over again, as 
their values stay on the page.

I use this site quite often for javascript code:
http://javascript.internet.com/

Peter


At 04:53 PM 9/11/2002 +0300, you wrote:
I think because of my bad english I made you misunderstand..I ment this :
for example  when a person miss an input  to fill on the from  and then
press the submit button I want him to be back to the same form page with a
special message that I entered (something like :you left . place
empty).But I dont want to copy the same form page accoring to the possible
mistakes .. I want to learn if there is an easier way to do this...
thanks to everyone..

meltem
- Original Message -
From: Meltem Demirkus [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, September 11, 2002 4:40 PM
Subject: [PHP] Re:[PHP]question


 
  Thanks ...But I know this way about carrying data from one page to
another..
  I want this message to be seen on the page without my doing
anythingand
  I cant do that?..
 
  - Original Message -
  From: John Wards [EMAIL PROTECTED]
  To: Meltem Demirkus [EMAIL PROTECTED];
  [EMAIL PROTECTED]
  Sent: Wednesday, September 11, 2002 4:36 PM
  Subject: Re: [PHP] question
 
 
   pass the message as a variable
  
   header:location.php?message=$message
  
  
   - Original Message -
   From: Meltem Demirkus [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Wednesday, September 11, 2002 2:31 PM
   Subject: [PHP] question
  
  
Hi,
I am working on a process which turn to the previous page when the
user
enter something wrong in the form on a page .But I also want to warn
the
user with an error message on this page ...I know using heder :
location
   but
I couldn't  add the message ...
can anybody help me ? How can I add this message to the page..
thanks alot
   
metos
   
   
--
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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




Re: [PHP] help me regarding redirecting a page

2002-09-09 Thread Support @ Fourthrealm.com

Anjali,

Use a BUTTON type element, and some javascript:

INPUT TYPE=button VALUE=Cancel  Return to menu 
ONCLICK=self.location=menu.ihtml'


Peter

At 01:57 PM 9/8/2002 -0700, you wrote:
hello,

i dont know how to redirect a page... i mean i want to
have the effect of submit button without clicking on
the submit button.

thank you
anjali

__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




Re: [PHP] select box

2002-09-09 Thread Support @ Fourthrealm.com


If you want to put the SELECTED option into your select list while you are 
building the page, use an if statement in the option... ... something 
like this:

OPTION VALUE=1 ?php if ($this==$that) {echo SELECTED; } ? Option 1
OPTION VALUE=2 ?php if ($this==$that2) {echo SELECTED; } ? Option 2


Peter



At 02:05 PM 9/9/2002 +0300, you wrote:
Hi,

Can I put the selected option of select box   later by using php?

thanks



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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




[PHP] Re: [PHP-DB] Radio buttons

2002-08-26 Thread Support @ Fourthrealm.com

Your radio buttons look fine.  I would ensure to add quotes (single or 
double) around the attribute settings, for HTML compliance.  If you must go 
without quotes, then make sure that you don't put spaces in any of the 
attribute values.

INPUT type=radio value=6 name=surf_erf

As for the form not working... do you have a JavaScript that works with 
these radio buttons?

Or, is the radio button name the same as the Submit button?



At 07:25 PM 8/26/2002 +0200, you wrote:
Hello, I get forms posted and working, but as soon as I include radio
buttons, the whole form doesn't function anymore. The code of the radio
button part is included in this posting.
Can you tell me, what I'm doing wrong?
Help would be greatly appreciated!

S. Maier


 TR
   TD width=35%Wie häufig surfen Sie im Internet? /TD
   TD vAlign=center width=15%
 DIV align=rightFONT size=-1selten/FONT/DIV/TD
   TD width=5% bgColor=#cc
 DIV align=centerFONT size=-1INPUT type=radio value=1
 name=surf_erf /FONT/DIV/TD
   TD width=5% bgColor=#cc
 DIV align=centerFONT size=-1INPUT type=radio value=2
 name=surf_erf /FONT/DIV/TD
   TD width=5% bgColor=#cc
 DIV align=centerFONT size=-1INPUT type=radio value=3
 name=surf_erf /FONT/DIV/TD
   TD width=5% bgColor=#cc
 DIV align=centerFONT size=-1INPUT type=radio value=4
 name=surf_erf /FONT/DIV/TD
   TD width=5% bgColor=#cc
 DIV align=centerFONT size=-1INPUT type=radio value=5
 name=surf_erf /FONT/DIV/TD
   TD width=5% bgColor=#cc
 DIV align=centerFONT size=-1INPUT type=radio value=6
 name=surf_erf /FONT/DIV/TD
   TD vAlign=center width=20%FONT size=-1oft /FONT/TD/TR




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

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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