Thursday 30 August 2012

Delete Record Using php Mysql with Javascript Confirm Box



*************************************************************************
Method 1 to Delete the Record
*************************************************************************



Display.php

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">

function del_rec(id)
{

    if(confirm("Do you wnat to delete this record...?"))
    {

        window.location="display.php?did="+id;
    }
}
</script>
</head>

<body>
<?php

$con=mysql_connect("localhost","root","");
mysql_select_db("test");

if(isset($_GET['did']))
{
mysql_query("delete from stud where id=".$_GET['did']."");
   
}



$sql="select * from stud";
$nsql=mysql_query($sql);
?>
<table border="1">
<tr>
    <td><b>Id</b></td>
    <td><b>Name</b></td>
    <td><b>Delete</b></td>
</tr>
<?php
while($row=mysql_fetch_array($nsql))
{
?>
<tr>
    <td><?php echo $row[0]; ?></td>
    <td><?php echo $row[1]; ?></td>
    <td><a href="#" onclick="del_rec(<?php echo $row[0]; ?>)">Delete</td>
</tr>

<?php
   
}

?>

</table>
</body>
</html>


Database










*********************************************************************
 Method 2 to Delete the Record
*********************************************************************








 ***************************************************************************
delete.php

*******************************************************************************

<?php
$con=mysql_connect("localhost","root","");
mysql_select_db("test");
$sql=mysql_query("select * from stud");

if(isset($_REQUEST[did]))
{
    mysql_query("delete from stud where id=".$_REQUEST[did]);
    ?>
    <script language="javascript">
    window.location="delete.php";
    </script>
    <?php
}

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>

<table width="200" border="1">
<?php
while($row=mysql_fetch_array($sql))
{
?>


  <tr>
    <td rowspan="3">
    <img src="<?php echo "img/".$row["image"]; ?>" height="100px" width="180px" /></td>
    <td><?php echo $row["id"]; ?></td>
    <td rowspan="3"><a href="delete.php?did=<?php echo $row["id"]; ?>" onclick="return confirm('are sure to delete!')">Delete</a></td>
  </tr>
  <tr>
    <td><?php echo $row["name"]; ?></td>
  </tr>
  <tr>
    <td><?php echo $row["pincode"]; ?></td>
  </tr>
  <?php } ?>
</table>

</body>
</html>

 ****************************************************************************

Database
*************************************************************************



Thursday 16 August 2012

send sms to mobile using php api


send sms to mobile using php api 





Database Filed








Values in Database



sms.php

<html>
<head>
</head>

<body>

<?php

$con=mysql_connect("localhost","root","");
mysql_select_db("test");

$pass=rand();
$epass=md5($pass);
if(isset($_POST['txtmail'])&&($_POST['txtmail']!=""))
{

?>

<?php

echo $msg="Your UserId=".$_POST['txtmail']." "."and Password is=".$pass;



$sql="insert into msg(username,password,mobile) values('".$_POST['txtmail']."','$epass',".$_POST['txtmno'].")";

?>

<iframe style="display:none" src="http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=user_name@gmail.com:user-password&senderID=TEST SMS&receipientno=<?php echo $_POST['txtmno'];  ?>&dcs=0&msgtxt=<?php echo $msg;  ?>&state=4">
<?php

//$ssql="select * from msg where pass='".md5($_POST[''])."'";
mysql_query($sql);
}

?>

<form method="post">

<table border="1" align="center">

<tr>

    <td>Enter Your EmailId</td>
    <td><input type="text" name="txtmail" />
</tr>


<tr>

    <td>Enter Your MobileNo</td>
    <td><input type="text" name="txtmno" />
</tr>

<tr>
    <td><input type="submit" name="submit" value="Submit" /></td>
    <td><input type="reset" name="reset" value="Cancle" /></td>
</tr>


</table>
</form>
</body>
</html>






demo of send sms to mobile using php api