Jump to content

Archived

This topic is now archived and is closed to further replies.

Balmung-San

Determining Field Names?

Recommended Posts

Alright, I'm trying to write a program that requires me to have many tables, however the tables will have varying field names and I'd like a way to dynamically find out the table names. Any way I could do this?

Share this post


Link to post
Share on other sites
I've never seen a problem that requires me to add tables dynamically, and I've seen a lot of problems. If you post some more details, we might be able to help you design something a little more stable.

However, you can always use SHOW commands to get whatever you need. SHOW DATABASES, SHOW TABLES, SHOW COLUMNS, etc.

Share this post


Link to post
Share on other sites
I'm creating a shop system that will have different field names for each user. Each user will have a table that is equal to their username.

Could I do this?:

[code]
//connect and select_db
$sql = mysql_query("DESCRIBE ".$username);
$tables = mysql_fetch_array($sql);
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.