last day (15 days later) » 

7:42 PM
0
A: HTML search field always echoeing zero results

anant kumar singhFirst of all you are using deprecated version mysql_* need to use mysqli_*. Please check below. <?php ini_set('display_errors', 0); $search = $_GET ['q']; // see changes from below line $conn = mysqli_connect("localhost", "root", ""); mysqli_select_db("release",$conn); $q...

 
Hey. I accidently forgot to change mysql to mysqli, I copied this code from an old Stackoverflow topic. That's my mistake. I'm not getting any results whatsoever when I'm using your code though.
 
any error you are getting?
 
No, the $foundnum ==0 echo is being shown, even though I'm entering an existing game name in the search field.
 
what is your column name in game table . is it name or something else?
 
It's game_name. I used that to make sure, but that doesn't fix it.
 
7:42 PM
try to write $foundnum = mysqli_fetch_array($query); and then mysqli_error($conn)
 
Didn't work out mate. Already so many thanks for trying to help me out here!
 
Hey I never used this chat function, but I didn't want to spam the whole topic with my answers
 
see can you show your code somewhere live or can you send me this form code and your table by exporting to my mail then may be i help you?
 
I can send you my data table (.sql file) and my index.php + search.php?
 
7:46 PM
send it on anantkumarsingh03101988@gmail.com
?
 
Did you get it?
 
i am checking
yup?
 
Awesome
 
ok let me check it and get back to you it will take some time so go and take tea meanwhile:).
 
Thank you so much for checking this out! I studied html and css, but for my project I need quite some php :)
 
7:56 PM
one more thing which game you are searchin? i try with that one only?
 
MadMax
 
tell me?
hey?
are you there?
 
I am mate
 
i got it. can i send you the code?
mail id pleas?
 
michael.cox@live.be
 
8:03 PM
see i am uploading here get it
ok
 
Where?
 
hey sending to mail
 
Ok tell me when you have sent it ^^
 
sended. please read instruction also. and do what i said
 
I am reading it and will do it
Checking it out now
 
8:09 PM
ok please tell me is it working or not?
?
 
Yes and no
Notice: Array to string conversion in C:\Program Files (x86)\XAMPP\htdocs\releases\search.php on line 14
Array results found !
Array
(
[0] => 4
[game_id] => 4
[1] => MadMax
[game_name] => MadMax
[2] => 2
[game_genre] => 2
[3] => Avalanche Studios
[game_dev] => Avalanche Studios
[4] => Warner Bros. Interactive Entertainment
[game_pub] => Warner Bros. Interactive Entertainment
[5] => http://www.madmaxgame.com
[game_site] => http://www.madmaxgame.com
[6] => https://youtu.be/TGN7CncbC64
[game_trailer] => https://youtu.be/TGN7CncbC64
os wjat O get
Is what I get*
 
ya now what you want?
tell me?
 
Well I only want the game title, not this array
this is the code I had
echo '<p>'.$row['game_name'].'</p>';
 
ok just in your query write game_name instead of *
and then write echo '<p>'.$row['game_name'].'</p>'; it instead of echo",pre/>";print_r($row);
 
Ok now I get two errors
Notice: Array to string conversion in C:\Program Files (x86)\XAMPP\htdocs\releases\search.php on line 14
Array results found !

Notice: Undefined variable: row in C:\Program Files (x86)\XAMPP\htdocs\releases\search.php on line 15
 
8:14 PM
you need to write $foundnum['game_name']
 
before the if loop?
 
one sec.
see my edited code in your post.
ok?
 
yes?
 
check and mark it if your problem is solved?
 
but it is not :(
I got two errors :p
Notice: Array to string conversion in C:\Program Files (x86)\XAMPP\htdocs\releases\search.php on line 14
Line 14=
   echo "$foundnum results found !<p>";
 
8:22 PM
hey man i said please check my edited code. i just edit it please check
?
 
your code, as it is there, gives me this page
Notice: Array to string conversion in C:\Program Files (x86)\XAMPP\htdocs\releases\search.php on line 14
Array results found !
Array
(
[0] => 4
[game_id] => 4
[1] => MadMax
[game_name] => MadMax
[2] => 2
[game_genre] => 2
[3] => Avalanche Studios
[game_dev] => Avalanche Studios
[4] => Warner Bros. Interactive Entertainment
[game_pub] => Warner Bros. Interactive Entertainment
[5] => madmaxgame.com
[game_site] => madmaxgame.com
[6] => youtu.be/TGN7CncbC64
[game_trailer] => youtu.be/TGN7CncbC64
and in my code I just had - echo '<p>'.$row['game_name'].'</p>'; - to get the game's title
 
no on your post where you ased your question. i just puted the code
 
I don't see anything new there
the code there is the code you mailed me
 
on your question post i just write answer 2 min before. please check that one. refresh the page.
i puted $count there?
<?php
ini_set('display_errors', 2);
$search = $_GET ['q'];
// see changes from below line
$conn = mysqli_connect("localhost", "root", "","release");
$query = mysqli_query($conn,"SELECT game_name FROM game WHERE game_name LIKE '%". $search ."%'");
$foundnum = mysqli_fetch_array($query);
$count = count($foundnum['game_name']);
if ($foundnum == 0) {
echo "No results found. Either this game doesn't exist, or we have yet to add it. Please contact us!";
}
else {
echo "$count results found !<p>";
echo"<pre/>";print_r($foundnum['game_name']);
see herer?
?
hello?
 
Ok now I got that, sorry didn't notice that immediately
 
8:27 PM
ok, check and mark it
 
Now that error is gone. Can we please fix the array to only the game's name?
wait
 
let me try
 
it works
!
Accepted and marked your answer, you are a hero
Chances are low, but if I ever can do something in return, please let me know
 
hey you can do it as follow:-
<?php
ini_set('display_errors', 2);
$search = $_GET ['q'];
// see changes from below line
$conn = mysqli_connect("localhost", "root", "","stackoverflow");
$query = mysqli_query($conn,"SELECT game_name FROM game WHERE game_name LIKE '%". $search ."%'");
$foundnum = mysqli_fetch_assoc($query);
$count = count($foundnum);
if ($foundnum == 0) {
echo "No results found. Either this game doesn't exist, or we have yet to add it. Please contact us!";
}
else {
echo "$count results found !<p>";
echo"<pre/>";print_r($foundnum['game_name']);
"Chances are low, but if I ever can do something in return, please let me know"? i don't understand?
 
If I can do anthing to thank you
please tell me :)
 
8:31 PM
send me money:):):)
i spend more than 30 min to your question
:):)
?
 
do you play videogames?
 
nope?
why?
 
ok :( I could send you over some codes when I receive new ones, I sell video games :)
 
new once? means?
 
yes
 
8:33 PM
i do'nt understand?
what you want to say?
 
Well that if you want, I can send you a code for a video game
that you can use online (Steam) to download it
or sell the code
 
thanks. just sell from your sde and give me some money.
side
not all
and yes you have my mail id. just let me know if you have any problem with php.
i resolve it
 
Do you have paypal then? To send you some cash in the future?
 
i will send detail on your mail. ok?
and yes you have my mail id. just let me know if you have any problem with php.
i resolve it
ok?
 
deal
 
8:37 PM
deal. and can i ask you some thing?
 
sure
 
apology accepted? are you male or female. and from which country you are?
 
Belgium, and I'm male :)
You?
 
male,india
let me set my pic
ok what is time right now there?
 
10.41pm; there?
 
8:43 PM
@:13 Am
2:13AM
 
4h time difference, I always thought it was a lot more
 
NOPE. not much
:)
 
btw, can I just add a while-loop to show more results if there are more than one?
 
yes then you need to do fetch_array and then while loop
now its time to sleep. because i have to go office at 9 o clock
by. but we chat frequuently?
ok?
 
Alright, sleep tight! And yes, we can do that!
 
8:46 PM
do you have fb id?
 
I don't have fb
 
ohk.facebook is much better from this one
but no proble?
 
just mail me, or skype
 
mail is there.
 
skype = coxke_m@hotmail.com
 
8:48 PM
ok i will create an account then i will let you know.ok? by
 
if you got time tomorrow I would really love some help with the while loop, but there's no pressure! Sleep tight, have a nice day at work and we'll talk tomorrow
 

last day (15 days later) »