";

}



A little more time with this problem rolling around in my head has produced some more ideas on how I can make this process easier in Dataface.. My previous addition involved modifications at the core of the framework. I may be able to rig something up that is more cosmetic so that only the ResultList class will be affected and you would be able to get a list view with arbitrary SQL queries.

I don't have time right now.. but I'll get something together for the next release..

Best regards

Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm
Top

Postby shannah » Tue Aug 29, 2006 2:20 pm

Hi Neil,

One way to do this is to just use "if" and "continue" statements in your loops as follows:

Code: Select all
foreach ($row as $key=>$val){
        if ( $key == 'LocationID' ) continue;
        if ( $key == 'AnotherColumnIDontWant' ) continue;


        echo ...       

    }


and for the header portion:
Code: Select all
for ($i=0; $i<$num_columns; $i++){
    if ( mysql_field_name($i) == 'LocationID' ) continue;
    if ( mysql_field_name($i) == 'AnotherFieldIDontWant' ) continue;
    ...

}



A little more time with this problem rolling around in my head has produced some more ideas on how I can make this process easier in Dataface.. My previous addition involved modifications at the core of the framework. I may be able to rig something up that is more cosmetic so that only the ResultList class will be affected and you would be able to get a list view with arbitrary SQL queries.

I don't have time right now.. but I'll get something together for the next release..

Best regards

Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby njw » Tue Aug 29, 2006 3:55 pm

I hadn't thought of the first workaround - That will be fine.

Thanks again for all your help.

Neil
njw
 
Posts: 280
Joined: Wed Dec 31, 1969 5:00 pm

Previous

Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 3 guests

cron

Sub set totals

A place for users and developers of the Xataface to discuss and receive support.

Postby njw » Tue Aug 29, 2006 10:24 am

Another stupid question, but how do I extract the header and detail information from the Dataface record?

I have tried copying the code from Dataface_Record_Grid, but that appears to use different arrays. Once I know what the array is called, I reckon I might get something working other than error messages!

Many thanks

Neil
njw
 
Posts: 280
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Tue Aug 29, 2006 10:41 am

Hi Neil,

Definitely not a stupid question.

You can obtain the column names from a query using mysql_field_name(). Examples at http://ca3.php.net/manual/en/function.mysql-field-name.php#68431

e.g.:
Code: Select all
$res = df_query(...);
$num_columns = mysql_num_fields($res);
echo "";
echo "";
for ($i=0; $i<$num_columns; $i++){
    echo "";
}
echo "


For each record row, you would do a similar thing:

Code: Select all
echo "
";
while ( $row = mysql_fetch_assoc($res) ){
    $record = new Dataface_Record('Locations', $row);
    $url = $record->getURL(); // the link to the record for this row
    echo "
";
    foreach ($row as $key=>$val){
        echo "
";
    }
    echo "
";
   
}
echo "
";
echo "
".mysql_field_name($i)."
$val
";
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby njw » Tue Aug 29, 2006 1:35 pm

Many thanks Syeve. I have this working now, but (there's usually a but isn't there) I now can't stop the Locations Primary key displaying. Is there a really easy way of stopping this? I tried removing it from the SELECT query, but that then stops the link working ...

It would be a great deal easier if I could get my ISP to upgrade MySQL, but they have no plans to do so due to issues over potential incompatibilities. I could understand that for 4 to 5, but from 4.1 to 4.2? C'est la vie.

Neil
njw
 
Posts: 280
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Tue Aug 29, 2006 2:19 pm

Hi Neil,

One way to do this is to just use "if" and "continue" statements in your loops as follows:

Code: Select all
foreach ($row as $key=>$val){
        if ( $key == 'LocationID' ) continue;
        if ( $key == 'AnotherColumnIDontWant' ) continue;


        echo ...       

    }


and for the header portion:
Code: Select all
for ($i=0; $i<$num_columns; $i++){
    if ( mysql_field_name($i) == 'LocationID' ) continue;
    if ( mysql_field_name($i) == 'AnotherFieldIDontWant' ) continue;
    echo "
".mysql_field_name($i)."
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved