/    Sign up×
Community /Pin to ProfileBookmark

Need help to make dinamic pagination

i need help to clean sytanx errors a little and to do a pagination for dinamic pages.i give a beer on paypall who helps me? at the finish here is my code

<?php require_once(‘./Connections/filminitaliano.php’);

?>
<?php
if (!function_exists(“GetSQLValueString”)) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = “”, $theNotDefinedValue = “”)
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists(“mysql_real_escape_string”) ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case “text”:
$theValue = ($theValue != “”) ? “‘” . $theValue . “‘” : “NULL”;
break;

case “long”:
case “int”:
$theValue = ($theValue != “”) ? intval($theValue) : “NULL”;
break;
case “double”:
$theValue = ($theValue != “”) ? doubleval($theValue) : “NULL”;
break;
case “date”:
$theValue = ($theValue != “”) ? “‘” . $theValue . “‘” : “NULL”;
break;
case “defined”:
$theValue = ($theValue != “”) ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$maxRows_listaFilm = 10;
$pageNum_listaFilm = 0;
if (isset($_GET[‘pageNum_listaFilm’])) {
$pageNum_listaFilm = $_
GET[‘pageNum_listaFilm’];
}
$startRow_listaFilm = $pageNum_listaFilm * $maxRows_listaFilm;
$varCategoria_listaFilm = “0”;
if (isset($_GET[‘cat’]) && $_GET[‘cat’] > 0 ? (int) $_GET[‘cat’] : 0){
$varCategoria_listaFilm = $_
GET[“cat”];

}
else {
header(“Location: genere.php?cat=1/Azione”);
}
mysql_select_db($database_filminitaliano, $filminitaliano);
$query_listaFilm = sprintf(“SELECT * FROM filme WHERE filme.intCategoria = %s”, GetSQLValueString($varCategoria_listaFilm, “int”));
$query_limit_listaFilm = sprintf(“%s LIMIT %d, %d”, $query_listaFilm, $startRow_listaFilm, $maxRows_listaFilm);
$listaFilm = mysql_query($query_limit_listaFilm, $filminitaliano) or die(mysql_error());
$row_listaFilm = mysql_fetch_assoc($listaFilm);

if (isset($_GET[‘totalRows_listaFilm’])) {
$totalRows_listaFilm = $_
GET[‘totalRows_listaFilm’];
} else {
$all_listaFilm = mysql_query($query_listaFilm);
$totalRows_listaFilm = mysql_num_rows($all_listaFilm);
}
$totalPages_listaFilm = ceil($totalRows_listaFilm/$maxRows_listaFilm)-1;

?>

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”utf-8″>
<title>Site Setup</title>

<meta name=”viewport” content=”width=device-width”>

<!– Main stylesheet imports bootstrap css and adds custom –>
<link href=”css/style.css” rel=”stylesheet”>

<!– Modernizr for browser feature-checking
and HTML5shim (included) see modernizr.com –>
<script src=”js/modernizr-2.5.3.min.js”></script>

<!– Fav and touch icons –>
<!– OR remove these lines and place icons directly
in the site root folder mathiasbynens.be/notes/touch-icons –>
<link rel=”shortcut icon” href=”img/favicon.ico”>
<link rel=”apple-touch-icon” href=”img/apple-touch-icon.png”>
<link rel=”apple-touch-icon” sizes=”72×72″ href=”img/apple-touch-icon-72×72.png”>
<link rel=”apple-touch-icon” sizes=”114×114″ href=”img/apple-touch-icon-114×114.png”>
<link rel=”stylesheet” type=”text/css” href=”css/demo.css” />
<link rel=”stylesheet” type=”text/css” href=”css/elastislide.css” />
<link rel=”stylesheet” type=”text/css” href=”css/custom.css” />
<script src=”js/modernizr.custom.17475.js”></script>

</head>

<body>

<div class=”navbar navbar-fixed-top”>
<div class=”navbar-inner”>
<div class=”container”>
<a class=”btn btn-navbar” data-toggle=”collapse” data-target=”.nav-collapse”>
<span class=”icon-bar”></span>
<span class=”icon-bar”></span>
<span class=”icon-bar”></span>
</a>
<a class=”brand” href=”index.html” style=”font-family:’alba’; font-size:24px;”>Film in italiano.com</a>
<div class=”nav-collapse”>
<ul class=”nav”>
<li class=”active”><a href=”#”><i class=”icon-home icon-white”></i> Homepage</a></li>
<li><a href=”#”>In Cinema</a></li>
<li><a href=”#”>Articoli</a></li>
<li><a href=”#”>Accesso utenti</a></li>
<li class=”dropdown”>
<a href=”#” class=”dropdown-toggle” data-toggle=”dropdown”>Genere <b class=”caret”></b></a>
<ul class=”dropdown-menu”>
<?php include ‘inc/listacategoria.php’?>

</ul>
</li>
</ul>
<form class=”navbar-search pull-right” action=””>
<input type=”text” class=”search-query span2″ placeholder=”Search”>
</form>

</div><!– /.nav-collapse –>
</div><!– /.container –>
</div><!– /navbar-inner –>
</div><!– /navbar –>

<div class=”container”>

<p>ULTIMI FILM AGGIUNTI</p>

<div class=”container demo-1″>
<!– Codrops top bar –>
<!–/ Codrops top bar –>

<div class=”main”>
<header class=”clearfix”>

<nav class=”codrops-demos”>

</nav>
</header>

<!– Elastislide Carousel –>

</div>
</div>

<div>

</div>

<table width=”100%” border=”0″>
<tr>
<td><?php if ($totalRows_listaFilm > 0) { // Show if recordset not empty ?>
<?php do { ?>
<div id=”mainwrapper”>
<!– Image Caption 1 –>

<div id=”box-1″ class=”box”> <a href=”film.php?id=<?php echo mysql_real_escape_string($row_listaFilm[‘id’]); ?>/<?php echo $row_listaFilm[‘titolo_link’]; ?>”><img src=”copFilm/descrcare.jpg” width=”150″ height=”199″ id=”image-1″/></a>
<span class=”caption simple-caption”>
<div style=”width:150″><p style=”font-size:12px;”><?php echo $row_listaFilm[‘titolo’]; ?></p></div>
</span>

</div></div>

<?php } while ($row_listaFilm = mysql_fetch_assoc($listaFilm)); ?>

<?php } // Show if recordset not empty ?>
<?php if ($totalRows_listaFilm == 0) { // Show if recordset empty ?>
Nessun film in questa categoria
<?php } // Show if recordset empty ?></td>
</tr>
<tr>
<td>Space for pagination?</td>
</tr>
</table>
</div>

</div> <!– /container –>

<!– ==============================================
JavaScript below! –>

<!– jQuery via Google + local fallback, see h5bp.com –>

<script src=”//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js”></script>
<script>window.jQuery || document.write(‘<script src=”js/jquery-1.7.1.min.js”></script>’)</script>

<!– Bootstrap JS –>
<script src=”js/bootstrap.min.js”></script>

<!– Prettify –>
<script src=”js/prettify/prettify.js”></script>

<!– Initialize Scripts –>
<script>

addEventListener(‘load’, prettyPrint, false);

$(document).ready(function(){

// Activate prettyprint
$(‘pre’).addClass(‘prettyprint’);

// Initialize tabs and pills
$(‘.note-tabs’).tab();

}); // end document.ready
</script>
<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js”></script>
<script type=”text/javascript” src=”js/jquerypp.custom.js”></script>
<script type=”text/javascript” src=”js/jquery.elastislide.js”></script>
<script type=”text/javascript”>

$( ‘#carousel’ ).elastislide();

</script>

</body>
</html>

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@_Krik_Feb 23.2013 — It does help a ton if you use the [ code ] or [ php ] BB tags when you post code. There's some handy icons above where you write your post that can help.

First a bit more information would be helpful to us, like what your code is or is not doing. Are you getting errors if so what are they. If it is not giving an error but is not working you could set "error_reporting(E_ALL)" and you might see the problem or at least it would give us here a clue to the problem.

I looks like "$_GET['pageNum_listaFilm']" is were you retrieving the page number from but I do not see "pageNum_listaFilm" set anywhere in your HTML. At minimum you need a link like so:
[code=html]
<a href="yourpage.php?pageNum_listaFilm=2">Page 2</a>
[/code]

Or a form that has its "method" attribute set to "get" and a field in that form with a "name" of "pageNum_listaFilm".

Same goes for "$_GET['cat']" I do not see a link or a form field that sets the value of "cat".

Hope the helps. If not try to provide some more information.

Lastly a couple things you should do differently. Functions should never be defined inside an "if" statement. Your "GetSQLValueString" is in an "if" statement. Move the function outside of it and get rid of the "if". If you don't know that the "function_exists" you have made a mistake in your code. "function_exists" does have a use, but that is not how it was intended to be used.

Also your code is checking if the PHP version is less than 6, all PHP versions currently in use are less that version 6 so that is an unnecessary check. Version 6 is not even scheduled for release so it is likely a very long ways down the road before it is released, and even then your server may not update to it for quite some time after its release. And really when working with PHP you should know what version you have running on your server. I know some third party libraries may do a version check so their code works with old version but if your writing your own code you don't need it.
×

Success!

Help @Atlas_Alexis spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...