$query = mysqli_query($con,"SELECT * FROM final_dog_catologue_full where keywords LIKE '%$searchq%' OR brand LIKE '%$searchq%' OR name LIKE '%$searchq%' LIMIT 0, 40") or die(mysqli_error("Sorry we lost the scent..."));
Not a solution to your question, but another problem you have.
Never build an SQL query by concatenating strings. Sooner or later, you will do it with user inputs, and this opens door to a vulnerability named "SQL injection", it is dangerous for your database and error prone.
A single quote in a name and your program crash. If a user input a name like "Brian O'Conner" can crash your app, it is an SQL injection vulnerability, and the crash is the least of the problems, a malicious user input and it is promoted to SQL commands with all credentials.
SQL injection - Wikipedia[
^]
SQL Injection[
^]
SQL Injection Attacks by Example[
^]
PHP: SQL Injection - Manual[
^]
SQL Injection Prevention Cheat Sheet - OWASP[
^]
Quote:
I am very new to coding and am struggling with this issue as I am trying learning on the fly.
It is generally a wrong good idea. Learn properly find some tutorial to get you started
This site is a good start:
W3Schools Online Web Tutorials[
^]
PHP 5 Tutorial[
^]
JavaScript Tutorial[
^]
[Update]
Quote:
i checked on stackoverflow and they said their is not injection bit confused?
Simple test
$myquery = "SELECT * FROM final_dog_catologue_full where keywords LIKE '%$searchq%' OR brand LIKE '%$searchq%' OR name LIKE '%$searchq%' LIMIT 0, 40";
echo $myquery;
$query = mysqli_query($con, $myquery) or die(mysqli_error("Sorry we lost the scent..."));
If the 3
LIKE '%$searchq%'
are changed with the text you search, it is an SQL injection.