Menu
Home
Forum
Support
Audio
(7,804)
Hardware
(45,772)
Internet/Social Networks
(31,629)
Linux/Unix
(4,098)
MacOS
(1,765)
Messaging
(32,503)
Mobile
(27,388)
Network
(12,061)
Office Software
(15,776)
Programming
(2,424)
Software
(20,631)
Video
(122)
Video Games
(8,146)
Viruses/Security
(4,508)
Webmastering
(860)
Windows
(30,563)
Discussions & Threads
Bugs and Suggestions
(962)
Members' Cafe
(1,608)
Opinions About Reviews
(99)
Opinions About the News
(1,140)
Rankings
Ranking Software
(6)
How To
Download
Ask a question
Windows Software
Mac Software
Linux Software
Android Apps
BlackBerry Apps
iPhone Apps
Windows Phone Apps
News
Encyclopedia
Sign Up
Log In
Ask a question
Search
Sign Up
Log In
High-Tech
Health
Sign Up
Language
English
Español
Deutsch
Français
Italiano
Português
Nederlands
Polski
हिंदी
Bahasa Indonesia
Русский
Log In
Search
Home
Forum
Ask a question
Recently asked
Windows
Mac
Linux
Internet
Video games
Software
Hardware
Mobile
Network
Virus
Become a member
How To
Download
Ask a question
Windows Software
Mac Software
Linux Software
Android Apps
BlackBerry Apps
iPhone Apps
Windows Phone Apps
News
Encyclopedia
Home
Forum
Programming
Ask a question
Report
PHP programming
noone - Mar 31, 2018 at 10:40 AM - Latest reply:
ac3mark
10759
Posts
Monday June 3, 2013
Registration date
Moderator
Status
November 2, 2018
Last seen
-
Apr 2, 2018 at 05:31 PM
Programming
Ask a question
Report
DIRECT ACCESS NOT ALLOWED
<?php include '../elements/header.php'; ?>
<?php
//load database connection
$host = "localhost";
$user = "root";
$utype = "";
$password = "";
$database_name = "mydb";
$pdo = new PDO("mysql:host=$host;dbname=$database_name", $user, $password, array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
));
// Search from MySQL database table
$search=$_POST['search'];
$query = $pdo->prepare("SELECT * from users WHERE username LIKE '%$search%' OR utype LIKE '%$search%' LIMIT 0 , 10");
$query->bindValue(1, "%$search%", PDO::PARAM_STR);
$query->execute();
// Display search result
if (!$query->rowCount() ==0) {
echo "Search found :<br/>";
echo "<table style=\"font-family:arial;color:#333333;\">";
echo "<tr><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;background:#98bf21;\">Username</td><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;background:#98bf21;\">password</td><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;background:#98bf21;\">utype</td></tr>";
while ($results = $query->fetch()) {
echo "<tr><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;\">";
echo $results['username'];
echo "</td><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;\">";
echo $results['password'];
echo "</td><td style=\"border-style:solid;border-width:1px;border-color:#98bf21;\">";
echo $results['utype'];
echo "</td></tr>";
}
echo "</table>";
} else {
echo 'Nothing found';
}
?>
help please i can't put my header in this query
See more
PHP programming
Problem in php program execution
»
Forum - Programming
Difference between get() and post() method in PHP - Programming
»
Forum - Programming
Undefined index in php
»
How-To - PHP
Php redirect to another page
»
How-To - PHP
Examples of programming language
» Articles
Your reply
Reply to this topic
1 reply
Report
Respond to ac3mark
ac3mark
10759
Posts
Monday June 3, 2013
Registration date
Moderator
Status
November 2, 2018
Last seen
-
Apr 2, 2018 at 05:31 PM
0
Thank you
Does the WEB service provider have read access to the "../elements" folder?
Respond to ac3mark
Your reply
Your reply
Reply to this topic
Ask a question
Featured
Writing Professional Emails in English
No Sound from Headphone Jack
Sign Up for a Free Netflix Trial
Reverse Image Search with Google
Get the Transcript of a YouTube Video