Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
comman php file for all template
11/11/2009
07:14
Avatar
ram nihor singh
Guest
Guests

hii......

i want to create comman php file which is pass in url for all templates.i have written jquery code in all templates for different listing.i have got only one column data rather than whole data that is main problem any one help me for resolve it.my code is..

<?php

$page = $_GET['page']; // get the requested page
$limit = $_GET['rows']; // get how many rows we want to have into the grid
$sidx = $_GET['sidx']; // get index row - i.e. user click to sort
$sord = $_GET['sord']; // get the direction
$table_name=$_GET['tbname'];
$colname=explode(",",$_GET['col']);
//$colname1=$colname[0];
if(!$sidx) $sidx =1;
// connect to the database
$db = mysql_connect('localhost','root','')
or die("Connection Error: " . mysql_error());

mysql_select_db('ourhealt_ourhdb') or die("Error conecting to db.");
$result = mysql_query("SELECT COUNT(*) AS count FROM $table_name");
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$count = $row['count'];

if( $count >0 ) {
    $total_pages = ceil($count/$limit);
} else {
    $total_pages = 0;
}
if ($page > $total_pages) $page=$total_pages;
$start = $limit*$page - $limit; // do not put $limit*($page - 1)
$SQL = "SELECT * FROM $table_name ORDER BY $sidx $sord LIMIT $start , $limit";
$result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error());

$responce->page = $page;
$responce->total = $total_pages;
$responce->records = $count;

$i=0;
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
   
    //$responce->rows[$i]['id']=$row[id];
    for($m=0;$m<count($colname);$m++)
    {
      $responce->rows[$i]['cell']=array($row[$colname[$m]]);
      $i++;
}  

}    
echo json_encode($responce);

?>

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
63 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information