Re: [PHP-DB] Select news based on dates

2004-05-17 Thread Daniel Clark
ORDER BY date, text ?

> Hi!
> You can use "order by date" and such method:
> 
> $result = mysql_query(blablabla);
> $date = "foo";
> while($news = mysql_fetch_array($result)){
> if ($date==$news["date"]){
> echo "new date";
> }
> echo $news["text"];
> $date = $news["date"];
> }
>
>
> Monday, May 17, 2004, 3:50:04 PM, T. wrote:
>
> THG> Hello,
>
> THG> I would like to display my news like this:
>
> THG> *10.04.2004.*
> THG> - news 1
> THG> - news 2
> THG> - news 3
> THG> *14.04.2004.*
> THG> - news 4
> THG> *15.04.2004.*
> THG> - news 5
> THG> ...

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



Re: [PHP-DB] Extending Pear DB class. Is it possible?

2004-05-17 Thread Robert Twitty
It appears that you want to extend DB_coomon not DB. The reason is because

$dbh = MyDB::connect( $dsn );

returns an instance of the DB_common class. However, DB_common is the base
class for writing a PEAR DB driver class.  And, what is really returned by
DB::connect() is an instance of the driver class that extends DB_comon.
Creating a MyDB_Common will not work either, unless you edit all the DB
database driver class files to extend MyDB_common instead of DB_Common. If
you are doing this for a specific database, then what you should is extend
the corresponding driver class, i.e, mymysql.php.  You would then use
'mymysql' instead of 'mysql' as the driver name.

What functionallity do you wish to add to DB?

-- bob

On Mon, 17 May 2004, Ross Honniball wrote:

> Hi all,
>
> I'd like to extend the standard Pear DB class, but there is something a bit
> curly about it.
>
> PHP lets me create a class like:
>
>class mydb extends DB {  functions etc. }
>
> however the new class mydb will not include all the functions. I think it
> is only including all the functions defined in the 'common.php' file.
>
> The 'mydb' class above won't, for example, have the 'query' function, even
> after successfully connecting to a database.
>
> Anyone know how to go about extending the Pear DB class?
> .
> . Ross Honniball. JCU Bookshop Cairns, Qld, Australia.
> .
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP-DB] Select news based on dates

2004-05-17 Thread Mikhail U. Petrov
Hi!
You can use "order by date" and such method:

$result = mysql_query(blablabla);
$date = "foo";
while($news = mysql_fetch_array($result)){
if ($date==$news["date"]){
echo "new date";
}
echo $news["text"];
$date = $news["date"];
}


Monday, May 17, 2004, 3:50:04 PM, T. wrote:

THG> Hello,

THG> I would like to display my news like this:

THG> *10.04.2004.*
THG> - news 1
THG> - news 2
THG> - news 3
THG> *14.04.2004.*
THG> - news 4
THG> *15.04.2004.*
THG> - news 5
THG> ...

THG> I'm thinking of some while loop but I'm not sure that it will work nor I 
THG> know how to create that query.

THG> TNX



-- 
Best regards,
Mikhail U. Petrov
mailto:[EMAIL PROTECTED]

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



Re: [PHP-DB] Select news based on dates

2004-05-17 Thread John W. Holmes
From: "T. H. Grejc" <[EMAIL PROTECTED]>

> I would like to display my news like this:
> 
> *10.04.2004.*
> - news 1
> - news 2
> - news 3
> *14.04.2004.*
> - news 4
> *15.04.2004.*
> - news 5
> ...
> 
> I'm thinking of some while loop but I'm not sure that it will work nor I 
> know how to create that query.

SELECT your data with the date and only display the date if it changes.

$query = "SELECT * FROM table ORDER BY datecolumn ASC";
$result = mysql_query($query) or die(mysql_error());
$prevdate = '';
while($row = mysql_fetch_assoc($result))
{
  if($row['datecolumn'] != $prevdate)
  {
echo '*' . $row['datecolumn'] . '*';
$prevdate = $row['datecolumn']; 
  }
  echo '- ' . $row['news'] . '';
}

---John Holmes...

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



RE: [PHP-DB] Select news based on dates

2004-05-17 Thread Angelo Zanetti
use the date functions in your mysql query, read the mysql manual for it.
you can also just select * from a table and group it by date so all news
articles on the same date will be displayed together. Perhaps you shouls
also read up about groups in SQl.

hope this helps
angelo

-Original Message-
From: T. H. Grejc [mailto:[EMAIL PROTECTED]
Sent: Monday, May 17, 2004 1:50 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Select news based on dates


Hello,

I would like to display my news like this:

*10.04.2004.*
- news 1
- news 2
- news 3
*14.04.2004.*
- news 4
*15.04.2004.*
- news 5
..

I'm thinking of some while loop but I'm not sure that it will work nor I
know how to create that query.

TNX

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


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



[PHP-DB] Select news based on dates

2004-05-17 Thread T. H. Grejc
Hello,
I would like to display my news like this:
*10.04.2004.*
- news 1
- news 2
- news 3
*14.04.2004.*
- news 4
*15.04.2004.*
- news 5
...
I'm thinking of some while loop but I'm not sure that it will work nor I 
know how to create that query.

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


RE: [PHP-DB] Wrong table name - can it be fixed?

2004-05-17 Thread Peter Lovatt
Hi

using phpMyAdmin enter the following into a sql box

ALTER TABLE `16-05` RENAME `newname` ;


HTH

Peter

> -Original Message-
> From: Viorel Dragomir [mailto:[EMAIL PROTECTED]
> Sent: 17 May 2004 09:54
> To: Martin E. Koss; [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Wrong table name - can it be fixed?
>
>
> Use "tablename" from mysql command prompt.
> Try to use it from phpmyadmin, but I don't know if it works..
> And don't post emails with high priority anymore.
>
>   - Original Message -
>   From: Martin E. Koss
>   To: [EMAIL PROTECTED]
>   Sent: Monday, May 17, 2004 11:48
>   Subject: [PHP-DB] Wrong table name - can it be fixed?
>
>
>   I've made a big boo boo when exporting from MS Access to MySql database.
>   The table name was '16-05' which obviously is not a good name to have in
>   MySql.
>   I'm using PhpMyAdmin as I'm not very experienced with sorting out the
>   databases any other way. Problem is that I can't access the properties
>   of the table in order to rename it, whatever I try to do I get an error
>   (which is obviously due to the type of name the table has).
>
>   Is there any way I can fix this without getting too complicated?
>
>   Cheers.
>
>   Martin
>
>   ---
>   Outgoing mail is certified Virus Free.
>   Checked by AVG anti-virus system (http://www.grisoft.com).
>   Version: 6.0.684 / Virus Database: 446 - Release Date: 13/05/2004
>
>
>   --
>   PHP Database Mailing List (http://www.php.net/)
>   To unsubscribe, visit: http://www.php.net/unsub.php
>

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



Re: [PHP-DB] Wrong table name - can it be fixed?

2004-05-17 Thread Ignatius Reilly
Hav you tried enclosing the table name with backticks:

SELECT ...
FROM `16-05`
...

Ignatius
_
- Original Message - 
From: "Martin E. Koss" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 17, 2004 10:48 AM
Subject: [PHP-DB] Wrong table name - can it be fixed?


> I've made a big boo boo when exporting from MS Access to MySql database.
> The table name was '16-05' which obviously is not a good name to have in
> MySql.
> I'm using PhpMyAdmin as I'm not very experienced with sorting out the
> databases any other way. Problem is that I can't access the properties
> of the table in order to rename it, whatever I try to do I get an error
> (which is obviously due to the type of name the table has).
>  
> Is there any way I can fix this without getting too complicated?
>  
> Cheers.
>  
> Martin
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.684 / Virus Database: 446 - Release Date: 13/05/2004
>  
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP-DB] Wrong table name - can it be fixed?

2004-05-17 Thread Viorel Dragomir
Use "tablename" from mysql command prompt.
Try to use it from phpmyadmin, but I don't know if it works..
And don't post emails with high priority anymore.

  - Original Message - 
  From: Martin E. Koss 
  To: [EMAIL PROTECTED] 
  Sent: Monday, May 17, 2004 11:48
  Subject: [PHP-DB] Wrong table name - can it be fixed?


  I've made a big boo boo when exporting from MS Access to MySql database.
  The table name was '16-05' which obviously is not a good name to have in
  MySql.
  I'm using PhpMyAdmin as I'm not very experienced with sorting out the
  databases any other way. Problem is that I can't access the properties
  of the table in order to rename it, whatever I try to do I get an error
  (which is obviously due to the type of name the table has).
   
  Is there any way I can fix this without getting too complicated?
   
  Cheers.
   
  Martin

  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.684 / Virus Database: 446 - Release Date: 13/05/2004
   

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


[PHP-DB] Wrong table name - can it be fixed?

2004-05-17 Thread Martin E. Koss
I've made a big boo boo when exporting from MS Access to MySql database.
The table name was '16-05' which obviously is not a good name to have in
MySql.
I'm using PhpMyAdmin as I'm not very experienced with sorting out the
databases any other way. Problem is that I can't access the properties
of the table in order to rename it, whatever I try to do I get an error
(which is obviously due to the type of name the table has).
 
Is there any way I can fix this without getting too complicated?
 
Cheers.
 
Martin

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.684 / Virus Database: 446 - Release Date: 13/05/2004
 

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