Hi all,
I have a PHP script (wysiwygPro) that has the following construct in its code:
$editor->set_inserts(array(
'name1' => 'html_code1',
'name2' => 'html_code2',
'name3' => 'html_code3',
));
Now I don't want these code snippets to be hard-coded in this way. I want them to be dynamically populated at run time.
So I created a MySQL table with two columns to store the data. I can retrieve the data successfully:
$db = @mysql_pconnect (DB_ADDRESS, '', '') or die ("Can't connect to the database server...");
mysql_select_db (DB_NAME) or die ("Can't connect to the database...");
$result = mysql_query ("SELECT * FROM editor_site_objects");
while ($row = mysql_fetch_object ($result))
{
...
}
mysql_free_result ($result);
What I want to do is populate $editor->set_inserts with the data in the DB. But I can't figure out the syntax.
Within my "while" loop I will read each name/code pair from the database with something like:
xxxxx = ($row->object_name, $row->object_code);
What should xxxxx contain? How do I get this data into the array. I have look at "push" but that doesn't work since I need to get the "object_name" and "object_code" in the array.
Any help, suggestions, pointers, etc would be appreciated.