Login   Register  
PHP Classes
elePHPant
Icontem

File: index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Roland Burda  >  PQuery  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PQuery
Generate Javascript to send jQuery AJAX requests
Author: By
Last change:
Date: 4 years ago
Size: 2,078 bytes
 

Contents

Class file image Download
<?php
// you understand this....
require_once('inc.pquery.class.php');

// initiate the class
$pq = new pquery;

/**
 * tabla - SQL
 **/

/*
-- 
-- Tábla szerkezet: `adatok`
-- 

CREATE TABLE `adatok` (
  `mediatorid` int(4) NOT NULL,
  `nev` varchar(30) default NULL,
  KEY `mediatorid` (`mediatorid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

-- 
-- Tábla adatok: `adatok`
-- 

INSERT INTO `adatok` VALUES (1, 'asdasdas');
INSERT INTO `adatok` VALUES (2, 'asdasdasd 2');
INSERT INTO `adatok` VALUES (3, 'asdasda');
*/

// DB connect
$conn mysql_connect("localhost","root","rhqq2x");
        
mysql_select_db("tabla");
?>
<!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=iso-8859-2" />
<title>PQuery example</title>
<?php
$pq
->write_jquery();
?>
<script language="javascript" src="jquery.color.js"></script>
<?php
$pq
->pjq('
function remove_row(id) {
    $("#response").show();
    $("#adat_"+id).animate({ backgroundColor : "#FFFFAE" }, "slow").fadeOut("slow");
    
    setTimeout(function() { $("#response").fadeOut(); }, 2000);
}
'
);
?>
</head>

<body>
<table width="300" cellpadding="0" cellspacing="0" id="tabla">
    <tr>
        <td>Name</td>
        <td>Remove</td>
    </tr>
    <?php
    $adat 
mysql_query("SELECT * FROM adatok");
    
    while(
$a mysql_fetch_assoc($adat)){
    
?>
    <tr id="adat_<?php echo $a['mediatorid']; ?>">
        <td><?php echo $a['nev']; ?></td>
        <td><input type="button" onclick="<?php $pq->pget('process.php?delete=true&id='.$a['mediatorid'],'Are you sure?','response','remove_row('.$a['mediatorid'].')'); ?>" value="Let's remove it!"/></td>
    </tr>
    <?php
    
}
    
?>
</table>
<div id="response"></div>
<br/><br/>
<input type="button" onclick="<?php $pq->pload('teszt.php?q=blabla','webpage'); ?>" value="Make request"/>
<div id="webpage" style="width:900px; height:450px;"></div>
</body>
</html>