You are here: Re: Query Question « PHP Programming Language « IT news, forums, messages
Re: Query Question

Posted by Chris on 05/28/05 03:35

What wonderful code - talk about slick... :-) don't quite understand
what the "from table where 1 = 1" is doing (the business with the '1'
but it sure works great - thanks so much...

A second question since this bit of magic happened so fast and if you
have a moment... On a database with name, month, year and so on is
days (as in days taken off). The query runs very nicely but I'd love
to have a total at the bottom of the query page.

name, date, days, notes pretty much comprise it with 1, 2, 3, and so
on being entered into a mysql database varchar field for the numbers.

Is adding the totalizer relatively easy on a query? I have what I
think is a pretty good book on PHP & mysql but haven't been able to
find any answer there.

thanks,
Chris (cover)
just changed my newserver

On Fri, 27 May 2005 11:56:16 -0400, "Joseph Melnick"
<jmelnick@jphp.com> wrote:

>Hello Cover,
>
>$query = "select * from table where 1 = 1 ";
>if($name != "") $query .= "and name = '".$name."'";
>if($month != "") $query .= "and month = '".$month."'";
>if($year != "") $query .= "and year = '".$year."'";
>
>Joseph Melnick
>JM Web Consultants
>http://www.jphp.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация