Q:

Making my queries shorter, faster and better

I'm running a large PHP script to get database info which is adapted for search queries and so on. The problem is that the loading time for the page is several seconds (locally) and up to a minute on remote databases.
I'm not the best one when it comes to optimizing, but I know but the asterisk in queries, but in this case I need it because I'm using all fields in the table.
Keep in mind that the table it gets data from has over 800k rows in total (no im not showing 800k rows, as seen in the code I'm showing it WHERE = something)
<?php

    $getPage = $mysqli->real_escape_string(@$_GET["page"]); 
    $getSearch = $mysqli->real_escape_string(@$_GET["search"]);
    $getUser = $mysqli->real_escape_string(@$_GET["user"]);

    if(isset($getPage)) { $page  = $getPage; } else { $page = 1; }; 
    $start_from = ($page-1) * 12;

    $order = $mysqli->real_escape_string(@$_GET["ord"]); 

    $order_query = "item_name ASC";

    if($start_from >= 0) {
        if($getSearch)
        {
            if($order)
            {
                if($order == 1)
                {
                    $order_query = "item_name ASC";
                }

                if($order == 2)
                {
                    $order_query = "item_name DESC";
                }

                if($order == 3)
                {
                    $order_query = "item_id ASC";
                }

                if($order == 4)
                {
                    $order_query = "item_id DESC";
                }

                $shop = $mysqli->query("SELECT * FROM store_inventory WHERE (item_name LIKE '%".$getSearch."%' OR item_type LIKE '%".$getSearch."%' OR item_quality LIKE '%".$getSearch."%')  AND steamid = '".$getUser."' GROUP BY item_id ORDER BY ".$order_query." LIMIT $start_from, 28");
            }
            else
            {
                $shop = $mysqli->query("SELECT * FROM store_inventory WHERE (item_name LIKE '%".$getSearch."%' OR item_type LIKE '%".$getSearch."%' OR item_quality LIKE '%".$getSearch."%')  AND steamid = '".$getUser."' GROUP BY item_id ORDER BY item_name ASC LIMIT $start_from, 28");
            }
        }
        else 
        {
            if($order)
            {
                if($order == 1)
                {
                    $order_query = "item_name ASC";
                }

                if($order == 2)
                {
                    $order_query = "item_name DESC";
                }

                if($order == 3)
                {
                    $order_query = "item_id ASC";
                }

                if($order == 4)
                {
                    $order_query = "item_id DESC";
                }

                $shop = $mysqli->query("SELECT * FROM store_inventory WHERE steamid = '".$getUser."' GROUP BY item_id ORDER BY ".$order_query." LIMIT $start_from, 28");
            }
            else
            {
                $shop = $mysqli->query("SELECT * FROM store_inventory WHERE steamid = '".$getUser."' GROUP BY item_id ORDER BY item_name ASC LIMIT $start_from, 28");
            }
        }
    } else {
        $start_from = 0;
        if($getSearch)
        {
            if($order)
            {
                if($order == 1)
                {
                    $order_query = "item_name ASC";
                }

                if($order == 2)
                {
                    $order_query = "item_name DESC";
                }

                if($order == 3)
                {
                    $order_query = "item_id ASC";
                }

                if($order == 4)
                {
                    $order_query = "item_id DESC";
                }

                $shop = $mysqli->query("SELECT * FROM store_inventory WHERE (item_name LIKE '%".$getSearch."%' OR item_type LIKE '%".$getSearch."%' OR item_quality LIKE '%".$getSearch."%')  AND steamid = '".$getUser."' GROUP BY item_id ORDER BY ".$order_query." LIMIT $start_from, 28");
            }
            else
            {
                $shop = $mysqli->query("SELECT * FROM store_inventory WHERE (item_name LIKE '%".$getSearch."%' OR item_type LIKE '%".$getSearch."%' OR item_quality LIKE '%".$getSearch."%')  AND steamid = '".$getUser."' GROUP BY item_id ORDER BY item_name ASC LIMIT $start_from, 28");
            }
        }
        else 
        {
            if($order)
            {
                if($order == 1)
                {
                    $order_query = "item_name ASC";
                }

                if($order == 2)
                {
                    $order_query = "item_name DESC";
                }

                if($order == 3)
                {
                    $order_query = "item_id ASC";
                }

                if($order == 4)
                {
                    $order_query = "item_id DESC";
                }

                $shop = $mysqli->query("SELECT * FROM store_inventory WHERE  steamid = '".$getUser."' GROUP BY item_id ORDER BY ".$order_query." LIMIT $start_from, 28");
            }
            else
            {
                $shop = $mysqli->query("SELECT * FROM store_inventory WHERE  steamid = '".$getUser."' GROUP BY item_id ORDER BY item_name ASC LIMIT $start_from, 28");
            }
        }
    }

    $countarticles = $mysqli->query("SELECT COUNT(item_id) FROM store_inventory");
    $row = $countarticles->fetch_row();
    $total_records = $row[0]; 
    $total_pages = ceil($total_records / 28);

    $Pages[] = "";        
    for ($i = 1; $i <= $total_pages; $i++) { 
        $Pages[] = "<li><a href='?page=".$i."'>".$i."</a></li>";
    }

    while($fetch_market = $shop->fetch_array())
    {
        $iInv[] = $fetch_market;
    }

How can I reduce the loading time of the script/page significantly?

A:

This is your select query.
SELECT * 
  FROM store_inventory
 WHERE (   item_name LIKE '%".$getSearch."%'
        OR item_type LIKE '%".$getSearch."%'
        OR item_quality LIKE '%".$getSearch."%'
       )
   AND steamid = '".$getUser."'
 GROUP BY item_id ORDER BY ".$order_query."  
 LIMIT $start_from, 28

With respect, the way you have written this query is guaranteed to be very slow.
Why?
First, you are using WHERE column LIKE '%value%'. That kind of filter expression cannot possibly be sped up by an index. Why not? Because it has to look at every value in the column to see whether it matches your expression.  WHERE column LIKE 'value%', on the other hand, without the leading %, can exploit an index. The way you have it requires a full table scan to perform your filter.
Second, you are using three OR expressions, each with that poorly performing LIKE filter. That turns your one table scan into three, tripling the time taken.
Third, you are misusing GROUP BY here. MySQL lets you get away with all kinds of strange stuff here. Read this: https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html I would make a suggestion about how to fix this, but I can't guess what you're trying to do. 
Fourth, you are using the notorious SELECT * ... ORDER BY x LIMIT y performance antipattern. That sorts a whole mess of rows, only to discard all but a few of them.
What can you do about this? First of all, make sure you have an index on that steamid column. If it is reasonably selective, that will help a lot by reducing the number of rows needing scanning.
Second, try replacing your steamid index with a compound index on 
steamid, item_name, item_type, item_quality

That may (or may not) make your LIKE scans more efficient.
Third, figure out what you're actually trying to accomplish with GROUP BY and try to do it correctly.
Fourth, try to reduce the burden on ORDER BY.  Something like this may help.
SELECT * FROM store_inventory
 WHERE id IN (SELECT id
                FROM store_inventory
               WHERE (    this
                       OR that
                       OR the_other_thing
                     )
                 AND steamid = something
               ORDER BY some_column
               LIMIT start, count
              )

This makes it so MySQL only has to sort the ids. It's faster.
Fifth, look up MySQL's FULLTEXT searching option. It may replace your series of LIKE operations with something far more efficient.

