First create database and name it as u like. I create database named with `fdb`. And then create table with 4 columns.
DEMO :)
Then insert some details
Example :)
/* here project is the database table name */
<?php
try{
$bdd=new PDO("mysql:host=localhost;dbname=fdb","root","");
}
catch(exception $e){
die("ERROR : ".$e->getMessage());
}
$keyword='ma'; /* You can use any characters as keywords */
$sql="SELECT * FROM project WHERE fullname LIKE :keyword;";
$q=$bdd->prepare($sql);
$q->bindValue(':keyword','%'.$keyword.'%');
$q->execute();
while ($r=$q->fetch(PDO::FETCH_ASSOC)) {
echo"<pre>".print_r($r,true)."</pre>";
}
?>
Output :)
DEMO :)
Then insert some details
Example :)
/* here project is the database table name */
<?php
try{
$bdd=new PDO("mysql:host=localhost;dbname=fdb","root","");
}
catch(exception $e){
die("ERROR : ".$e->getMessage());
}
$keyword='ma'; /* You can use any characters as keywords */
$sql="SELECT * FROM project WHERE fullname LIKE :keyword;";
$q=$bdd->prepare($sql);
$q->bindValue(':keyword','%'.$keyword.'%');
$q->execute();
while ($r=$q->fetch(PDO::FETCH_ASSOC)) {
echo"<pre>".print_r($r,true)."</pre>";
}
?>
Output :)



No comments:
Post a Comment