Skip to content

Instantly share code, notes, and snippets.

@mpavel
mpavel / demo.ts
Last active October 19, 2015 16:48
Get more items - ng2
// This is my Angular2 Component
class ItemList {
offset = 0;
items:ListItem[] = [];
// inject MyApi and set it as a private property on the class, automatically
// then get the initial items by default
constructor(private api:MyApi) {
this.getNextItems();
}
<?php
$conn = mysql_connect("localhost", "username", "password" ) or die (mysql_error()) ;
mysql_select_db("database", $conn);
if( !isset( $_GET['p']) ) {$_GET['p']=0;} // Ideally check if it's numeric also
$per_page= 9;
$sql= "SELECT * FROM black"; // You don't use this one ...
// The first int in LIMIT specifies the start row, thus you need to do $_GET['p'] * $per_page
// More importantly you're trying to use both ID and IMAGE columns from your database, but you only select image ???
$sql2= "SELECT * FROM black ORDER BY id Asc LIMIT ".$_GET['p'] * $per_page."," . $per_page;
$query= mysql_query( $sql2 );