Wednesday, March 25, 2015

File is empty. Please upload something more substantial. This error could also be caused by uploads bei

If you get this error in wordpress or any other website initially try to increase the
upload_file_size to your preferred size and post_max_size in php.ini.

If this works fine./...

Or just call to hosting provider and ask them to increase the size manually......

Monday, February 9, 2015

Very Simple and easy pagination in php

<?php
$num_rec_per_page=10;
mysql_connect('localhost','root','');
mysql_select_db('apex1');
if (isset($_GET["page"])) { $page  = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $num_rec_per_page;
$sql = "SELECT * FROM student $start_from, $num_rec_per_page";
$rs_result = mysql_query ($sql); //run the query
?>
<table>
<tr><td>Name</td><td>Phone</td></tr>
<?php
while ($row = mysql_fetch_assoc($rs_result)) {
?>
            <tr>
            <td><?php echo $row['Name']; ?></td>
            <td><?php echo $row['Phone']; ?></td>          
            </tr>
<?php
};
?>
</table>
<?php
$sql = "SELECT * FROM student";
$rs_result = mysql_query($sql); //run the query
$total_records = mysql_num_rows($rs_result);  //count number of records
$total_pages = ceil($total_records / $num_rec_per_page);

echo "<a href='pagination.php?page=1'>".'|<'."</a> "; // Goto 1st page

for ($i=1; $i<=$total_pages; $i++) {
            echo "<a href='pagination.php?page=".$i."'>".$i."</a> ";
};
echo "<a href='pagination.php?page=$total_pages'>".'>|'."</a> "; // Goto last page
?>

Friday, February 6, 2015

URL redirect using .htaccess

302 (Temporary) Redirect: Point an entire site to a different temporary URL. This is useful for SEO purposes when you have a temporary landing page and plan to switch back to your main landing page at a later date:

# This allows you to redirect your entire website to any other domain Redirect 302 / http://mt-example.com/

301 (Permanent) Redirect: Point an entire site to a different URL on a permanent basis. This is the most common type of redirect and is useful in most situations. In this example, we are redirecting to the "mt-example.com" domain:

# This allows you to redirect your entire website to any other domain Redirect 301 / http://mt-example.com/




Saturday, January 31, 2015

How to restrict login from another IP using PHP

To restrict login from another unknown IP 

you must need to use $_server['REMOTE_ADDR']

the syntax to restrict is 

if(isset($_POST['submit'])=="SUBMIT")
{
     if($_server['REMOTE_ADDR']=='127.0.0.1') // replace with your own IP
        {
             // your code
        }
}

insert form data into mysql database using php

If you want to insert data into mysql database using php

if the database table is tblemployees


<form action="insert.php" method="POST">
<table>
<tr><td><input type="text" name="EMPNAME"/></td></tr>
<tr><td><input type="text" name="AGE"/></td></tr>
<tr><td><input type="text" name="MOBILE"/></td></tr>
<tr><td><input type="text" name="EMAIL"/></td></tr>
<tr><td><input type="submit" name="SUBMIT"/></td></tr>
</form>


and the php code to insert the data into database table is as follows

insert.php:

<?php


if(isset($_POST['submit'])=='SUBMIT')
{
     $insert=mysql_query("insert inot tblemployees (EMPNAME,AGE,MOBILE,EMAIL) values ('".$_POST['EMPNAME']."','".$_POST['AGE']."','".$_POST['MOBILE']."','".$_POST['EMAIL']."')");

if($insert)
{
   echo "Employee Created Successfully";
}

}

?>

Tuesday, January 27, 2015

How to delete file or image from folder using php

You can delete images in PHP using the unlink() function.
unlink('path/to/file.jpg');

How to Add Google Analytics Code to your Joomla Site

In this article, we will show you how to add a Google Analytic tracking code to your Joomla website.
1) Log into the Joomla administration panel
2) Click the Template Manager link
ga_joomla_1
3) Click the Templates tab
ga_joomla_2
4) Locate the template your site is using, then click on its title
ga_joomla_3
5) Click the Edit main page template link
ga_joomla_4
6) At the bottom of the code, locate the </body> tag and insert your tracking code above it
ga_joomla_5
7) Click the Save & Close button
ga_joomla_6
That’s it! You should start to see tracking results from this site within 24 hours on the Google Analytics panel

Wednesday, January 21, 2015

Invalid Token Session. Please login again - opencart resolved

This is a very common issue in opencart. Sometime when you are opening opencart admin pages in multiple tabs you will get this error.
There is a simple fix to see if this is more than just human error. Open
system/library/user.php
Search for this code
user WHERE username
replace it with
user #WHERE username
after this just clear the cache in your browser or open this in a new browser... Problem Solved

How to create a empty rectangle using photoshop

When ever you want to draw a rectangle in photoshop this will come with a color fill,

Here is the way to draw an empty rectangle with borders

1. Select the rectangle tool.

2. Set to shape layers.

3. Draw the rectangle.

4. Fill opacity 0%.

5. Layer style>Stroke.

6. Adjust settings to taste.






Horizontal Marquee with dynamic data from mysql database using php

Breaking News Scrolling in marquee from mysql Database

<?php
$fetch=mysql_query("select * from articles where hot='Yes' limit 10");
if(mysql_num_rows($fetch))
{
?>
<marquee behavior="scroll" scrollamount="2" direction="left" onmouseover="this.stop();" onmouseout="this.start();">

<?php
// $result = array();
while($row=mysql_fetch_assoc($fetch))
{
$id=$row['AID'];
$feed=$row['ATitle'];
echo "<a href='articledetails.php?aid=".$row['AID']."' style='color: rgb(2, 2, 207);'>**".$feed."&nbsp</a>";
}
}
?>


</marquee>

How to get Logged In Username in Wordpress or Woocommerce

It is really easy to get the logged-in user’s information in Wordpress or Woocommerce. In this article we will show you how to get the relat...