You are here: Re: PHP, MySQL and snippets of info ... « PHP Programming Language « IT news, forums, messages
Re: PHP, MySQL and snippets of info ...

Posted by Malcolm Dew-Jones on 09/20/05 23:36

elyob (newsprofile@gmail.com) wrote:
: Hi,

: I'm looking at storing snippets of details in MySQL about what credit cards
: a business excepts. Rather than have a whole column for Visa, another for
: Amex etc ... I am looking at having a column called payment types and
: inserting multiple codes ... e.g. ViAmBcCa

: Is this a good way of doing things?


No. The "correct" way would be a table that lists businesses and the
cards they accept.

create table business_accepts_cards
(
business_id
card_id
)

Other methods might occasionally be best, but I can't think of a good
example off hand.

E.g. to make a form to accept payment, you'll end up with something like

echo <select name = customer-card-type>

$sql = select card_id from business_accepts_cards
where business_id = $this_business_id

while ($row = fetch row)
{
echo <option value= $row[card_id]> $row[card_id] </option>
}
echo </select>

I.e. the code will almost always be straight forward.


$0.10

--

This programmer available for rent.

 

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

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