We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,913 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

mysql file name query problem

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);
2
Contributors
3
Replies
21 Minutes
Discussion Span
2 Months Ago
Last Updated
18
Views
Question
Answered
CreatorZeus
Newbie Poster
6 posts since Aug 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

@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);
LastMitch
Industrious Poster
4,146 posts since Mar 2012
Reputation Points: 132
Solved Threads: 334
Skill Endorsements: 45

where do i add it?

CreatorZeus
Newbie Poster
6 posts since Aug 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 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);
LastMitch
Industrious Poster
4,146 posts since Mar 2012
Reputation Points: 132
Solved Threads: 334
Skill Endorsements: 45
Question Answered as of 2 Months Ago by LastMitch

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0942 seconds using 2.66MB