[PHP] Get page height?

2001-05-16 Thread DRN

Hi, I was wondering if it would be possible to get the page height
using php?

The reason I would like to do this is so that I can include a link to
the top of the page if the page is long enough, but not to display it
for very short pages (where it would not be needed:)

Cheers for your help,
Donald


  Accessible Computers, competitive prices on all computer related
items including Hardware, Software, Consumables and Custom Built PCs
http://www.AccessibleComputers.co.uk

   personal website: http://www.donaldrnoble.f2s.com




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




[PHP] check if a variable is in a number of states.

2001-05-12 Thread DRN

Hi, I would like to check whether a variable, $type, is equal to a
number of different possible states. I know I could use
if ( $type == abc || $type == bcd) { $a = b }
but this would get a bit clumsy if I had to check whether it is say
one of 20 different things.

What I was wondering is, is there a better way of doing this? I will
occasionally need to add another option as well, although I don't mind
a simple code edit.


Cheers for your help,  Donald
__
As well as learning more,
I learn that there is even more I don't know

http://www.donaldrnoble.f2s.com
¯¯



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




[PHP] converting DATETIME to a readable date.

2001-04-14 Thread DRN

Hi, I have a MySQL table recording errors, 1 of the fields is a
DATETIME, to give me the time of the error.
I have made a file which will then display a table of errors.

I would like to display the date and time in a more readable format,
even just with spaces between the years  months etc.

Having a look through the php online documentation I found this
example:

~~
If you have a MySQL column with of the DATETIME type, and you want to
format the values to a different representation, use this code:

$date = $row["date"];

$new_date = date("l, j M Y, G:i:s", strtotime($date));
~~

but I cannot get this to work :(, I get an "unexpected error in
date()"

I don't (yet) know enough about php to work out what this error is,
could someone help.


Cheers for your help,  Donald
__
As well as learning more,
I learn that there is even more I don't know

http://www.donaldrnoble.f2s.com
¯¯



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




Re: [PHP] converting DATETIME to a readable date.

2001-04-14 Thread DRN


Brian Clark [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
| Hi DRN,
| Try this and see if it functions correctly:
|
| ?php
|
| $date = str_replace('-','/',$row["date"]);
| $new_date = date("l, j M Y, G:i:s", strtotime($date));
|
| ?
|
That works great, thanks Donald



-- 
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] Parse error after end of file

2001-04-09 Thread DRN

Hi, I am trying to include a header to my document, I my problem is I
keep getting a parse error on the line after the header ends. I cannot
see what is causing this, can someone see what I have done wrong, the
code is below.

Cheers for your help, Donald

html
head
titleAccessible Computers ?="$page_title"?/title
meta name=keywords content="stuff"
meta name=description content='?
   if ($description) {
  echo "$description";
   } else {
 echo "Accessible Computers";
   ?'
meta name=Robots content="index, follow"
link rel=stylesheet href="/files/ac_style.css" type="text/css"
/head

body bgcolor="#FF" text="#00" link="#FF" vlink="#660099"
alink="#FF00FF"
table border="0" cellspacing="0" cellpadding="0"
  tr
td bgcolor="#99CCFF" align=left valign=top rowspan=2?
if ($no_menu_link==Home) {
echo "img src='/images/logo.gif' width=250 height=60 align=top
alt='accessible computers' border=0";
} else {
   echo "a href='/index.php'img src='/images/logo.gif'
width=250 height=60 align=top alt='accessible computers' border=0
title='Accessible Computers, Home'/a";
} ?/td
 td bgcolor="#99CCFF" width=20 rowspan=2nbsp;/td
 td bgcolor="#99CCFF" align=center rowspan=2
 ? if ($no_menu_link==Home) {
echo "bHome/b | ";
} else {
echo "a class=menu href='/index.php'Home/a | ";
}

if ($no_menu_link==Catalogue) {
echo "bCatalogue/b | ";
} else {
   echo "a class=menu
href='/pages/catalogue/index.php'Catalogue/a | ";
}

if ($no_menu_link==Information) {
echo "bInformation/b | ";
} else {
echo "a class=menu href='/pages/info/index.php'Information/a |
";
}

if ($no_menu_link==Search) {
echo "bSearch/b | ";
} else {
echo "a class=menu href='/pages/search.php'Search/a | ";
}

if ($no_menu_link==Contact) {
echo "bContact/b | ";
} else {
echo "a class=menu href='/pages/contact.php'Contact/a";
}
?/td
 td bgcolor="#99CCFF" align=right valign=topimg
src="/images/borders/btr.gif" width=20 height=20 alt=""/td
  /tr
  tr
 td bgcolor="#99CCFF" align=right valign=bottomimg
src="/images/borders/bbr.gif" width=20 height=20 alt=""/td
  /tr
/table


ps. the no_menu_link variable is defined on the page calling the
include so that the page does not have a link to itself.



-- 
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] Parse error after end of file

2001-04-09 Thread DRN


Kurth Bemis [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
| At 03:59 PM 4/9/2001, DRN wrote:
| you need to make sure that ALL your curly brackets are closed and
that all
| lines that require semi-colons have them
|
| ~kurth

D'oh, I don't know how I didn't see that, but it had been annoying me
for ages.

Cheers for your help once again, Donald



-- 
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] putting a list of data into 3 columns?

2001-04-09 Thread DRN


Lindsay Adams [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
okay. your solution is not going to scale well, is it. if you have
more than
nine items, you have to rewrite your code.

I (sort of) understand your solution, but I don't see how my solution
is not going to scale well? I am trying to count the number of items,
then list until I get to 1/3 then start a new cell and list until I
get to 2/3, then new cell, then finish table. The reason for doing it
this way is that this will produce a valid table. It will also allow
me to add in another 2 cells to give vertical lines separating the
columns, but I missed this out originally for clarity.


--
Cheers,  Donald  :)
__
As well as learning more,
I learn that there is even more I don't know

http://www.donaldrnoble.f2s.com
¯¯



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




[PHP] putting a list of data into 3 columns?

2001-04-07 Thread DRN

Hi,
I would like to display a list of products from a MySQL database in 3
columns. as shown below:

Product A  Product D  Product G
Product B  Product E  Product H
Product C  Product F

The problem I have is I don't know how many products there will be, so
I can't just print out the first 3, start new column, print out next
three, start new column, print out rest, end table.

I presume I will have to count the number of results, then use this to
wok out how many have to go in the first column etc.

As I have only recently started using PHP / MySQL I am not sure how
this should be done, has anybody done this (or something similar) so
that I could look at the relevant code.

Many thanks for your help, Donald





-- 
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] putting a list of data into 3 columns?

2001-04-07 Thread DRN

Hi,
I would like to display a list of products from a MySQL database in 3
columns. as shown below:

Product A  Product D  Product G
Product B  Product E  Product H
Product C  Product F

The problem I have is I don't know how many products there will be, so
I can't just print out the first 3, start new column, print out next
three, start new column, print out rest, end table.

I presume I will have to count the number of results, then use this to
wok out how many have to go in the first column etc.

As I have only recently started using PHP / MySQL I am not sure how
this should be done, has anybody done this (or something similar) so
that I could look at the relevant code.

Many thanks for your help, Donald





-- 
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] putting a list of data into 3 columns?

2001-04-07 Thread DRN


Lindsay Adams [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
| Assuming your items are in an array
| $items =array() //assume a bunch of items in this array
| For($i = 0; $i (count($items)/3); $i +=1){
| printf("%s\t%s\t%s",$items[$i],$items[$i+3],$items[$i+6]);
| }
|
| Should print 3 columns of tab separated text.
| Note: typed this quickly, untested, but the theory is sound. Might
have to
| twiddle the $i(count... Section.
|
| If you have 8 itesm, as shown and you divide by 3 you get 2.xx
| So, the the loop will print out:
|
| $items[0]   $items[3]   $items[6]
| $items[1]   $items[4]   $items[7]
| $items[2]   $items[5]   $items[8}
| // because $items[8] doesn't exist, it won't print.
| // if it spits out an error there, put a @in front of printf to turn
off
| error reporting.
|
|
| On 4/7/01 11:58 AM, "Jack Dempsey" [EMAIL PROTECTED] wrote:
|
|  You don't need to count...in your loop you can do something like
this:
|  if($current_pos%3==0){//then you're at a multiple of three
|  //code to start new column here
|  }
| 
|  -jack
| 

Neither of these were quite what I was looking for, I was hoping I
could make a table with 3 td's side by side, each having a third of
the list of products (with br between them).
Is this possible? If not I will try to adapt one of these methods.

Cheers for your help, Donald



-- 
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] CodeCharge? is it any good?

2001-03-28 Thread DRN

Hi, I am a newbie in the field oh php and databasing, but I would like
to learn a bit to create a database driven site. I want to have a
database with products, and the html pages for the products and
categories are 'built' automatically from templates.

First of all, am I right in thinking that PHP (and a database) is the
way to do this?

Secondly is CodeCharge [ http://www.codecharge.com ] any good? I was
thinking of trying it, but I want to make sure that it is not a
"FrontPage" type program (generating bad code). I don't want to try to
understand code that is wrong.

Are there any other programs that will create the php code for me?

Any help / pointers / suggestions much appreciated,

Cheers, Donald



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