I have some HTML/PHP code in Dreamweaver and for the life of me I cannot figure out the cause of this error. The error reads, "There is a syntax error on line 318. Code hinting may not work until you fix this error." Could someone help? And yes, I know I have terrible commenting practice and variable nomenclature. The code can also be found here
<?php
require $_SERVER['DOCUMENT_ROOT'].'/resources/feeds.php';
require $_SERVER['DOCUMENT_ROOT'].'/resources/mysql.php';
session_start();
if(empty($_SESSION['username']) || $_SESSION['login'] != 'true'){ header("location:/"); }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License
Name : Vegetables
Description: A two-column, fixed-width design with dark color scheme.
Version : 1.0
Released : 20110416
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="icon" type="/image/png" href="/resources/favicon.png">
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>My Website • Edit Information</title>
<link href="/style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="header">
<div id="logo">
<h1>My Website</h1>
This is the best website ever
<p> </p>
</div>
</div>
<!-- end #header -->
<div id="wrapper">
<div id="menu">
<ul>
<li class="current_page_item">Home</li>
<li>Events</li>
<li>Forums</li>
<li>About</li>
<li>Minutes</li>
<li>Documents</li>
<li>Contact Us</li>
</ul>
</div>
<!-- end #menu -->
</div>
<div id="page">
<div id="content">
<div class="post">
<h2 class="title">Edit Information</h2>
<div style="clear: both;"><form action="/admin"><input type="submit" value='Back'/></form></div>
<div style="clear: both;"></div>
<div class="entry">
<SCRIPT language="javascript">
function add() {
x++;
var foo = document.getElementById('my_div');
foo.innerHTML = foo.innerHTML +"<input type='text' name='tg"+x+"' placeholder='name'><br />";
}
function addch() {
y++;
var foo = document.getElementById('my_other_div');
foo.innerHTML = foo.innerHTML +"<input type='text' name='ch"+y+"' placeholder='name'><br />";
}
function addws() {
z++;
var foo = document.getElementById('my_other_other_div');
foo.innerHTML = foo.innerHTML +"<input type='text' name='ws"+z+"' placeholder='workshop name and leaders' style='width: 98%;'><br />";
}
function detect(form) {
if(form.checked) {
window.backUpHtml = document.getElementById('con_div').innerHTML;
document.getElementById('con_div').innerHTML = '';
} else {
document.getElementById('con_div').innerHTML = window.backUpHtml;
window.backUpHtml = '';
}
}
</SCRIPT>
<form name="form1" method="post" action="./"><font color="#FFFFFF">
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#00000" style="max-width: 560px;">
<tr>
<td width="10%">Name</td>
<td width="90%"><?php echo "<input name='name' type='text' value='".stripslashes($_POST['name'])."' required='required'/>"; ?><input type="checkbox" onclick="detect(this)" name="isyac" id="isyac" value="yes" <?php if(isset($_POST['isyac'])) { echo "checked='checked'";} ?> /><label for="isyac">YAC Meeting</label></td>
</tr>
<tr>
<td width="10%" style="vertical-align:top;">Description</td>
<td width="90%"><?php echo '<textarea name="desc" rows="5" cols="60" style="resize: vertical;" required="required">'.stripslashes($_POST["desc"]).'</textarea>'; ?></td>
</tr>
<tbody id="con_div">
<!-- START OF CON DIV -->
<tr>
<td width="10%" style="vertical-align:top;">Touchgroup Leaders</td>
<td width="90%">
<?php
$blah = 1;
while(isset($_POST['tg'.$blah])) {
echo '<input type="text" name="tg'.$blah.'" value="'.stripslashes($_POST["tg".$blah]).'" /><br />';
$blah++;
}
$hoo = $blah - 1;
echo "<script language='javascript'> var x = ".$hoo."; </script>";
?>
<div id="my_div"></div>
<input type="button" value="Add" onClick="add()">
</td>
</tr>
<tr>
<td width="10%" style="vertical-align:top;">Chaplains</td>
<td width="90%">
<?php
$blah = 1;
while(isset($_POST['ch'.$blah])) {
echo '<input type="text" name="ch'.$blah.'" value="'.stripslashes($_POST["ch".$blah]).'" /><br />';
$blah++;
}
$hoo = $blah - 1;
echo "<script language='javascript'> var y = ".$hoo."; </script>";
?>
<div id="my_other_div"></div>
<input type="button" value="Add" onClick="addch()">
</td>
</tr>
<tr>
<td width="10%" style="vertical-align:top;">Workshops</td>
<td width="90%">
<?php
$blah = 1;
while(isset($_POST['ws'.$blah])) {
echo '<input type="text" name="ws'.$blah.'" value="'.stripslashes($_POST["ws".$blah]).'" style="width: 98%;"/><br />';
$blah++;
}
$hoo = $blah - 1;
echo "<script language='javascript'> var z = ".$hoo."; </script>";
?>
<div id="my_other_other_div"></div>
<input type="button" value="Add" onClick="addws()">
</td>
</tr>
</tbody>
<!-- END OF CON DIV -->
<tr>
<td width="10%" style="vertical-align:top;">Registration Links</td>
<td width="90%">
<?php echo '<input type="text" name="YouthLink" value="'.stripslashes($_POST['YouthLink']).'"/> Youth Link<br />
<input type="text" name="AdultLink" value="'.stripslashes($_POST['AdultLink']).'"/> Adult Link'; ?>
</td>
</tr>
<tr>
<td width="10%" style="vertical-align:top;">Start Date</td>
<td width="90%">
<select name='startmonth'>
<?php $idk = array("January","February","March","April","May","June","July","August","September","October","November","December");
foreach ($idk as $bob):
if($bob = $_POST['startmonth']) {
echo '<option value="'.$bob.'" selected="selected">'.$bob.'</option>';
} else {
echo '<option value="'.$bob.'">'.$bob.'</option>';
}
endforeach;
?>
</select>
<select name="startday">
<?php
$x = 1;
while($x <= 31) {
if((int)$_POST['startday'] == $x) {
echo "<option value='".$x."' selected='selected'>".$x."</option>";
} else {
echo "<option value='".$x."'>".$x."</option>";
}
$x++;
}
?>
</select>
<select name="startyear">
<?php $date = getdate();
for($x = 0;$x < 3;$x++) {
$y = (int)$date['year']+$x;
if($y == $_POST['startyear']) {
echo "<option value='".$y."' selected='selected'>".$y."</option>";
} else {
echo "<option value='".$y."'>".$y."</option>";
}
}
?>
</select>
</td>
</tr>
<tr>
<td width="10%" style="vertical-align:top;">End Date</td>
<td width="90%">
<select name='endmonth'>
<?php $idk = array("January","February","March","April","May","June","July","August","September","October","November","December");
foreach ($idk as $bob):
if($bob = $_POST['endmonth']) {
echo '<option value="'.$bob.'" selected="selected">'.$bob.'</option>';
} else {
echo '<option value="'.$bob.'">'.$bob.'</option>';
}
endforeach;
?>
</select>
<select name="endday">
<?php
$x = 1;
while($x <= 31) {
if((int)$_POST['endday'] < $x) {
echo "<option value='".$x."'>".$x."</option>";
} else if((int)$_POST['endday'] == $x) {
echo "<option value='".$x."' selected='selected'>".$x."</option>";
} else if((int)$_POST['endday'] > $x) {
echo "<option value='".$x."'>".$x."</option>";
}
$x++;
}
?>
</select>
<select name="endyear">
<?php $date = getdate();
for($x = 0;$x < 3;$x++) {
$y = (int)$date['year']+$x;
if($y == $_POST['endyear']) {
echo "<option value='".$y."' selected='selected'>".$y."</option>";
} else {
echo "<option value='".$y."'>".$y."</option>";
}
}
?>
</select>
</td>
</tr>
<tr>
<td width="10%" style="vertical-align:top;">Location</td>
<td width="90%">
<?php echo '<input type="text" name="location" value="'.stripslashes($_POST['location']).'" required="required"/>'; ?>
</td>
</tr>
<tr>
<td width="90%"></td>
<td width="10%">
<input type="hidden" name="blah" value="blah"/>
<input type="submit" name="woohoo" value="Save" align="right"/>
</td>
</table>
</form>
<?php if(isset($_POST['isyac'])) {
echo "<script language='javascript'>window.backUpHtml = document.getElementById('con_div').innerHTML;
document.getElementById('con_div').innerHTML = '';</script>"; ?>
}
</div>
</div>
<div style="clear: both;"> </div>
</div>
<!-- end #content -->
<div id="sidebar">
<?php include($_SERVER['DOCUMENT_ROOT'].'/resources/side.php'); ?>
</div>
<!-- end #sidebar -->
<div style="clear: both;"> </div>
</div>
<!-- end #page -->
<div id="footer-menu">
<ul>
<li class="current_page_item">Home</li>
<li>Events</li>
<li>Forums</li>
<li>About</li>
<li>Minutes</li>
<li>Documents</li>
<li>Contact Us</li>
</ul>
</div>
<div id="footer">
<p>Copyright © <?php $date = getdate(); echo $date['year']; ?> My Website. All rights reserved.</p>
</div>
<!-- end #footer -->
</body>
</html>
Your problem comes from this bit of code:
<?php if(isset($_POST['isyac'])) {
echo "<script language='javascript'>window.backUpHtml = document.getElementById('con_div').innerHTML;
document.getElementById('con_div').innerHTML = '';</script>"; ?>
}
the closing brace } needs to be inside the php tags (before the ?>)
I just glanced over your code and I would say this is probably it:
</form>
<?php if(isset($_POST['isyac'])) {
echo "<script language='javascript'>window.backUpHtml = document.getElementById('con_div').innerHTML;
document.getElementById('con_div').innerHTML = '';</script>"; ?>
}
</div>
Your end curly should be inside the ?>
</form>
<?php if(isset($_POST['isyac'])) {
echo "<script language='javascript'>window.backUpHtml = document.getElementById('con_div').innerHTML;
document.getElementById('con_div').innerHTML = '';</script>";
}
?>
</div>
Related
Whenever I click on the add to cart button it just goes to another page instead of showing it in the table
<?php
require "includes/dbh.php";
if(isset($_post['add'])){
if(isset($_SESSION['shopping_cart'])){
This is how I get the data in the html
$item_array_id=array_column($_SESSION['shopping_Cart'],'item_id');
if(!in_array($_GET['id'],$item_array_id)){
$count=count($_SESSION['shopping_cart']);
$item_array=array(
'item_id' =>$_GET['id'],
'item_name'=>$_POST['hidden_name'],
'item_price'=>$_POST['hidden_price'],
'item_quantity'=>$_POST['quantity'],
);
$_SESSION['shopping_cart'][$count]=$item_array;
}else{
echo "<script> alert('item already added')</script>";
echo "window.location='displayitems.php'></script>";
}
}else{
$item_array=array(
'item_id' =>$_GET['id'],
'item_name'=>$_POST['hidden_name'],
'item_price'=>$_POST['hidden_price'],
'item_quantity'=>$_POST['quantity'],
);
$_SESSION['shopping_cart'][0]=$item_array;
}
}
if(isset($_get['action'])){
if($_get['action']=='delete'){
foreach($_SESSION['shopping_cart'] as $keys =>$values){
if($values['item_id']==$_get['id'])
{
unset($_SESSION['shopping_cart'][$keys]);
echo '<script>alert("item removed")</script>';
echo '<script>window.location="displayitems.php</script>';
}
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
<script src="main.js"></script>
<style>
.product{
border:1px solid
margin:-1px 19px 3px -1px;
padding: 10px;
text-align:center;
bacgkround-color:#efefef;
}
</style>
</head>
<body>
<?php
if(isset($_SESSION['userId'])){
echo '<div id="items" >';
include_once 'includes/dbh.php';
require 'includes/gallery-upload.in.php';
$sql="SELECT * FROM gallery ORDER BY orderitems DESC;";
$stmt=mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt,$sql)){
echo "sql statement failed in displayitems.php";
}else{
mysqli_stmt_execute($stmt);
$result=mysqli_stmt_get_result($stmt);
while($row=mysqli_fetch_assoc($result))
{
?>
This is my form in adding to cart button
<div class="col-md-3">
<form method="POST" action="displayitems.php?action=add&id=<?php
echo $row["idGallery"]?>">
<div class="product">
<img src=images/<?php echo $row['imgFullNameGallery'] ?>
<br>
<h3><?php echo $row['nameitem']?></h3>
<h3><?php echo $row['price']?></h3>
<input type='number' name='quantity' value="1">
<input type='hidden' name='hidden_name' value="<?php echo
$row['nameitem']?>">
<input type='hidden' name='hidden_price' value="<?php
echo
$row['price']?>">
<button type='submit' name='add'>Add to cart</button>
</div>
</form>
</div>
<?php
}
}
}
?>
<div style="clear":both"></div>
<h3 class="title2">Shopping cart details</h3>
<div class="table table-bordered">
<table>
<tr>
<th width=40%>Item Name</th>
<th width=10%>Quantity</th>
<th width=20%>Price</th>
<th width=15%>Total</th>
<th width=5%>Action</th>
</tr>
<?php
if(!empty($_SESSION['shopping_cart'])){
$total=0;
foreach($_SESSION['shopping_cart']as $keys => $values){
?>
<tr>
<td><?php echo $values['item_name'];?></td>
<td><?php echo $values['item_quantity'];?></td>
<td>$<?php echo $values['item_price'];?></td>
<td><?php echo
number_format($values['item_quantity']*$values['item_price'],2);?></td>
<td>REMOVE</span></td>
</tr>
<?php
$total= $total+($values['item_quantity']*$values['item_price']);
}
?>
<tr>
<td coslpan="3" align="right">total</td>
<td align="right"><?php echo number_format($total,2);?></td>
</td></td>
<?php
}
?>
</table>
</div>
</body>
</html>
It doesn't show in the table and the url is just changing to http://localhost/Soft/displayitems.php?action=add&id=1 and the page is blank
because of you using form and the button type is submit so it's expecting a callback function. Regarding you don't have one and you want to display everything in the same page so you have instead to make the submit functionality to a link instead.
Change :
<button type='submit' name='add'>Add to cart</button>
to
<a type='submit' name='add'>Add to cart</a>
or
<input type="submit" value="Add to cart">
here is a mozilla ref
I don't get any errors but I can't update MySQL PHP. I want to change dropdown status from "sedang diproses" dropdown into "Berjaya or Tidak Berjaya". Also I can't change in the database "sedang diproses" into "Berjaya or Tidak Berjaya"
This is my Code Html
<?php
session_start();
include ('include/myFunction.php');
require('include/connect.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<link href="css/myStyle.css" rel="stylesheet" type="text/css" />
<link href="css/myStyle1.css" rel="stylesheet" type="text/css" />
<!-- Button to open the modal login form -->
<link href="css/myStyle3.css" rel="stylesheet" type="text/css" />
<body>
<div align="right">
<a href="logout.php" ><img src="img/logout.png" width="63" height="46" /></a>
</div>
<div class="header" align="left"><img src="img/gmbar.PNG" width="223" height="126" /><!-- end .header --><!-- end .header --></div>
<div class="content" style="font:Verdana, Geneva, sans-serif">
<div class="content" style="font:Verdana, Geneva, sans-serif">
<div class="topnav" id="myTopnav" style="font-family:Verdana, Geneva, sans-serif">Kembali
</div>
<p> </p>
<?php if($_SESSION['namaadmin'] ==null)
{
header('location:index.php');
}
else
{
?>
<form action="prosesstatus.php" method="post">
<table width="1002" height="87" border="0" align="center" bgcolor="#CCCCFF">
<tr bgcolor="#00CCFF">
<td width="30"><strong>Bil</strong></td>
<td width="298"><strong>Nama</strong></td>
<td width="176"><strong>Nama Kursus</strong></td>
<td width="150"><strong>Tarikh Daftar</strong></td>
<td width="150"><strong>Status</strong></td>
<td width="168"><strong>Kemaskini Status</strong></td>
<td width="131"><strong>Pilihan</strong></td>
</tr>
<?php
$namakursus = '';
if( isset( $_GET['namakursus'])) {
$namakursus = $_GET['namakursus'];
}
$sql1 = "Select * from pemohonan INNER JOIN kursus ON pemohonan.idkursus = kursus.idkursus
INNER JOIN pemohon ON pemohonan.idPemohon = pemohon.idPemohon WHERE kursus.namakursus = '$namakursus' ";
$result1=mysqli_query($dbc,$sql1) or die (mysqli_error());
$i=1;
while($row1 = mysqli_fetch_assoc($result1))
{
?>
<tr>
<td><strong><?php echo $i; ?><input name="idkursus" type="hidden" size="50" value="<?php echo $row1['idkursus'];?>"/><input name="idPemohonan" type="hidden" size="50" value="<?php echo $row1['idPemohonan'];?>"/></strong></td>
<td><strong><?php echo $row1['nama']; ?></strong><input name="id" type="hidden" size="50" value="<?php echo $row1['idPemohon'];?>"/></strong></td>
<td><strong><?php echo $row1['namakursus']; ?></strong></td>
<td><strong><?php echo $row1['tarikhpemohon']; ?></strong></td>
<td><strong><?php echo $row1['status']; ?></strong></td>
<td><select name="status" value="<?php echo $row1['status']; ?>">
<option value="sila pilih">-Sila Pilih-</option>
<option value="Berjaya">Berjaya</option>
<option value="Tidak Berjaya">Tidak Berjaya</option>
</select></td>
<td><input name="btnKemaskini" type="submit" value="Kemaskini" /></td>
</tr>
<?php
$i++;
}
mysqli_close($dbc);
}
?>
</table></form>
<p> </p>
<p> </p>
<div class="footer" style="font-family:Arial, Helvetica, sans-serif">
<?php footertext(); ?>
</div>
</body>
</html>
This is Image
This Is My Image DB
This is my Code Php
<?php
require ('include/connect.php');
$idPemohonan = '';
$idPemohon = '';
$idkursus = '';
if (isset($_GET['idPemohon'],$_GET['idkursus'],$_GET['idPemohonan']))
{
$idPemohon = $_GET['idPemohon'];
$idkursus = $_GET['idkursus'];
$idPemohonan = $_GET['idPemohonan'];
}
$tarikhharini=date('y-m-d');
$status=$_POST['status'];
$sql1 = "UPDATE pemohonan SET idPemohonan ='$idPemohonan' , idPemohon ='$idPemohon' , idkursus ='$idkursus' , tarikhpemohon ='$tarikhharini' , status='$status'
where idPemohonan = '$idPemohonan' and idPemohon = '$idPemohon'";
$result1 = mysqli_query($dbc,$sql1) or die (mysqli_error());
$num_row1 = mysqli_affected_rows($dbc);
echo "<script language=\"JavaScript\">\n";
echo "alert('Status Pemohonan Telah Dihantar!');\n";
echo "window.location='senaraipemohon.php'";
echo "</script>";
mysqli_close($dbc);
?>
Your code is not working because you haven't sent in
<form action="prosesstatus.php" method="post">
Parameters:
$idPemohon = $_GET['idPemohon'];
$idkursus = $_GET['idkursus'];
$idPemohonan =
$_GET['idPemohonan'];
If you want use $_GET link should look like:
prosesstatus.php?idPemohon=value&idkursus=value&idPemohonan=value
Or you should add these parameters in
Input type hidden and change in php to $_POST
I agree with others than you should use MVC for example some kind of framework (Laravel, CodeIgniter)
Or separate as much as possible php and html because your code looks unprofessional.
Your MySQL queries are vulnerable to SQL injection and most likely file
include/connect.php
is not outside public folder which is not good practice to do.
I have a shopping cart that displays the different products the customer has selected to purchase. I need to INSERT each product selected as a single row with the same customer_id in the 'order_details' table.
Screenshot
code
<?php
session_start();
#mysql_connect("localhost","root","") or die("Could not connect to database");
#mysql_select_db("bookstore") or die("Could not select database");
$connection = mysqli_connect('localhost', 'root', '', 'bookstore');
include("admin/php/myFunctions.php");
$customer = $_SESSION['id_login'];
$order = $_SESSION['id_login'];
if(!empty($_GET['prodid'])){
$pid = $_GET['prodid'];
$wasFound = false;
$i = 0;
if(!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1){
$_SESSION["cart_array"]=array(0=>array("productID"=>$pid,"quantity"=>1));
}else{
foreach($_SESSION["cart_array"] as $each_product){
$i++;
while(list($key,$value)=each($each_product)){
if($key=="productID" && $value==$pid){
array_splice($_SESSION["cart_array"],$i-1,1,array(array("productID"=>$pid,"quantity"=>$each_product ['quantity']+1)));
$wasFound=true;
}
}
}
if($wasFound==false){
array_push($_SESSION["cart_array"],array("productID"=>$pid,"quantity"=>1));
}
}
header("location:shoppingcart.php");
exit();
}
//-------------------------------------------------------------------------------------------------
#$submit = $_POST['btnUpdate'];
if($submit == "Update"){
$x = 0;
//echo $_POST['txtQuan2'];
//echo $_POST['txtHoldProdId0'];
foreach($_SESSION["cart_array"] as $each_product){
$i++;
$quantity = $_POST['txtQuan'.$x];
$prodStock = $_POST['txtHoldQuan'.$x];
$prodAdjustId = $_POST['txtHoldProdId'.$x++];
if($quantity<1){ $quantity = 1; }
if($quantity>$prodStock){ $quantity = $prodStock; }
while(list($key,$value)=each($each_product)){
array_splice($_SESSION["cart_array"],$i-1,1,array(array("productID"=>$prodAdjustId,"quantity"=>$quantity)));
}
}
}
//-------------------------------------------------------------------------------------------------
if(!empty($_GET['cid']) || isset($_GET['cid'])){
$removeKey = $_GET['cid'];
if(count($_SESSION["cart_array"])<=1){
unset($_SESSION["cart_array"]);
}else{
unset($_SESSION["cart_array"]["$removeKey"]);
sort($_SESSION["cart_array"]);
}
}
//-------------------------------------------------------------------------------------------------
$cartTitle = "";
$cartOutput = "";
$cartTotal = "";
if(!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1){
$cartOutput="<h2 align='center'> Your shopping cart is empty </h2>";
}else{
$x = 0;
$cartTitle .= '<form name="shoppingcart_form" action="shoppingcart.php" method="post" /><table width="700px" cellspacing="0" cellpadding="5">
<tr bgcolor="#CCCCCC">
<th width="220" align="left">Image </th>
<th width="140" align="left">Name </th>
<th width="100" align="center">Quantity </th>
<th width="60" align="center">Stock </th>
<th width="60" align="right">Price </th>
<th width="60" align="right">Total </th>
<th width="90"> </th></tr>';
#Values in here need to go into database "order_details" table
$i = 0;
foreach($_SESSION["cart_array"] as $each_product){
$product_id = $each_product['productID'];
$sql=mysql_query("select * from tblproduct where prod_id='$product_id' limit 1");
while($row=mysql_fetch_array($sql)){
$prodNo = $row["prod_no"];
$prodID = $row["prod_id"];
$prodName = $row["prod_name"];
$prodPrice = $row["prod_price"];
$prodQuan = $row["prod_quan"];
}
$pricetotal=$prodPrice*$each_product['quantity'];
$cartTotal= number_format($pricetotal+$cartTotal,2);
$cartOutput .= '<tr><td><img style="border: 2px solid;" src="images/product/'.$prodNo.'.jpg" width="150" height="120" /></td>
<td>'.$prodName.'</td>
<td align="center"><input type="hidden" name="txtHoldProdId'.$i.'" value="'.$prodID.'" /><input name="txtQuan'.$i.'" type="text" value="'.$each_product['quantity'].'" style="width: 40px; text-align: center" /> </td>
<td align="center"><input type="hidden" name="txtHoldQuan'.$i.'" value="'.$prodQuan.'" /> '.$prodQuan .' pcs</td>
<td align="right">R '.$prodPrice.'</td>
<td align="right">R '.$pricetotal.'</td>
<td align="center"> <img src="images/remove_x.gif" alt="remove" /><br />Remove </td></tr>';
}
$_SESSION['checkoutCartTotal'] = $cartTotal;
$cartOutput .= '<tr>
<td colspan="3" align="right" height="40px">Have you modified your basket? Please click here to <input class="btn_upd" type="submit" name="btnUpdate" value="Update" /> </td>
<td align="right" style="background:#ccc; font-weight:bold"> Total: </td>
<td colspan="2" align="left" style="background:#ccc; font-weight:bold;">R '.$cartTotal.' </td>
<td style="background:#ccc; font-weight:bold"> </td>
</tr>
</table>
<div style="float:right; width: 215px; margin-top: 20px;">
</form>
</div></form>';
}
//---------------------------------------------------
$cTotal = $_SESSION['checkoutCartTotal'];
#$cName = $_POST['cardName'];
#$cNumber = $_POST['cardNum'];
#$cAdress = $_POST['cusAddress'];
#$cCity = $_POST['cusCity'];
#$cEmail = $_POST['cusEmail'];
#$cPhone = $_POST['cusPhone'];
foreach($_SESSION["cart_array"] as $each_product){
$product_id = $each_product['productID'];
$sql=mysql_query("select * from tblproduct where prod_id='$product_id' limit 1");
while($row=mysql_fetch_array($sql)){
$ProdID = $row["prod_id"];
$prodPrice = $row["prod_price"];
$ProdQuan = $row["prod_quan"];
}
$sqlinsert2 = ("INSERT INTO order_details (`order_id`, `prod_id`, `cus_id`, `quantity`, `price_per_unit`) VALUES ('$order', '$ProdID', '$customer', '$ProdQuan', '$prodPrice')");
}
$sqlinsert = "INSERT INTO tbl_order (`total_price`, `credit_card_number`, `fname`, `email`, `address`, `phone`, `city`,`date_ordered`) VALUES ('$cTotal','$cNumber', '$cName', '$cEmail', '$cAdress', '$cPhone', '$cCity',now())";
if (!mysqli_query($connection, $sqlinsert)) {
die(mysqli_error($connection));
}
$newrecord = "Thank you for making your purchase!";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Great Selling Book Store</title>
<link href="css/slider.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/ddsmoothmenu.css" />
<link rel="stylesheet" type="text/css" href="css/styles.css" />
<script language="javascript" type="text/javascript">
function clearText(field)
{
if (field.defaultValue == field.value) field.value = '';
else if (field.value == '') field.value = field.defaultValue;
}
</script>
</head>
<body id="subpage">
<div id="main_wrapper">
<div id="main_header">
<div id="site_title"><h1>Great Selling book Store</h1></div>
<div id="header_right">
<div id="main_search">
<form action="products.php" method="get" name="search_form">
<input type="text" value="Search" name="keyword" onfocus="clearText(this)" onblur="clearText(this)" class="txt_field" />
<input type="submit" name="Search" value="" alt="Search" id="searchbutton" title="Search" class="sub_btn" />
</form>
</div>
</div> <!-- END -->
</div> <!-- END of header -->
<div id="main_menu" class="ddsmoothmenu">
<ul>
<li>Home</li>
<li>Books</li>
<li><a class="selected" href="shoppingcart.php">Cart</a></li>
<li>About</li>
</ul>
<br style="clear: left" />
</div> <!-- end of menu -->
<div class="cleaner h20"></div>
<div id="main_top"></div>
<div id="main">
<div id="sidebar">
<h3>Categories</h3>
<ul class="sidebar_menu">
<li>Children</li>
<li>Horror</li>
<li>Thriller</li>
</ul>
</div> <!-- END of sidebar -->
<div id="content">
<?php echo $cartTitle; ?>
<?php echo $cartOutput; ?>
</div> <!-- end of content -->
<div class="cleaner">
<form method ="post" action="shoppingcart.php">
<input type="hidden" name="submitted" value= "true" />
<fieldset>
<legend>Customer Checkout</legend>
<label>Enter your name as it is on the credit card: <input type="text" name="cardName"></label>
<label>Card Number: <input type="text" name="cardNum"></label>
<label>Adress: <input type="text" name="cusAddress"></label>
<label>City: <input type="text" name="cusCity"></label>
<label>Email: <input type="text" name="cusEmail"></label>
<label>Please, specify your reachable phone number. YOU MAY BE GIVEN A CALL TO VERIFY AND COMPLETE THE ORDER: <input type="text" name="cusPhone"></label>
</fieldset>
<div class="cleaner h50"></div>
<td> <input type="submit" class="more" value="Checkout!"></td>
</form>
</div>
</div> <!-- END of main -->
<?php
echo #$newrecord;
?>
<div id="main_footer">
<div class="cleaner h40"></div>
<center>
Copyright © 2048 DigitalNinja
</center>
</div> <!-- END of footer -->
</div>
<script type='text/javascript' src='js/logging.js'></script>
</body>
</html>
Below example for multiple inserts in a single query and its faster,
INSERT INTO example
(example_id, name, value, other_value)
VALUES
(100, 'Name 1', 'Value 1', 'Other 1'),
(101, 'Name 2', 'Value 2', 'Other 2'),
(102, 'Name 3', 'Value 3', 'Other 3'),
(103, 'Name 4', 'Value 4', 'Other 4');
Your Code with multiple insert option:
foreach($_SESSION["cart_array"] as $each_product){
$product_id = $each_product['productID'];
$sql=mysql_query("select * from tblproduct where prod_id='$product_id' limit 1");
while($row=mysql_fetch_array($sql)){
$Prods .= '('.$order.
','.$row["prod_id"].
','. $order.
','.$row["prod_quan"].
','.$row["prod_price"].
'),';//if text: ',"'.$row["prod_quan"].'"),';
}
$Prods = rtrim($Prods, ',');// this is to remove last comma from multiple inserts
$sqlinsert2 = ("INSERT INTO order_details (`order_id`, `prod_id`, `cus_id`, `quantity`, `price_per_unit`) VALUES $Prods");
mysql_query($sqlinsert2);
}
NOTE: you are not running mysql_query of insert, so it's not inserting data into the database.
WARNING: You should use mysqli with parameterized queries and you have created a severe SQL injection bug
i have a wordpress website and with customization (cache/minify/database), is really quick in frontend, and in backend, with one exception. I use a plugin where it stores and retrieves players stats, carreers, teams etc.
When saving the team's match player's statistics, it needs 5 minutes to show the page reloaded with the data.
Also when retrieving for example team's season data, it also needs a lot of time to show them.
From what i ve seen, it is related with two of my files that do all the work. tournament_match.php, and functions.php. From hosting they said that it gets all tha database and thats why it is so slow
Here is the tournament_match file
<?php
global $wpdb;
global $msg;
$page = $_GET['page'];
$tournament_id = $_GET['tid'];
$match_id = $_GET['mid'];
$league_type = leagueengine_fetch_data_from_id($tournament_id,'league_type');
if(isset($_POST['home_team_bonus']) or isset($_POST['away_team_bonus'])) {
if(isset($_POST['save_tournament_match'])) { leagueengine_save_tournament_match($tournament_id,$match_id,$_POST['date_alt'],$_POST['time_alt'],$_POST['home_team_id'],$_POST['away_team_id'],$_POST['home_team_score'],$_POST['away_team_score'],$_POST['home_team_bonus'],$_POST['away_team_bonus']); }
} else {
if(isset($_POST['save_tournament_match'])) { leagueengine_save_tournament_match($tournament_id,$match_id,$_POST['date_alt'],$_POST['time_alt'],$_POST['home_team_id'],$_POST['away_team_id'],$_POST['home_team_score'],$_POST['away_team_score']); }
}
if(isset($_POST['save_attributes'])) { leagueengine_save_attribute_values('tournament_match',NULL,NULL,$match_id,NULL,NULL,$tournament_id); }
if(isset($_POST['add_event_to_match'])) { error_reporting(0); leagueengine_add_event_to_tournament_match($tournament_id,$match_id,$_POST['new_event_id'],$_POST['new_event_time'],$_POST['timeline_text'],$_POST['new_event_count'],$_POST['new_event_player_id']); error_reporting(1); }
if(isset($_POST['save_events'])) { leagueengine_save_event_times('tournament_match',$_POST['event_time_id'],$_POST['event_time'],$_POST['event_text']); }
if(isset($_POST['add_home_event_to_match'])){
error_reporting(0);
foreach($_POST as $key=>$val){
$val=intval($val);
if(is_int($val)&&$val>0){
$data=explode('-',$key);
$playerid=$data[1];
$eventid=$data[2];
leagueengine_add_event_to_tournament_match2($tournament_id,$match_id,$eventid,$_POST['new_event_time'],$_POST['timeline_text'],$val,$playerid);
}
}
error_reporting(1);
}
if(isset($_POST['add_away_event_to_match'])){
error_reporting(0);
foreach($_POST as $key=>$val){
$val=intval($val);
if(is_int($val)&&$val>0){
$data=explode('-',$key);
$playerid=$data[1];
$eventid=$data[2];
leagueengine_add_event_to_tournament_match2($tournament_id,$match_id,$eventid,$_POST['new_event_time'],$_POST['timeline_text'],$val,$playerid);
}
}
error_reporting(1);
}
if(isset($_POST['save_tournament_match_lineups'])) {
if(isset($_POST['homeplayers'])) { $homeplayers = $_POST['homeplayers']; } else { $homeplayers = ''; }
if(isset($_POST['awayplayers'])) { $awayplayers = $_POST['awayplayers']; } else { $awayplayers = ''; }
if(isset($_POST['homesubs'])) { $homesubs = $_POST['homesubs']; } else { $homesubs = ''; }
if(isset($_POST['awaysubs'])) { $awaysubs = $_POST['awaysubs']; } else { $awaysubs = ''; }
leagueengine_save_tournament_match_lineups($tournament_id,$match_id,$homeplayers,$awayplayers,$homesubs,$awaysubs);
}
if(isset($_POST['delete_events'])) { leagueengine_delete_data('tournament_match_event',$_POST['delete_id'],'tournament',NULL,NULL,$tournament_id,$match_id); }
if(isset($_POST['save_match_statistics'])) { leagueengine_save_tournament_match_statistics($tournament_id,$match_id,$_POST['tournament_match_statistic'],$_POST['home_value'],$_POST['away_value'],$_POST['att_type']); }
if(isset($_POST['save_tournament_match_preview'])) { leagueengine_save_tournament_match_preview($tournament_id,$match_id,stripslashes_deep($_POST['match_preview'])); }
if(isset($_POST['save_tournament_match_report'])) { leagueengine_save_tournament_match_report($tournament_id,$match_id,stripslashes_deep($_POST['match_report'])); }
if(isset($_POST['tournament_match_swap'])) { leagueengine_tournament_match_swap($tournament_id,$match_id); }
$table = $wpdb->prefix . 'leagueengine_tournament_matches';
$match = $wpdb->get_row("SELECT * FROM $table WHERE tournament_id = '$tournament_id' AND id = '$match_id'");
$home_team_id = $match->home_team_id;
$away_team_id = $match->away_team_id;
$tournament = leagueengine_fetch_data_row('tournament',$tournament_id);
$table2 = $wpdb->prefix . 'leagueengine_tournaments';
$tournament_row = $wpdb->get_row("SELECT * FROM $table2 WHERE data_id = '$tournament_id'");
?>
<div id="leagueengine_admin" class="<?php echo $page; ?>">
<?php echo leagueengine_admin_header(); ?>
<div id="leagueengine_admin_content">
<?php if($msg) { echo $msg; } ?>
<ul class="breadcrumbs">
<li><?php _e('Competitions','leagueengine');?> <span class="divider">/</span></li>
<li><?php echo leagueengine_fetch_data_from_id($tournament_id,'data_value') ?> <span class="divider">/</span></li>
<?php if($match->round == 'GROUP') { ?>
<li><?php _e('Groups','leagueengine');?> <span class="divider">/</span></li>
<?php } else { ?>
<li><?php _e('Knockout','leagueengine');?> <span class="divider">/</span></li>
<?php } ?>
<li><?php _e('Match','leagueengine');?></li>
</ul>
<?php
if($league_type == 'players') {
$home_emblem = leagueengine_fetch_player_emblem($match->home_team_id,20);
$away_emblem = leagueengine_fetch_player_emblem($match->away_team_id,20,'right');
} else {
$home_emblem = leagueengine_fetch_team_emblem($match->home_team_id,20);
$away_emblem = leagueengine_fetch_team_emblem($match->away_team_id,20,'right');
}
?>
<div class="match_masthead">
<table>
<tr>
<td class="home_team" style="border-top: 5px solid <?php echo leagueengine_fetch_team_colour($match->home_team_id,'primary');?>; text-align:left;width:40%;"><?php echo $home_emblem . leagueengine_fetch_data_from_id($match->home_team_id,'data_value');?></td>
<td class="score" style="text-align:center;width:20%;"><span><?php echo $match->home_team_score;?> ‐ <?php echo $match->away_team_score;?></span></td>
<td class="away_team" style="border-top: 5px solid <?php echo leagueengine_fetch_team_colour($match->away_team_id,'primary');?>; text-align:right;width:40%;"><?php echo leagueengine_fetch_data_from_id($match->away_team_id,'data_value') . $away_emblem;?></td>
</tr>
<tr>
<td colspan="3" style="text-align:center;"><?php echo date(leagueengine_fetch_settings('date_format_php'),strtotime($match->match_date)) . ' ' . date(leagueengine_fetch_settings('time_format_php'),strtotime($match->match_time)); ?></td>
</tr>
<tr>
<td class="competition" colspan="3" style="text-align:center;"><?php echo '' . leagueengine_fetch_data_from_id($tournament_id,'data_value') . ''; ?></td>
</tr>
<tr><td colspan="100%" style="text-align:center;padding-bottom:20px;"><?php echo leagueengine_link('tournament_match&tid='.$tournament_id.'&mid='.$match->id,__('Go To Match','leagueengine'),'','','button-primary'); ?></td></tr>
</table>
</div>
<div id="leagueengine_tabs">
<ul>
<li><?php _e('Score','leagueengine');?></li>
<?php
$table = $wpdb->prefix . 'leagueengine_player_careers';
$homeplayers = $wpdb->get_results("SELECT * FROM $table WHERE tournament_id = '$tournament_id' AND team_id = '$home_team_id'");
$awayplayers = $wpdb->get_results("SELECT * FROM $table WHERE tournament_id = '$tournament_id' AND team_id = '$away_team_id'");
if($homeplayers or $awayplayers && $league_type != 'players') {
?>
<li><?php _e('Lineups','leagueengine');?></li>
<?php } ?>
<?php if(leagueengine_data_exists('event')) { echo '<li>' . __('Events','leagueengine') . '</li>'; } ?>
<?php if(leagueengine_statistics_exists('tournament_match')) { echo '<li>' . __('Statistics','leagueengine') . '</li>'; } ?>
<?php if(leagueengine_h2h_history($match->match_date,$home_team_id,$away_team_id)) { echo '<li>' . __('History','leagueengine') . '</li>'; } ?>
<li><?php _e('Report','leagueengine');?></li>
</ul>
<div id="score">
<form action="" method="POST">
<table class="form">
<tr>
<th style="width:20%;"><?php _e('Date/Time','leagueengine');?></th>
<th style="width:30%;text-align:center;"><?php _e('Home','leagueengine');?></th>
<th style="width:20%;text-align:center;"><?php _e('Score','leagueengine');?></th>
<th style="width:30%;text-align:center;"><?php _e('Away','leagueengine');?></th>
</tr>
<tr class="date">
<td><input type="text" class="leagueengine_datepicker" name="match_date" value="<?php echo date(leagueengine_fetch_settings('date_format_php'),strtotime($match->match_date));?>"></td>
<td colspan="3"></td>
</tr>
<input type="hidden" name="tournament_match_id" value="<?php echo $match->id;?>">
<input type="hidden" name="home_team_id" value="<?php echo $match->home_team_id;?>">
<input type="hidden" name="away_team_id" value="<?php echo $match->away_team_id;?>">
<input type="hidden" name="date_alt" class="leagueengine_datepicker_alt" value="<?php echo $match->match_date;?>">
<input type="hidden" name="time_alt" class="leagueengine_timepicker_alt" value="<?php echo $match->match_time;?>">
<tr>
<td><input type="text" class="leagueengine_timepicker" name="match_time" value="<?php echo date(leagueengine_fetch_settings('time_format_php'),strtotime($match->match_time));?>"></td>
<td style="text-align:center;"><?php echo leagueengine_fetch_data_from_id($match->home_team_id,'data_value') ;?></td>
<td style="text-align:center;">
<input style="width:48%;text-align:center;" type="text" name="home_team_score" value="<?php echo $match->home_team_score;?>">
<input style="width:48%;text-align:center;" type="text" name="away_team_score" value="<?php echo $match->away_team_score;?>">
</td>
<td style="text-align:center;"><?php echo leagueengine_fetch_data_from_id($match->away_team_id,'data_value') ;?></td>
</tr>
<?php if($tournament_row->pts_bonus == 'on') { ?>
<tr>
<td></td>
<td style="text-align:center;"><?php _e('Bonus Points','leagueengine');?></td>
<td style="text-align:center;">
<input style="width:48%;text-align:center;" type="text" name="home_team_bonus" value="<?php echo $match->home_team_bonus;?>">
<input style="width:48%;text-align:center;" type="text" name="away_team_bonus" value="<?php echo $match->away_team_bonus;?>">
</td>
<td style="text-align:center;"><?php _e('Bonus Points','leagueengine');?></td>
</tr>
<?php } ?>
</table>
<input style="margin-top:20px;" type="submit" name="save_tournament_match" class="button-primary" value="<?php _e('Save','leagueengine');?>" />
<input style="margin:20px 0 0 10px;" type="submit" name="tournament_match_swap" class="button" value="<?php _e('Swap Teams','leagueengine');?>" style="float:right;margin-right:10px;" />
</form>
</div>
<?php
$table = $wpdb->prefix . 'leagueengine_player_careers';
$homeplayers = $wpdb->get_results("SELECT * FROM $table WHERE tournament_id = '$tournament_id' AND team_id = '$home_team_id'");
$awayplayers = $wpdb->get_results("SELECT * FROM $table WHERE tournament_id = '$tournament_id' AND team_id = '$away_team_id'");
if($homeplayers or $awayplayers && $league_type != 'players') {
?>
<div id="lineups">
<?php echo leagueengine_tournament_match_lineups($tournament_id,$match_id);?>
</div>
<?php } ?>
<?php if(leagueengine_data_exists('event')) { ?>
<div id="events">
<?php echo leagueengine_tournament_match_events($tournament_id,$match_id);?>
</div>
<?php } ?>
<?php if(leagueengine_statistics_exists('tournament_match')) { ?>
<div id="statistics">
<?php echo leagueengine_fetch_statistics('tournament_match',NULL,NULL,$tournament_id,$match_id);?>
</div>
<?php } ?>
<?php if(leagueengine_h2h_history($match->match_date,$home_team_id,$away_team_id)) { ?>
<div id="history">
<?php echo leagueengine_fetch_h2h_history($match->match_date,$home_team_id,$away_team_id);?>
</div>
<?php } ?>
<div id="report">
<form action="" method="post">
<div class="setting">
<table class="form">
<tr><th><?php _e('Match Report','leagueengine');?></th></tr>
</table>
<?php wp_editor( stripslashes_deep($match->report), 'match_report', array( 'media_buttons' => true, 'tinymce' => true, 'quicktags' => true, 'textarea_rows' => 20 )); ?>
</div>
<input style="margin-top:20px;" type="submit" name="save_tournament_match_report" class="button-primary" value="<?php _e('Save','leagueengine'); ?>">
</form>
</div>
</div>
</div>
</div>
</div>
Hi i am retrieving data from database using pagination which i am able to retrieve but i am facing problem that in my pagination next and last button is not working
here is my code
** index.php**
<script type="text/javascript">
function searchboxfun(numRecords, pageNum ) {
$.ajax({
type: "GET",
url: "usersearchboxresult.php?search=" + document.getElementById("UserSearchBox").value,
data: "show="+numRecords+"&pagenum="+pageNum,
cache: false,
beforeSend: function () {
$('#content').html('<img src="loader.gif" alt="" width="24" height="24" style=" padding-left:469px;">');
},
success: function(html) {
$("#RightPaneContainerDiv").html( html );
}
});
return false;
}
function changeDisplayRowCount(numRecords) {
searchboxfun(numRecords, 1);
}
$( document ).ready(function() {
searchboxfun(10, 1);
});
</script>
<form name="myForm" id="Myform" action="#" onsubmit="return searchboxfun(); ">
<input type="text" id="UserSearchBox" name="UserSearchBox" style="width: 95%; margin-top: 15px; margin-left: 2%;" placeholder="Search Box"/>
<div style="float: right; margin-right: 2%; margin-top: 0px;">
<input type="submit" name="Search" value="Search" id="search" onclick='searchboxfun();'>
</div>
</form>
usersearchboxresult.php
<?php
session_start();
?>
<head>
<style>
.hidden { display: none; }
</style>
<link rel="stylesheet" type="text/css" href="styles.css" />
<script language="javascript" src="users.js" type="text/javascript"></script>
<script src="jquery.js"></script>
</head>
<?php
require_once("configure.php");
// Very important to set the page number first.
if (!(isset($_GET['pagenum']))) {
$pagenum = 1;
} else {
$pagenum = $_GET['pagenum'];
}
//Number of results displayed per page by default its 10.
$page_limit = ($_GET["show"] <> "" && is_numeric($_GET["show"]) ) ? $_GET["show"] : 10;
// Get the total number of rows in the table
//$sql = "SELECT * FROM tbl_pagination WHERE 1" ;
$search=$_GET['search'];
$eid=$_SESSION['eid'];
$sql="select * from clientreg where eid=$eid and (mobile like '%$search%' or fname like '%$search%' or service like '%$search%')";
//$select_table = "";
$cnt = mysql_num_rows( mysql_query($sql))or die("There is no record in Database!");
//Calculate the last page based on total number of rows and rows per page.
$last = ceil($cnt/$page_limit);
//this makes sure the page number isn't below one, or more than our maximum pages
if ($pagenum < 1) {
$pagenum = 1;
} elseif ($pagenum > $last) {
$pagenum = $last;
}
$lower_limit = ($pagenum - 1) * $page_limit;
$sql2 = $sql . " limit ". ($lower_limit)." , ". ($page_limit). " ";
$rs = mysql_query($sql2);
?>
<form name="frmUser" method="post" action="">
<div style="width:98%; margin-left:20px;">
<table border="0" cellpadding="10" cellspacing="1" width="100%" class="tblListForm">
<?php
$j=0;
$countleadmodified=array();
$countResult = 0;
while ( $row = mysql_fetch_array($rs) ) {
<tr>
<td><input type="checkbox" name="users[]" class="users" value="<?php echo $row["id"]; ?>" ></td>
<td>✰</td>
<td><?php echo $_SESSION['user'];?></td>
<td><?php echo $row["fname"];?></td>
<td><?php echo $row["lname"];?></td>
<td><?php echo $row["mobile"];?></td>
</tr>
<?php
$j++;
}
?>
</table>
</div>
</form>
<div id="paging">
<div class="height30"></div>
<table width="50%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr>
<td valign="top" align="left">
<label> Rows Limit:
<select name="show" onChange="changeDisplayRowCount(this.value);">
<option value="10" <?php if ($_GET["show"] == 10 || $_GET["show"] == "" ) { echo ' selected="selected"'; } ?> >10</option>
<option value="20" <?php if ($_GET["show"] == 20) { echo ' selected="selected"'; } ?> >20</option>
<option value="30" <?php if ($_GET["show"] == 30) { echo ' selected="selected"'; } ?> >30</option>
</select>
</label>
</td>
<td valign="top" align="center" >
<?php
if ( ($pagenum-1) > 0) {
?>
First
Previous
<?php
}
//Show page links
for($i=1; $i<=$last; $i++) {
$j=1;
if ($i == $j) {
?>
<!--<a href="javascript:void(0);" class="selected" ><?php echo $i ?></a>-->
<?php
} else {
?>
<a href="javascript:void(0);" class="hidden" onclick="displayRecords('<?php echo $page_limit; ?>', '<?php echo $i; ?>');" ><?php echo $i ?></a>
<?php
}
$j++;}
if ( ($pagenum+1) <= $last) {
?>
Next
<?php } if ( ($pagenum) != $last) { ?>
<a href="javascript:void(0);" onclick="displayRecords('<?php echo $page_limit; ?>', '<?php echo $last; ?>');" class="links" >Last</a>
<?php
}
?>
</td>
<td align="right" valign="top">
Page <?php echo $pagenum; ?> of <?php echo $last; ?>
</td>
</tr>
</table>
</div>
here i this code i am able to retrive data from data base but any pagination is not working
where i am wrong how can i achieve my goal
Any help will be appreciated