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




[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 's side by side, each having a third of
the list of products (with  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] 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



Accessible Computers 








  
";
} else {
   echo "";
} ?>
  
 
 Home | ";
} else {
echo "Home | ";
}

if ($no_menu_link==Catalogue) {
echo "Catalogue | ";
} else {
   echo "Catalogue | ";
}

if ($no_menu_link==Information) {
echo "Information | ";
} else {
echo "Information |
";
}

if ($no_menu_link==Search) {
echo "Search | ";
} else {
echo "Search | ";
}

if ($no_menu_link==Contact) {
echo "Contact | ";
} else {
echo "Contact";
}
?>
 
  
  
 
  



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] 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]...
| This is exactly what I sent you.
| You have to realize that you can't print down one column, and then
start a
| new one.
| You have to print across, left to right before you go down.
| You have to modify the print statement to put it into a table, but
that is
| easy:
|

I have been playing about with this problem and I have come up with
the following code. I know it is not right, because it isn't working
:) but I think it is nearly what I want to do. I only want to have 3
cells in the table, with a third of the data in each.

Cheers for your help, Donald

\n\n";
  $r = mysql_fetch_array($result);
  $type_name = $r["type_name"];

  while ( $i < ($num_rows/3) ){
 echo "$type_name[$i] \n"; $i++;
  }
  echo "\n";
  while ($i <= (2*$num_rows/3) ){
 echo "$type_name[$i] \n"; $i++;
  }
  echo "\n";
  while ($i <= $num_rows ){
 echo "$type_name[$i] \n"; $i++;
  }
  echo "\n";

 } else {
 echo " sorry no data found ";
 }
?>


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




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]