I want to be able to take data from a database which items which are either text or images.
If text then the text is placed into the database complete with white spaces.
If image then an image ID is stored which links to an image table which contains the filepath. (if its easier this can be changed to have the filepath stored in the main table).
I want to the display the items based on a critera of which page they are on and then show that Page in a simple HTML form.
On any given page there could be several paragraphs of text in an item followed by another item with more text followed by an item with an image. There can be any combination of text and images with as many as the user has created - practically about 3-8 is likely - if needed this can be capped.
Currently I use a method in PHP to run a query on the database which just returns the text content (havent tried to do the image as have no idea how to integrate it, but do have code to show the image but dont know how to switch content or return different types so it displays).
This method returns the text but doesnt remember line breaks - in the database its stored with line breaks.
So just recap I just want to be able to display text and images from the database in a format similar to this:
Attached is the code I have for query so far:
Please help and its quite urgent as well. Happy to give any more information or provide some links etc for anyone that needs it. Will be around pretty constantly so can provide a quick answer to any question however small/large.
public function BuildPreviewPagesList()
$result = $this->mysqlConnection->query('SELECT * FROM chunks INNER JOIN pages ON chunks.id = pages.chunkid WHERE username="' . $Susername . '" AND pages.pageid="' . $currentPage . '" ' . 'ORDER BY pages.orderno ASC');
while ($row = $result->fetch_assoc())
$myList .= '<li id="' . ($row['id']) . '">' . ($row['content']) . '</li>';
$myPagesList = new PagesList();
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
pageid INT UNSIGNED NOT NULL,
orderno INT UNSIGNED NOT NULL default '0',
username VARCHAR(11) NOT NULL,
title VARCHAR(43) NOT NULL default '',
content VARCHAR(3000) default '',
isimage TINYINT(1) NOT NULL default 0,
imageid INT UNSIGNED,
PRIMARY KEY (id),
create table images (
imageid INT UNSIGNED NOT NULL AUTO_INCREMENT,
filepath VARCHAR(500) NOT NULL default '',