You are here: Check if any items in an array (php) is in a table (mysql). « PHP Programming Language « IT news, forums, messages
Check if any items in an array (php) is in a table (mysql).

Posted by rjames.clarke on 04/17/06 17:59

I want to check if any of the items in a PHP array exist in a MySQL
table.
What is the best way to do this with making repeated calls to the
database for each item?

Actual application is:
I have an array (in PHP) of serial numbers of units about to be
shipped.
I want to check the ship record (a table in a MySQL database) to check
if that serial number has been used before.
According to our quality policy we never reuse serial numbers, serial
numbers are unique. So prior to printing the packing slip I want to
warn the shipping guy/gal a serial number may be incorrect.

I could brute force it and increment through the "to be shipped array"
and check each item against the table. But that is, as I said brute
force, and I am having to be concerned with system speed lately.

Thanks
Bob

 

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

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