[PHP-DB] Generating pages with full stories

2006-11-13 Thread dancemaniac
I've got a website using PHP and MySQL. I would like to make a news preview on the webpage's frontpage with a link to the full story. Is it possible to use one (1) .PHP file to generate full stories, with MySQL involved? I'm just a newcomer in the world of PHP but I am doing my best in reading

Re: [PHP-DB] Generating pages with full stories

2006-11-13 Thread Jeffrey
Yes... But, the experts on this list need more info in order to help you out. 1. Where are the stories going to come from? If you plant to take news stories from other sites and use them on your own site, there are serious legal issues involved. 2. If you want to write the stories yourself,

[PHP-DB] Simple question on auto_increment

2006-11-13 Thread mario
Hello, really a mysql question. Pls. help anyway. Is there a simple, common way to implemt the following: Say I have a table with a id autoincrement field. I wish to insert a record but just ist id value, get back the id value, use it to update the record. Do I need three separate mysql

Re: [PHP-DB] Simple question on auto_increment

2006-11-13 Thread Brad Bonkoski
mario wrote: Hello, really a mysql question. Pls. help anyway. Is there a simple, common way to implemt the following: Say I have a table with a id autoincrement field. I wish to insert a record but just ist id value, get back the id value, use it to update the record. Do I need three

Re: [PHP-DB] Simple question on auto_increment

2006-11-13 Thread mario
WOW! perfect, thanks a lot mario On Mon, 2006-11-13 at 16:16 -0500, Brad Bonkoski wrote: mario wrote: Hello, really a mysql question. Pls. help anyway. Is there a simple, common way to implemt the following: Say I have a table with a id autoincrement field. I wish to insert a

[PHP-DB] MySQL SQL Query Help

2006-11-13 Thread Peter Beckman
I have a table: id fkid foobar 1 1 345yellow 2 1 34 red 3 2 3459 green 4 2 345brown I want to select the largest value of foo for a unique fkid, and return bar, the results ordered by bar. In this case, 345 is the largest value of foo for fkid 1, and

Re: [PHP-DB] MySQL SQL Query Help

2006-11-13 Thread Niel Archer
Hi Try: SELECT fkid, MAX(foo), bar FROM table GROUP BY fkid ORDER BY bar DESC Niel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP-DB] MySQL SQL Query Help

2006-11-13 Thread Miguel Guirao
select max(bar) from mytable where unique fkid order by bar asc as far as I remember!! -Original Message- From: Peter Beckman [mailto:[EMAIL PROTECTED] Sent: Lunes, 13 de Noviembre de 2006 04:59 p.m. To: PHP-DB Mailing List Subject: [PHP-DB] MySQL SQL Query Help I have a table: id

Re: [PHP-DB] MySQL SQL Query Help

2006-11-13 Thread [EMAIL PROTECTED]
Actually, that should not work, it should give you an error. This should work: SELECT `fkid`,max(`foo`) as foo,`bar` FROM `test2` GROUP BY `fkid` ORDER BY `bar` ASC Miguel Guirao wrote: select max(bar) from mytable where unique fkid order by bar asc as far as I remember!!

Re: [PHP-DB] Generating pages with full stories

2006-11-13 Thread dancemaniac
I'd answer question number 3. Well, it is just about an update section that the administrators will input on the database for updates and event for a company, saying the website has an updated page or simply putting an event for the public to know. Right now, I want to know how get a URL like

Re: [PHP-DB] Generating pages with full stories

2006-11-13 Thread J R
Here's how you should do this (IMHO): On you front page make a sql query say you want to display the latest 3 events. Your query probably will look like this: select event_table_id, title from event_table order by date_created desc limit 3; then from the result make a while or for loop (for

Re: [PHP-DB] MySQL SQL Query Help

2006-11-13 Thread Peter Beckman
On Mon, 13 Nov 2006, [EMAIL PROTECTED] wrote: Actually, that should not work, it should give you an error. This should work: SELECT `fkid`,max(`foo`) as foo,`bar` FROM `test2` GROUP BY `fkid` ORDER BY `bar` ASC Yes, but if the data is in a different order that fails and doesn't maintain

Re: [PHP-DB] MySQL SQL Query Help

2006-11-13 Thread Chris
Peter Beckman wrote: On Mon, 13 Nov 2006, [EMAIL PROTECTED] wrote: Actually, that should not work, it should give you an error. This should work: SELECT `fkid`,max(`foo`) as foo,`bar` FROM `test2` GROUP BY `fkid` ORDER BY `bar` ASC Yes, but if the data is in a different order that fails