PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Wed Nov 22, 2017 6:56 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: MYSQL ERROR
PostPosted: Fri Apr 07, 2017 10:43 am 
Offline
Forum Newbie

Joined: Fri Apr 07, 2017 10:30 am
Posts: 2
hi there am new here as well as on database lessons, i was trying to search data in my database in xampp but i get this error "mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\login\search.php on line 15"
my codes are shown below please help me how can i fix that error, thanks in advance
<!DOCTYPE html>
<html>
<head>
<title>search</title>
</head>
<body>

<?php
mysql_connect("localhost", "root", "") or die ("bad connection");
mysql_select_db("test");

$search = mysql_real_escape_string(trim($_POST['searchterm']));
$find_v = mysql_query("select * from 'videos' where 'keyword' like '%$search%' ");
while($row = mysql_fetch_assoc($find_v))
{

$name = $row['name'];

echo "$name<br/>";


};

?>
</body>
</html>


Top
 Profile  
 
 Post subject: Re: MYSQL ERROR
PostPosted: Fri Apr 07, 2017 11:03 am 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6587
Location: WA, USA
That error message almost always means there was a syntax error in your SQL query. Where did you get it from? The lesson? They should also be teaching you the correct way to put table and column names in a query...

Another problem: the mysql_* functions are bad and old and have been totally removed from current versions of PHP. You need to find something that teaches you about using PDO instead.


Top
 Profile  
 
 Post subject: Re: MYSQL ERROR
PostPosted: Fri Apr 07, 2017 12:06 pm 
Offline
Forum Newbie

Joined: Fri Apr 07, 2017 10:30 am
Posts: 2
i got it from youtube, and thanks for your advice


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group