Re: Passing mysql table names to php functions?
- From: "J.O. Aho" <user@xxxxxxxxxxx>
- Date: Tue, 27 Feb 2007 17:56:43 +0100
kennthompson@xxxxxxxxx wrote:
The name passes -- the echo test works; it just won't work as a mysql
table. The variable is getting there, but mysql for some reason does
not recognize it. I've read something about prepare and execute in
mysql, but not sure this is the answer to my problem.
If your tables has other characters than a-z,A-Z,0-9 and - and _ then
you should put `` around the variable
$result = mysql_query("select * from `{$tableName}`");
I think you should use a while-loop instead of the for-loop you are using
while($row=mysql_fetch_array($result)) {
/* do something */
}
--
//Aho
.
- Follow-Ups:
- Re: Passing mysql table names to php functions?
- From: kennthompson
- Re: Passing mysql table names to php functions?
- References:
- Passing mysql table names to php functions?
- From: kennthompson
- Re: Passing mysql table names to php functions?
- From: Jose da Silva
- Re: Passing mysql table names to php functions?
- From: kennthompson
- Passing mysql table names to php functions?
- Prev by Date: Re: File extensions
- Next by Date: Re: Can I get the form name from $_POST?
- Previous by thread: Re: Passing mysql table names to php functions?
- Next by thread: Re: Passing mysql table names to php functions?
- Index(es):
Relevant Pages
|