[Pro] Display SQL data on page

Is there a way to display data in an SQL table in a page in Freeway?

I have a member list that I would like to show on a page and have no idea how to do this.

Thanks


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Can you post the schema of your data table? If you have phpMyAdmin on
your server, you should be able to do this from the Export tab. All we
need to see is the structure, not the content.

There are lots of different ways to do this, but the simplest I know
of would be to use a text editor to create a connection script using
PHP or another dynamic language. If you use a code library like
MyActiveRecord, this could be down to a few lines of code:

<?php
define('MYACTIVERECORD_CONNECTION_STR',
	'mysql://user:pass@localhost/dbname');
require_once('MyActiveRecord.php');
class Members extends MyActiveRecord { } //this must be the same as  
your table name
$list = '<ul>';
$members = MyActiveRecord::FindAll('Members',null,'last_name DESC');
foreach($members as $member){
	$list .= '<li>' . $member->first_name . ' ' . $member->last_name . '</ 
li>';
}
$list .= '</ul'>;
print $list;
?>

More about MyActiveRecord here: http://github.com/walterdavis/myactiverecord

You would put the previous block of code into a Markup Item on the
page where you expect the list to appear. Make sure to replace the
placeholder text with the real username, password, and database name.
Your table must have a primary key which is an auto-incrementing
number. By default, this is named ‘id’, but if yours is called
something else, you must set another preference (right below the
connection string) to signal this mapping:

define('MYACTIVERECORD_PRIMARY_KEY','MemberID');

Taken all together, this little bit of code will dump the entire
members list onto your page wherever you place your Markup Item on the
page.

Walter

On Sep 14, 2010, at 5:41 AM, Kevin Cheesman wrote:

Is there a way to display data in an SQL table in a page in Freeway?

I have a member list that I would like to show on a page and have no
idea how to do this.

Thanks


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks for the reply. I have not started this project yet, so I’ll get back to you later.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi,
I have some examples of using data taken from a MySQL database here:
http://www.easibase.com/freeway/phpmysql.php

HTH

On Sep 14, 2010, at 11:41 AM, Kevin Cheesman wrote:

Is there a way to display data in an SQL table in a page in Freeway?

I have a member list that I would like to show on a page and have no
idea how to do this.

Thanks


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options