Populate content from CF DB

Riceman 21 Feb, 2012
Is there a way to add some information from a column in a CF database row to a php page?

For instance,

My form has multiple fields one of them being, "Company Name", so "company_name" is a column in the CFDB. I would like to have a page that pulls the "company_name" form a particular row in the DB, and populates a webpage with that content.

Is this possible?
GreyHead 21 Feb, 2012
Hi Riceman,

Yes you can do this, ChronoForms don't have to include form inputs they can display any HTML. Use the DB Record Load action in CFv4 and show it however you like.

Bob
Riceman 21 Feb, 2012
Thanks GreyHead,

I am on CF v3.2, and am new to php, I am guessing my static html page would be a php page. Is there a tutorial on this you could point me to? Is this something I could hire you to create for me? The static html page is already created.
GreyHead 22 Feb, 2012
Hi Riceman,

If you aren't using Joomla! then everything gets a lot more complicated. Is there some reason for that?

Bob
Riceman 22 Feb, 2012
I am using Joomla, but not for the page that we are creating with the info submitted. These are single page mobile websites.

I found tutorials at lynda.com, and have gotten pretty far.

[list=]Connected to DB
Connected to DB table
Disconnect from DB[/list]
My only issue, so far, is inserting a col_value into my html. One example is all i need, I can take it from there.

If you have a quick answer that would be great, but if this is not the place for this, and I suspect this question is beyond the scope of the forum, than I understand. I can figure it out on my own in time.

I would of-course be happy to invest in your beer supply. 😀
GreyHead 22 Feb, 2012
Hi Riceman,

If you can connect to the Db Table and get a record back as an array or an object $d then you can display it with
<?php echo $d['col_name']; ?>
or
<?php echo $d->col_name; ?>


Bob
Riceman 23 Feb, 2012
Well, I figured it out on my own. Learning a bit of PHP along the way. I did it a bit differntly, something like this:


<?php
	$query = "SELECT company FROM jos_chronoforms_PropertySubmissionMobile WHERE cf_id = 1";
	list($company) = mysql_fetch_row(mysql_query($query));
	?>
	<title><?php echo $company; ?></title>
This topic is locked and no more replies can be posted.