1,105,344 Community Members

mysql file name query problem

Member Avatar
CreatorZeus
Newbie Poster
22 posts since Aug 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

trying to search by the file name
keep getting a "expects parameter 1 to be resource, boolean" error
what am i missing?

$pagename = basename($_SERVER['PHP_SELF'], ".php");
mysql_select_db("tagpoint", $con);
$sql="SELECT * FROM tagpoint WHERE title = '".$pagename."'";
$result=@mysql_query($sql);
$row = mysql_fetch_array($result);
LastMitch
Deleted Member
 
1
 

@CreatorZeus

keep getting a "expects parameter 1 to be resource, boolean" error

This function doesn't work:

http://php.net/manual/en/function.mysql-query.php

You need to try mysqli_query() function

In the future used mysqli functions.

To solve your issue just add this

$result= mysql_query($sql,$con);
Member Avatar
CreatorZeus
Newbie Poster
22 posts since Aug 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

where do i add it?

LastMitch
Deleted Member
 
0
 

where do i add it?

I just gave you the code:

$result= mysql_query($sql,$con);

Just add

$con 

to this:

$result= mysql_query($sql);

and you will get this:

$result= mysql_query($sql,$con);
Question Answered as of 1 Year Ago by LastMitch
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: