You are here: Re: problem with getting info from 2 tables in PHP / MySQL « PHP Programming Language « IT news, forums, messages
Re: problem with getting info from 2 tables in PHP / MySQL

Posted by JDS on 08/03/05 03:15

On Tue, 02 Aug 2005 23:30:52 +0000, Neal wrote:

> will print out. But, when I put WHERE school = '$school'"; .... nothing.
> Even though the echo("$school'); line prints out 'Washington HS' (if I
> entered the username and password associated with this school from the
> login table).

I'm just guessing. Not enough time at the moment to get too in-depth.

Does the 'school' column EXACTLY match the value "Washington HS"? If not,
you will get no matches.

It is a Really Bad Idea(TM) to use a string value column to do joins on,
expecially if the string values were all entered by hand. It is much much
better to use an Integer value.

How do you get an integer value for a string? In a RDBMS, you put the
strings in *another* table, in this case, a table called "schools" or some
such.

Then you will do a multi-table join.

I realize that putting all the schools in a third table sounds like extra
work and extra complication, but it will make for a more flexible,
scalable, and programmable database in the long run.

Google a bit on "database normalization"

later...

--
JDS | jeffrey@go.away.com
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

 

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

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