Selecting records in a MySQL database where id != 0 - php

I'm having trouble with my site.
I have a photographs table with id's. THis table is populated when a user uploads a file to the server, which is fine. I also have a forum where images can be posted, and the images are sent to the same photograph table. On the homepage there is a section where one of the photographs from this table shows up with Pagination links below it.
Now when someone posts to the forum and they do not include an image it breaks. That thread won't show up because it's looking for the photo_id of 0, which didn't exist. So I uploaded a dummy image, changed the id value to zero and tried
$sql = "SELECT * FROM photographs HAVING id != 0 ";
$sql .= "LIMIT {$per_page} ";
$sql .= "OFFSET {$pagination->offset()}";
Which worked, the image no longer shows up, but the pagination still thinks that there is a record there. It shows a link for that image and when a user clicks on it it breaks and removes a bunch of other links and it's a mess.
Is it possible to Select everything from the database but not the 0 record, or maybe remove the link from the pagination links? Here is the code:
//1. the current page number ($current_page)
$page = !empty($_GET['page']) ? (int)$_GET['page'] : 1;
//2. records per page ($per_page)
$per_page = 1;
//3. total record count ($total_count)
$total_count = Photograph::count_all();
//Find all photos
//use Pagination instead
//$photos= Photograph::find_all();
$pagination = new Pagination($page, $per_page, $total_count);
//Instead of finding all records, just find the records
//for this page
$sql = "SELECT * FROM photographs HAVING id != 0 ";
$sql .= "LIMIT {$per_page} ";
$sql .= "OFFSET {$pagination->offset()}";
$photos = Photograph::find_by_sql($sql);
//Need to add ?page=$page to all links we want to
//maintain the current page(or store $page in $session)
?>
<div id="right">
<?php
foreach($photos as $photo):
?>
<h3 style="margin: 0;"></h3>
<div style="padding: 5px;">
<img src="<?php echo $photo->image_path(); ?>" width="200" alt="Photo Share Photo" />
<p align="center"><?php echo $photo->caption; ?></p>
</div>
<?php }
endforeach;
?>
<div id="pagination" style="clear: both;" align="center">
<?php
if($pagination->total_pages() > 1) {
if($pagination->has_previous_page()) {
echo "<a href=\"index.php?page=";
echo $pagination->previous_page();
echo "\">« Previous</a> ";
}
for($i=1; $i <= $pagination->total_pages(); $i++) {
if($i == $page) {
echo " <span class=\"selected\">{$i}</span> ";
} else {
echo " {$i} ";
}
}
if($pagination->has_next_page()) {
echo " <a href=\"index.php?page=";
echo $pagination->next_page();
echo "\">Next »</a> ";
}
}
?><br />
<div align="center">
Upload a new photograph
</div>
[EDIT]
Pagination code.
class Pagination {
public $current_page;
public $per_page;
public $total_count;
public function __construct($page=1, $per_page=20, $total_count=0){
$this->current_page = (int)$page;
$this->per_page = (int)$per_page;
$this->total_count = (int)$total_count;
}
public function offset() {
//Assuming 20 items per page:
//page 1 has an offset of 0 (1-1) * 20
// page 2 has an offset of 20 (2-1) * 20
//in other words, page 2 starts with item 21
return ($this->current_page - 1) * $this->per_page;
}
public function total_pages() {
return ceil($this->total_count/$this->per_page);
}
public function previous_page() {
return $this->current_page - 1;
}
public function next_page() {
return $this->current_page +1;
}
public function has_previous_page() {
return $this->previous_page() >= 1 ? true : false;
}
public function has_next_page() {
return $this->next_page() <= $this->total_pages() ? true : false;
}
}
I will look into the total_pages and get back to you if it works. I think I can just add WHERE id != 0 to the end of the count_all method. I don't think anything else uses it other than the photo share. I'll have to look into the code.
Thanks for your help with this.
DC
I simply added:
public static function count_all() {
global $database;
$sql = "SELECT COUNT(*) FROM ".self::$table_name." WHERE `id` **!= 0 AND `show` != 0";**
$result_set = $database->query($sql);
$row = $database->fetch_array($result_set);
return array_shift($row);
}
I added this to the photograph object. Now users can select whether or not that want their image to show in the photo sharing section, and if they don't upload an image with their post then it is automatically assigned the ID of 0. If this isn't clear and someone needs help with it, let me know.

As G-Nugget mentioned. NULL is better suited for this.
Your query also looks odd. The usual syntax is:
SELECT * FROM photographs WHERE id != 0
Having is used to apply filtering on GROUP BY queries.
Edit:
It also looks like you are using $total_count from pagination here:
$total_count = Photograph::count_all();
<snip>
for($i=1; $i <= $pagination->total_pages(); $i++) {
if($i == $page) {
echo " <span class=\"selected\">{$i}</span> ";
} else {
echo " {$i} ";
}
This will show a link for more pages than exist since $total_count includes the 0 record.

Related

Getting all data after clicking a particular cell in a table

Dbfiddle: https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=65b310b4b973a7577d4953e01c09a124
Currently I have a table that displays a total count of my data values for each source. I'm getting this value after comparing 2 tables 1 is crm_leads with all my product information and 1 is crm_sources with what sources are the products related to.
Now this is the output:
Now as you can see the total count is shown under each header next to its source. There are 8 cells for each source as seen in the picture. Now these count values are inside a tags which once clicked go to viewall page.
Now here basically I want to show the data of the item that I had clicked. So for example, if I clicked the 163 under Hot status, it takes me to the viewall page and shows me id, source, enquiry_date for all those under status Hot in a table.
So basically it should detect the data for which source and which status is clicked and then accordingly make a statement like this?
select * from crm_leads where lead_source = '.$source.' and lead_status = '.$status.';
Another thing I'm thinking I can do here is put my table inside a form and pass those values as post in my controller class leadstatus which will pass that value to viewall? Not really sure on how to proceed.
Model Class:
function get_statusreport($fdate='',$tdate='')
{
$this->db->select("l.lead_status,crm_sources.title,count(*) as leadnum,l.enquiry_date,l.sub_status");
$this->db->from($this->table_name." as l");
if($fdate !='')
$this->db->where("date(l.added_date) >=",date('Y-m-d',strtotime($fdate)));
if($tdate !='')
$this->db->where("date(l.added_date) <=",date('Y-m-d',strtotime($tdate)));
$this->db->where("lead_status <>",10);
$this->db->join("crm_sources ","crm_sources.id= l.lead_source","left");
$this->db->group_by("l.lead_status,crm_sources.title");
$this->db->order_by("leadnum DESC, crm_sources.title ASC,l.lead_status ASC");
$query = $this->db->get();
$results = $query->result_array();
return $results;
}
Controller Class(leadstatus holds the view for my current table):
public function leadstatus($slug='')
{
$content='';
$content['groupedleads'] = $this->leads_model->get_statusreport($fdate,$tdate);
$this->load->view('crm/main',$main);
$this->load->view('crm/reports/leadstatus',$content);
}
public function viewall($slug='')
{
$content='';
$this->load->view('crm/main',$main);
$this->load->view('crm/reports/viewall',$content);
}
View class:
<?php
$ls_arr = array(1=>'Open',8=>'Hot',2=>'Closed',3=>'Transacted',4=>'Dead');
foreach($groupedleads as $grplead){
$statuses[] = $status = $ls_arr[$grplead["lead_status"]];
if($grplead["title"] == NULL || $grplead["title"] == '')
$grplead["title"] = "Unknown";
if(isset($grplead["title"]))
$titles[] = $title = $grplead["title"];
$leaddata[$status][$title] = $grplead["leadnum"];
}
if(count($titles) > 0)
$titles = array_unique($titles);
if(count($statuses) > 0)
$statuses = array_unique($statuses);
?>
<table>
<tr">
<th id="status">Source</th>
<?php
if(count($statuses) > 0)
foreach($statuses as $status){
?><th id=<?php echo $status; ?>><?php echo $status; ?></th>
<?php
}
?>
<th>Total</th>
</tr>
<?php
if(is_array($titles))
foreach($titles as $title){
?>
<tr>
<?php
$total = 0;
echo "<td>".$title."</td>";
foreach ($statuses as $status) {
$num = $leaddata[$status][$title];
echo "<td><a target='_blank' href='".site_url('reports/viewall')."'>".$num."</a></td>";
$total += $num;
$sum[$status] += $num;
}
echo "<td>".$total."</td>";
$grandtotal += $total;
?>
</tr>
<?php } ?>
</table>
You can include the source and status in the URL like this:
foreach ($statuses as $status) {
$num = $leaddata[$status][$title];
echo "<td><a target='_blank' href='" . site_url('reports/viewall?source=' . $source . '&status=' . $status) . "'>" . $num . "</a></td>";
$total += $num;
$sum[$status] += $num;
}
Then in your controller:
public function viewall($slug = '')
{
$content = '';
$source = $this->input->get('source');
$status = $this->input->get('status');
// Do what you want with $source and $status
$this->load->view('crm/main', $main);
$this->load->view('crm/reports/viewall', $content);
}

PHP pagination with multiple GET variables

I'm struggling with pagination with 2 get variables - 1 of which being the page number.
My second $_GET variable I have is $_GET['cat'] which is getting the category of products I want to filter on.
Everything works with the pagination DISPLAY, number of pages etc., however, if I am filtered on a particular category, the first page of results displays fine, but when i try to get to the next page or any page number, nothing is displayed product wise.
Any help would be appreciated, please see code below.
<?php include("header.php");
echo '<div id="content_header"><center><h1> • Products • </h1></center></div>';
echo '<div id="products_left">
Show:<br />
<ul style="list-style-type:none; margin:0; padding:0;">
<li>Wedding Stationery</li>
<li>Frames</li>
<li>Nappy Cakes</li>
<li>Miscellaneous</li>
<li>All</li>
</ul>
</div>';
echo '<div id="clear"></div>';
echo '<div style="padding-left:150px; margin-top:-70px">';
$connect = mysqli_connect("localhost","root","") or die("Failed to connect to database");
mysqli_select_db($connect,"magical_moments") or die("Unable to find database");
if(empty($_GET['cat'])){
$query = mysqli_query($connect,"SELECT * FROM products");
} else {
$cat = $_GET['cat'];
$query = mysqli_query($connect,"SELECT * FROM products WHERE type='$cat'");
};
$products = mysqli_fetch_array($query);
$start = 0;
$limit = 9;
if(isset($_GET['page']))
{
$pid=$_GET['page'];
$start=($pid-1)*$limit;
}
else{
$pid=1;
}
//Fetch from database first 10 items which is its limit. For that when page open you can see first 10 items.
if(empty($_GET['cat'])){
$query = mysqli_query($connect,"SELECT * FROM products LIMIT $start, $limit");
} else {
$cat = $_GET['cat'];
$query = mysqli_query($connect,"SELECT * FROM products WHERE type='$cat' LIMIT $start, $limit");
};
?>
<ul>
<?php
//print 10 items
while($result=mysqli_fetch_array($query))
{
echo '<div id="display_product">
<table>
<tr>
<td><div id="product_image_holder" style="background-image:url('.$result[5].')"></div></td>
</tr>
<tr>
<td>'.$result[1].'</td>
</tr>
<tr>
<td>'.$result[3].'</td>
</tr>
<tr>
<td>£ '.$result[4].'</td>
</tr>
</table>
</div>';
}
echo '<div id="clear"></div>';
?>
</ul>
<?php
//fetch all the data from database.
echo '<div id="pagination_div">';
if(empty($_GET['cat'])) {
$rows=mysqli_num_rows(mysqli_query($connect,"SELECT * FROM products"));
//calculate total page number for the given table in the database
$total=ceil($rows/$limit);
if($pid>1)
{
//Go to previous page to show previous 10 items. If its in page 1 then it is inactive
echo "<a href='?page=".($pid-1)."' class='previous_button'>PREVIOUS</a>";
}
if($pid!=$total)
{
////Go to previous page to show next 10 items.
echo "<a href='?page=".($pid+1)."' class='next_button'>NEXT</a>";
}
//show all the page link with page number. When click on these numbers go to particular page.
for($i=1;$i<=$total;$i++)
{
if($i==$pid) { echo "<li class='current'>".$i."</li>"; }
else { echo "<li class='pagination'><a href='?page=".$i."'>".$i."</a></li>"; }
}
echo '</div>';
} else {
$rows=mysqli_num_rows(mysqli_query($connect,"SELECT * FROM products WHERE type='$cat'"));
//calculate total page number for the given table in the database
$total=ceil($rows/$limit);
// cat is set - pagination for cat + page
if($pid>1)
{
//Go to previous page to show previous 10 items. If its in page 1 then it is inactive
echo "<a href=".$_SERVER['REQUEST_URI']."?page=".($pid-1)." class='previous_button'>PREVIOUS</a>";
}
if($pid!=$total)
{
////Go to previous page to show next 10 items.
echo "<a href=".$_SERVER['REQUEST_URI']."?page=".($pid+1)." class='next_button'>NEXT</a>";
}
//show all the page link with page number. When click on these numbers go to particular page.
for($i=1;$i<=$total;$i++)
{
if($i==$pid) { echo "<li class='current'>".$i."</li>"; }
else { echo "<li class='pagination'>".$i."</li>"; }
}
echo '</div>';
};
?>
</ul>
</div>
<?php include("footer.php"); ?>
Well, you define the page parameter. But the category parameter is lost once clicked on a link because it's simply not there.
You've got this:
echo "<li class='pagination'>".$i."</li>";
You lack the parameter cat. Here's an example:
echo '<li class="pagination">'.$i.'</li>';

PHP Search: Using Jquery to alter a php a value

I have a comics website. A feature it has is to allow users to search comics... the search will instantly parse the input and return thumbnail results based on matching title and keywords.
Originally, the search would return all of the results, and the bounding search box would expand infinitely downward, holding every single comic result. I thought it may be a nice touch to limit the results to 4, and display a message like "load 5 remaining images" if the user chooses to do so.
If they click on that message, I wanted limiting php variable to be removed or changed.
So far, it loads with the limit, and shows a link...
EDIT: Latest Code:
search_field.php (the search file that get's included on a page... this file calls search.php via JQuery):
<?php $site = (isset($_GET['site']) ? ($_GET['site']) : null); ?>
<div id="sidebar" class="searchborder">
<!--Allow users to search for comic-->
<!--<span class="search">Search for <?php// echo (($site == "artwork") ? 'artwork' : 'a comic'); ?> </span>-->
<script type="text/javascript">
function GetSearch(mySearchString){
$.get("./scripts/search.php", {_input : mySearchString, _site : '<?php echo $site ?>'},
function(returned_data) {
$("#output").html(returned_data);
}
);
}
</script>
<center>
<table>
<tr>
<td>
<span class="search">
<img src="./images/SiteDesign/Search.png" />
<input type="text" onkeyup="GetSearch(this.value)" name="input" value="" />
<!--<input id="site" type="hidden" value="<?php// echo $site; ?>">-->
</span>
</td>
</tr>
</table>
</center>
<span id="output"> </span>
</div>
search.php, the file that's called to parse the string and return the results:
<?php
//Query all images:
include 'dbconnect.php';
$site = $_GET['_site'];
$input = (isset($_GET['_input']) ? ($_GET['_input']) : 0);
$siteChoice = (isset($_GET['_choice']) ? ($_GET['_choice']) : $site);
$start = (isset($_GET['_start']) ? ($_GET['_start']) : null);
echo "start: " . $start;
//if user goes to hittingtreeswithsticks.com... no "site" value will be set... so I need to set one
if ($site == null) {
$site = "comics";
}
if ($siteChoice == "artwork") {
$sql = "SELECT id, title, keywords, thumb FROM artwork";
$thumbpath = "./images/Artwork/ArtThumbnails/";
}
else if ($siteChoice == "comics") {
$sql = "SELECT id, title, keywords, thumb FROM comics";
$thumbpath = "./images/Comics/ComicThumbnails/";
}
else {
$sql = "SELECT id, title, keywords, thumb FROM $site";
if ($site == "artwork") {
$thumbpath = "./images/Artwork/ArtThumbnails/";
}
else {
$thumbpath = "./images/Comics/ComicThumbnails/";
}
}
/* For this to work, need all comics replicated in an "All Comics" file along with "All Thumbnails"
else {
$sql = "SELECT id, title, thumb FROM comics
UNION
SELECT id, title, thumb FROM artwork";
$thumbpath = "./images/AllThumbnails/";
}*/
$imgpaths = $mysqli->query($sql);
mysqli_close($mysqli);
$idresult = array();
$imgresult = array();
$thumbresult = array();
//CHECK IF $INPUT == IMAGE PATH
if (strlen($input) > 0)
{
while ($row = $imgpaths->fetch_assoc())
{
//query against key words, not the image title (no one will remember the title)
if (stripos($row['keywords'], $input) !== false || strtolower($input)==strtolower(substr($row['title'],0,strlen($input))))
//if (strtolower($input)==strtolower(substr($row['title'],0,strlen($input))))
{
array_push($idresult, $row['id']);
array_push($imgresult, $row['title']);
array_push($thumbresult, $row['thumb']);
}
}
//ECHO RESULTS ARRAY
if(count($imgresult) == 0)
{
echo "<p>no suggestions</p>";
}
else
{
echo "<ul>";
$k = 0;
$max = 4;
if (count($imgresult) > $max) {
while ($k < count($imgresult) && $k < $max)
{
echo '<li>
<span class="sidebarimages"><a href=".?action=viewimage&site=' . $siteChoice . '&id=' . $idresult[$k] . '">
<img src="./scripts/thumber.php?img=.'.$thumbpath.$thumbresult[$k].'&mw=90&mh=90"/></a></span>
</li>';
$k++;
}
$difference = count($imgresult)-$k;
echo "<br/><i><a href='.?action=homepage&site=" . $siteChoice . "&start=4' class='loadSearch'>load " . $difference . " more result" . (($difference != 1) ? 's' : '') . "... </a></i>";
}
else {
while ($k < count($imgresult))
{
echo '<li>
<span class="sidebarimages"><a href=".?action=viewimage&site=' . $siteChoice . '&id=' . $idresult[$k] . '">
<img src="./scripts/thumber.php?img=.'.$thumbpath.$thumbresult[$k].'&mw=90&mh=90"/></a></span>
</li>';
$k++;
}
}
echo "</ul>";
}
}
?>
<script type="text/javascript">
$(".loadSearch").click(function() {
//alert("Test");
$.get("./search.php", {_start : 4},
function (returned_data) {
$("#moreResults").html(returned_data);
}
);
});
</script>
Try this:
<script type="text/javascript">
$("#loadSearch").click(function() {
$.get('URL WITH QUERY', function(data) {
$('#results').html(data);
});
});
</script>
From what i get all you need is when "load more" is clicked only new results should be shown.
Load more has to be a url same as your search url.
Search/Autocomplete URL - example.com/autocomplete?q=xkd
Load More URL - example.com/autocomplete?q=xkd&start=4&max=1000
Just add two parameters to your url. start and max. Pass them to your queries and you get exact result.
Only verify Start < Max and are integers intval() and not 0 empty(). Also if Max <= 4 then dont show load more.
I would give all of your results back, then try to determine your results. If more then 4, loop out the first 4 results. If the user clicks on the load more button your start looping from your 4th element. That way you only need to hit the server once (per search).
Try to give back your results in json, so you can format it the way you like in your html file.
In pseudo code:
searchTerm = 'hello';
resultsFromServer = getResults($searchterm);
resultcounter = count(resultsFromServer);
if(resultcounter > 4)
loop 4 results
else
loop all results
$(".loadSearch").click(function(e) {
//alert("Test");
e.preventDefault();
$.get("./search.php", {_start : 4},
function (returned_data) {
$("#moreResults").html(returned_data);
}
);
I ended up going with jquery show and hide functions.
PHP Snippet:
//ECHO RESULTS ARRAY
if(count($imgresult) == 0)
{
echo "<p>no suggestions</p>";
}
else
{
echo "<ul>";
$k = 0;
$max = 4;
while ($k < count($imgresult) && $k < $max)
{
echo '<li>
<span class="sidebarimages"><a href=".?action=viewimage&site=' . $siteChoice . '&id=' . $idresult[$k] . '">
<img src="./scripts/thumber.php?img=.'.$thumbpath.$thumbresult[$k].'&mw=90&mh=90"/></a></span>
</li>';
$k++;
}
$difference = count($imgresult)-$k;
echo '<div id="moreResults">';
while ($k < count($imgresult))
{
echo '<li>
<span class="sidebarimages"><a href=".?action=viewimage&site=' . $siteChoice . '&id=' . $idresult[$k] . '">
<img src="./scripts/thumber.php?img=.'.$thumbpath.$thumbresult[$k].'&mw=90&mh=90"/></a></span>
</li>';
$k++;
}
echo '</div>';
if (count($imgresult) > $max) {
?>
<br />Load <?php echo $difference; ?> more result<?php echo (($difference != 1) ? 's' : ''); ?>...
<?php
}
echo "</ul>";
}
}
Jquery:
<script type="text/javascript">
$("#moreResults").hide();
$("#showMore").click(function() {
$("#moreResults").show();
$("#showMore").hide();
});

Making a virtual shelf and populating it via a database

I'm trying to make a virtual shelf type of thing which is populated via a MySQL database. The column shelfPos holds the position of the item on the shelf. Each row/'shelf' starts with <div class="shelfRow"> and obviously ends with </div> so it's styled and positioned correctly. Items on the shelves can be moved around using the jQuery UI droppable interaction.
The overall layout is this: http://jsfiddle.net/aRA5D/
Each shelf can hold 5 items (left to right).
I'm having trouble populating the shelves. At the moment I've got this: (This is in the place of the HTML)
<?php
$sql="SELECT * FROM shelf WHERE userID='$userID'";
$result=mysql_query($sql);
if (mysql_num_rows($result) == 0) {
// Show a message of some sort? (No items)
}
else {
$tries = 1;
$times = 10; // How many shelves. (10 = 2 shelves)
while(($row = mysql_fetch_array($result)) && ($tries <= $times)) {
while ($tries <= $times) {
if ($tries == $row['shelfPos']) {
echo '<div class="drop" id="drop'.$tries.'"><div class="boxArt" id="'.$row['gameID'].'">'.$row['gameID'].'</div></div>';
}
else {
echo '<div class="drop" id="drop'.$tries.'"></div>';
}
$tries = $tries + 1;
}
$times = $times + 5;
}
}
?>
There's several things wrong with it. It doesn't include the <div class="shelfRow"> html (didn't know how/where to put it, as it needs to be echoed after every 5 'blank' and real items - for loop maybe?) and it requires me to input the number of shelves (2 in this case). Would it be possible to determine how many shelves are required based on the item's position? It's awkward to do because it also needs to echo 'blank' .drop divs before and after them so that the items can be moved around.
Hope this all makes sense. Thanks for the help!
First u need to get data in order of ShelfPos
"SELECT * FROM shelf WHERE userID='$userID' order by shelfPos asc"
And try this code:
...
$i = 0;
while($row = mysql_fetch_array($result)) {
//Each 5
if($i % 5 == 0) echo '<div class="shelfRow">';
if ($i == $row['shelfPos']) {
echo '<div class="drop" id="drop'.$i.'"><div class="boxArt" id="'.$row['gameID'].'">'.$row['gameID'].'</div></div>';
}
else {
echo '<div class="drop" id="drop'.$i.'"></div>';
}
//close shelfrow div
if($i % 5 == 4) echo '</div>';
$i++;
}
//to complete the loop
$shelv_left = 5 - ($i % 5);
if($shelv_left < 5) {
for($j=0; $j < $shelv_left; $j++) {
echo '<div class="drop" id="drop'.($i+$j).'"></div>';
}
echo '</div>'; // end shelfrow div
}
...

How to display all images when a link is clicked by using JQuery, PHP & MySQL?

I have this script that displays ten images or less by default but when a user clicks the <a> tag link it displays all the users images.
Is there a way I can display all the users images by having them slide down when a user clicks on the link <a> link instead of refreshing the page using JQuery or PHP?
Here is the php code.
if(isset($_GET['view']) && strlen($_GET['view']) == 1) {
$view = htmlentities(strip_tags($_GET['view']));
}
$multiple = FALSE;
$row_count = 0;
if(isset($view) == a) {
$dbc = mysqli_query($mysqli,"SELECT *
FROM images
WHERE images.user_id = '$user_id'");
} else {
$dbc = mysqli_query($mysqli,"SELECT *
FROM images
WHERE images.user_id = '$user_id'
LIMIT 0, 10");
}
if (!$dbc) {
print mysqli_error($mysqli);
} else {
while($row = mysqli_fetch_array($dbc)){
if(($row_count % 5) == 0){
echo '<ul>';
}
echo '<li><img src="/images/thumbs/' . $row['avatar'] . '" /></li>';
if(($row_count % 5) == 4) {
$multiple = TRUE;
echo "</ul>";
} else {
$multiple = FALSE;
}
$row_count++;
}
if($multiple == FALSE) {
echo "</ul>";
}
}
echo 'View All';
Have a look at jquery's load
http://api.jquery.com/load/
Update:
if you see in the examples provided you can use:
$('#result').load('ajax/test.html');
where you substitute #result with the id of the element (a <div> for example) where you want put your images
and the 'ajax/test.html' where you put the url of the php code that creates the image list

Categories