<?php
include 'connectMySql.php';
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
$sql = 'SELECT * FROM users ';
$result = mysql_query( $sql);
if(! $result)
{
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_assoc($result, MYSQL_ASSOC))
{
echo "ID : {$row['id']} <br> ".
"USERNAME : {$row['username']} <br> ".
"EMAIL : {$row['email']} <br> ".
"--------------------------------<br>";
}
echo "Fetched data successfully\n";
?>
RainaAnja
-3
Light Poster
Recommended Answers
Jump to PostWhat do you mean by "select"? Do you mean click on some row in a table displayed on your page? Or do you mean you only want to select one row from the DB where username="$username"
Jump to Post$sql = 'SELECT * FROM users WHERE username="' . $username . '" LIMIT 1');
All 6 Replies
RainaAnja
-3
Light Poster
JorgeM
958
Problem Solver
Team Colleague
Featured Poster
matrixdevuk
71
6t9.me Founder
OsaMasw
13
Loving Helper
RainaAnja
-3
Light Poster
matrixdevuk
71
6t9.me Founder
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.