You are here: Re: SQL Query and Display Problem « PHP SQL « IT news, forums, messages
Re: SQL Query and Display Problem

Posted by J.O. Aho on 12/31/06 09:33

PHPBABY3 wrote:
> Hi,
>
> 1. I have two SQL tables. I will call them employees and departments:
>
> EMP: LAST_NAME, FIRST_NAME, DEPTNM
> DEPT: NUM, NAME
>
> Input: text string FIND
>
> Output: the LAST_NAME, FIRST_NAME and department name NAME (link DEPTNM
> in EMP to NUM in DEPT) of all employees whose LAST_NAME or whose
> FIRST_NAME contains the string FIND in a case-insensitive manner.
> Example: Employees with LAST_NAME = "Sandleburg" are listed when
> input FIND = "BURG".

$query="SELECT * FROM EMP WHERE (LAST_NAME LIKE '%{$FIND}%') OR (FIRST_NAME
LIKE '%{$FIND}%')";

To convert the DEPTNM to NAME from the DEPT table, see
http://dev.mysql.com/doc/refman/5.0/en/join.html


> 2. What if I have to add another field to the display, department
> budget, from table:
>
> ACCOUNTS: DEPTNM, BUDGET

See: http://dev.mysql.com/doc/refman/5.0/en/join.html


> 3. Display the results 10 at a time.

Add to the query, where $startpoint= the rownumber you want to start at, minus
one (row 1 = 0, row 10 = 9, row 11 = 10).

$query.=" LIMIT {$startpoint},10";


> 4. Position the results on the page using CSS.

Go and ask a HTML newsgroup.


--

//Aho

 

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

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