Monday, November 23, 2015

How to Reset table primary key in mysql


query:-

After delete all data

place this query and run

ALTER TABLE some_table AUTO_INCREMENT=1

Friday, November 7, 2014

Simple encryption and decryption using base64

<?php
$key = "bala";
$enc = base64_encode ($key);
$dec = base64_decode ($enc);
echo 'Encrypted : '.$enc.'<br>';
echo 'Decrypted : '.$dec.'<br>';
?>

output:-

Encrypted : YmFsYQ==
Decrypted : bala

Saturday, November 1, 2014

Simple ajax checkbox using jquery


index.php

if ($('.chkNumber:checked').length) {
          var chkId = '';
          $('.chkNumber:checked').each(function () {
            chkId += $(this).val() + ",";
          });
         chkId = chkId.slice(0, -1);
         //alert(chkId);

  var datastring='chkId='+chkId;
  //alert(datastring);

       $.ajax({
             type: "POST",
             url: "delete.php",
             data:datastring,
             cache:false,
             beforeSend: function()
             {
                 $("#signup_status").html("please wait....");
             },
             success:function(response)
             {
                 alert(response);
                 $("#signup_status").html(response)

             }

        });
        }
        else {
          alert('Nothing Selected');
        }

 
   
   
   
}
-------------------------------------------------------------------------------------------------------------------

checkbox code:-

<input name="checkbox[]" type="checkbox"   class="chkNumber" />


--------------------------------------------------------------------------------------------------------------------
retrieve checkbox :-


$chkId=$_POST['chkId'];
$count=explode(',',$chkId);
for($i=0;$i<$count[$i];$i++)
{
$del_qry="delete from gunning_3001 where id='$count[$i]'";
$res=mysql_query($del_qry) or die('Delete query does not work');
if($res)
{
  echo "Delete Records Successfully";

}
else
{
 echo "No Records Deleted";

}


}
---------------------------------------------------------------------------------------------------------------------





Tuesday, September 2, 2014

How to find out wamp server username and password?

Go to this file in: WampFolder\apps\phpmyadmin[phpmyadmin version]\config.inc.php
Usually wamp is in your main hard drive folder C:\wamp\
You will see something like:
$cfg['Servers'][$i]['user'] = 'YOUR USER NAME IS HERE';
$cfg['Servers'][$i]['password'] = 'AND YOU PASSWORD IS HERE';

Friday, June 27, 2014

Simple page responsive code for static websites

code:-
<html>
<head>
<title>Responsive web design</title>
<style>
.container {
 width:538px;
}

table{
background-color:#c6dcfe;
}

</style>
</head>
<body>
<div id="container">
<table border="1" width="100%"  cellpadding="0" cellspacing="0">
<tr>
<td><h1>Its Responsive web design</h1></td><br>
</tr>
<tr>
<td>
<p>The goal with responsive design is to have one site with various elements that will respond correctly on different sizes of devices. No need to make several versions of the site anymore.</p>

</td>
</tr>
<tr>
<img src="Eset-Nod32-3D-Robot-HD-Wallpapers-D.jpg" style="max-width:100%;height:auto;" />
</tr>
</table>
</div>
</body>
</html>

Friday, May 23, 2014

Disable right click in website(protect your content and image) using javascript

code:-

<script>
function disableRightClick(e)
{
  var message = "Right click disabled";
  if(!document.rightClickDisabled) // initialize
  {
    if(document.layers)
    {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = disableRightClick;
    }
    else document.oncontextmenu = disableRightClick;
    return document.rightClickDisabled = true;
  }

  if(document.layers || (document.getElementById && !document.all))
  {
    if (e.which==2||e.which==3)
    {
      alert(message);
      return false;
    }
  }
  else
  {
    alert(message);
    return false;
  }
}

disableRightClick();

</script>

Wednesday, April 9, 2014

memory_limit problem in opencart or anyother website


error:-

Fatal error: Allowed memory size of 138412032 bytes exhausted (tried to allocate 71 bytes) in /home/xxxxxxx/public_html/xxxxxxxxxxxx/vqmod/vqcache/vq2-system_engine_controller.php on line 79


simple solution:-

<?php ini_set('memory_limit', '-1'); ?>

write this code on config.php in first line.its unlimited.