• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Dynamic database Structures

Guest
Aug 30, 2006 Aug 30, 2006

Copy link to clipboard

Copied

Hi, Im trying to set up a site so the admin user can list the contents of any database using one template, and an argument (code) being passed in the URL string.

So far all is working fine. It gets the structures table ID and field infor from the URL code just fine

except I'm struggling getting the actual DATA stored displaying.

Anyone got any tips?

TOPICS
Advanced techniques

Views

287

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 30, 2006 Aug 30, 2006

Copy link to clipboard

Copied

I've managed to tidy this up a great deal and have fathomed a couple ofd places where I'm stuck.

The

<cfdump label="row content" var="#this_row_content#">
<cfdump label="cell content" var="#this_cell_content#">
are not working

<cfdump label="row content" var="#this_row_content#"> is outputting all rows in the query "table_field_content". whereas it was intended to only contain the single row whose value was set by #request.rowcounter#

<cfdump label="cell content" var="#this_cell_content#"> does the same. In addition when I want to output it I am going to need to refer to the table field names (which are in the query "table_fields"), yet I cannot reference them as the cfloop around the name of the field leaves and extra comma which creates a syntax error.

Any ideas?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 30, 2006 Aug 30, 2006

Copy link to clipboard

Copied

LATEST
cfdump will output the entire content of the variable, be it a simple value or struct.

I would quickly build a database viewer like this:

<cfif isDefined("FORM.submit") and FORM.submit neq ''>
<cfquery name="tb_dump" datasource="#your_datasource#">
SELECT * FROM #FORM.db_tables#
</cfquery>
<cfdump var="#tb_dump#">
<cfelse>
<cfform name="db_dump" format="html" action="">
<cfselect name="db_tables">
<option value="table1">table1</option>
<option value="table2">table2</option>
<option value="table3">table3</option>
<option value="table4">table4</option>
<option value="table5">table5</option>
</cfselect>
<cfinput type="submit" name="submit" value="Do it">
</cfform>
</cfif>

You could dynamically populate the select list from a query also.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation