Skip to content

Instantly share code, notes, and snippets.

Avatar

Pavel Mocan mpavel

View GitHub Profile
@mpavel
mpavel / demo.ts
Last active Oct 19, 2015
Get more items - ng2
View demo.ts
// 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();
}
View Correction.php
<?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 );
You can’t perform that action at this time.