Am using PDO
method to get data from SQL But am unable to get data from SQL
database since am new to PDO
its little hard to understand
but i did the following code but Doesn't work can someone help me
CODE
<?php
$servername = "localhost";
$username = "sanoj";
$password = "123456";
$dbname = "test";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM members");
$stmt->execute();
// set the resulting array to associative
$membid=($_GET['memberID']);
$email=($_GET['email']);
$state=($_GET['username']);
}
catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
echo $membid;
echo $email;
echo $state;
$conn = null;
echo "</table>";
?>
ERROR I GET
Notice: Undefined index: memberID in C:\Users\sanoj\Documents\NetBeansProjects\godaddy optimized\data.php on line 14
Call Stack
# Time Memory Function Location
1 0.0020 132392 {main}( ) ..\data.php:0
( ! ) Notice: Undefined index: email in C:\Users\sanoj\Documents\NetBeansProjects\godaddy optimized\data.php on line 15
Call Stack
# Time Memory Function Location
1 0.0020 132392 {main}( ) ..\data.php:0
( ! ) Notice: Undefined index: username in C:\Users\sanoj\Documents\NetBeansProjects\godaddy optimized\data.php on line 16
Call Stack
# Time Memory Function Location
1 0.0020 132392 {main}( ) ..\data.php:0