I am feeling stupid, I have the following <cfqu...
# cfml-beginners
j
I am feeling stupid, I have the following <cfquery> in my page, but it is showing up blank. I don't think that there is anything wrong here, or at least I am not seeing it. Why would the page be blank, instead of showing the table of users in the database?
Copy code
<cfquery name = "members" datasource = "cfhawaiiDBmain">         SELECT user_id,first_name,last_name, joining_date
    FROM users
    ORDER BY user_id
</cfquery>

<table>
    <cfoutput query="members">
        <tr>
            <td>#members.first_name#</td>
            <td>#members.last_name#</td>
            <td>#members.date#</td>
        </tr>
    </cfoutput>
</table>
b
could be a silent error you're not seeing. i see you have joining_date in the sql but members.date in the cfm.
👍 1
j
thanks, I didn't see that. I made the change to
<td>#members.joining_date#</td>
but the page is still blank. Thanks so much for your help.
b
try putting a
<cfdump var="#members#">
to make sure you have records.
👍 1
and/or view source to see if the <table></table> tag is there and no TR's
j
good idea about te cfdump, I will try this. I know there is one record in the database. The view source is completely blank.
I fix it, the problem was I had all zeros in the database in the joining_date. Thanks so much for your help @blusol
👍 1
a
I don't quite understand why having a 0-date in the DB would cause no error / no output..? Did you check the logs to see if there was anything being logged, even if not to screen?
Aside: even if yer not using a framework (you really ought to be), please still be mindful of MVC and don't mix model logic / display logic in the same piece of code.
e
not that it matters, but your datasource should be wrapped in pounds for cross-compatibility. second unless you only want the very first record to dump from your database, that should be in a cfloop, such as<cfloop query = "members"><td>#members.firstname#</td> </cfloop></tr></table>