Reply to Re: Trouble passing mysql table name to php function and using it!

Your name:

Reply:


Posted by Michael Fesser on 02/27/07 20:46

..oO(kennthompson@gmail.com)

>On Feb 27, 10:27 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>>
>> What happens if you do the following:
>>
>> function fms_get_info($tableName)
>> {
>> $sql = "select * from $tableName";
>> [...]
>
>No. That's exactly the way I was trying to do it.

Then it would work, assuming that $tableName contains a proper table
name.

>MySQL doesn't accept
>a table name passed into a function this way.

It doesn't matter whether the table name is hard-wired or stored in a
variable. The final query string as seen by MySQL will be the same.

>There must be some
>hidden mysql code that I'm unaware of.

Nope. Just make use of the error reporting features that PHP/MySQL
offer.

Micha

[Back to original 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

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