Jump to content

Merging database fields object oriented style!


gijew

Recommended Posts

This is a weird one and I'm just looking for theories here but what I have and what I'm trying to do is this:

 

What I have:

A class that pulls data via cron job and emails the contents to a contact list.

 

What I'm trying to do:

Is find a way to start merging fields together in an object oriented method

 

[EDIT: I just accidentally hit return so I'm still filling out the rest of this post =)]

 

What I would like to do is concatenate fields like first_name & last_name together (neat concept hehe). The class is too long to post (a whopping 103 lines) BUT here is how I use it (so far):

 

<?php
$cron = new cronjob();
$cron->set_table('form_contact');
// The new version I'm working on uses multi-dimensional arrays to set the data types
// THIS version uses 2 sets of arrays to set which field to pull and the data type to ->
//   associate it with (formatting)
$cron->set_table_rows(
array(
	'first_name',
	'last_name',
	'email',
	'message',
	'date_submitted'
),
array(
	'text',
	'text',
	'email',
	'html_text',
	'datetime'
)
);
$cron->set_criteria('WHERE sent = 0');
$cron->set_sort('date_submitted', 'desc');
// this part is just for testing to see what's going to be pulled from the db
echo $cron->give_it_to_me();
?>

 

So to reiterate what I'm going for is a theory and/or suggestion on how one might achieve such a thing.

 

Thank you

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.