You are here: Re: Query on subrecords « PHP SQL « IT news, forums, messages
Re: Query on subrecords

Posted by NC on 10/11/89 11:43

sicapitan@gmail.com wrote:
>
> I have two tables:
>
> Table "record":
> id, record_id, data1, data2
>
> Table "subrecord":
> id, record_id, name, value

How, if at all, are they cross-indexed?

> In the subrecord the name contains the header title, and the value the
> value. I need to:
>
> 1. Search the database
>
> (`name` = 'firstname' AND `value` LIKE %'somevalue%') AND
> (`name` = 'emailaddress') AND `value` LIKE '%somevalue%')

This is syntactically incorrect; the number of opening parentheses does
not match the number of closing parentheses. So I really have no idea
what you are trying to do.

Also, am I correct thinking that 'firstname', 'emailaddress', and
'%somevalue%' are all user inputs?

Right now, there are too many blanks to give you a precise answer; the
only thing I can tell you is that you should look into SQL joins. You
should join the two tables on the field they have in common.

Cheers,
NC

 

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

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