Tuesday, 9 April 2013
//for js
$("select.gw").live("change",function()
{
var gpid = $(this).attr("data");
var thid = $(this).attr("id");
var gwid = $("select#"+thid+" option:selected").val();
var tmpp = "select#"+thid+" option:selected";
if(gwid!='')
{
$.post("ajax/dropdown.php", { gwid: gwid },
function(data) {
$("select#"+gpid).attr("disabled",false);
$("select#"+gpid).html(data);
});
}
else
{
$("select#"+gpid).html("");
$("select#"+gpid).attr("disabled",true);
}
});
//drop down list
<select name="gw1" id="gw1" class="gw" data="gp1"><option value="">Please Select</option>
<?php $fetRefre = mysql_query("select * from table");
while($rowGate = mysql_fetch_array($fetRefre))
{?>
<option value="<?=$rowGate['id']?>"><?=$rowGate['name']?>
<?php }?>
</select>
//ajax page
if($_POST['gwid']) {
$id = $_POST['gwid'];
$sql=mysql_query("SELECT * FROM table where gw_id =$id ");
while($row = mysql_fetch_array($sql)) {
$id=$row['id'];
$data=$row['name'];
echo "<option value=$id>$data</option>";
}
}
Friday, 5 April 2013
chain delete recursive
function recursiveDelete($id) {
$result=mysql_query("SELECT * FROM vb_users WHERE parent_uid = '$id'");
if (mysql_num_rows($result)>0) {
while($current=mysql_fetch_array($result)) {
recursiveDelete($current['id']);
}
}
echo $id."<br>";
// mysql_query("DELETE FROM cc_reseller WHERE id='$id'") or die("some thing error 1");
}
recursiveDelete($_GET['id']);
$result=mysql_query("SELECT * FROM vb_users WHERE parent_uid = '$id'");
if (mysql_num_rows($result)>0) {
while($current=mysql_fetch_array($result)) {
recursiveDelete($current['id']);
}
}
echo $id."<br>";
// mysql_query("DELETE FROM cc_reseller WHERE id='$id'") or die("some thing error 1");
}
recursiveDelete($_GET['id']);
Subscribe to:
Posts (Atom)