I'm having hard time to figure it out how to insert the checked box-es or unchecked into the database with php.
I tried many many different ways but none is working, I think I'm very close but can't figure it out the problem.
Btw I work with Javascript and never worked with PHP except this time.
index.html
<html>
<head>
<style type="text/css">
#import "demo_page.css";
#import "header.ccss";
#import "demo_table.css";
#import "select.dataTables.min.css";
#import "jquery.dataTables.min.css";
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8" src="RowGroupingWithFixedColumn.js"></script>
<script>$(document).ready(function(){load_(); console.log('load running')});</script>
</head>
<body id="dt_example">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="endpoints">
<thead>
<tr>
<th></th>
<th>Nr.</th>
<th>Java Class Name</th>
<th>http Method</th>
<th>URL</th>
</tr>
</thead>
<tbody>
<?php
$con = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con,DB_NAME);
$sql='SELECT * FROM url';
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_array($result)) {
print $row['method'];
switch ($row['http_method']) {
case "GET":
echo "<tr class='gradeA'>";
break;
case "PUT":
echo "<tr class='gradeC'>";
break;
case "POST":
echo "<tr class='gradeU'>";
break;
case "DELETE":
echo "<tr class='gradeX'>";
break;
default:
echo "<tr>";
}
if($row['checked']){
echo "<td><input type='checkbox' id=case name='case[]' value='" . $row['number'] . "' checked> </td>";
} else {
echo "<td><input type='checkbox' id=case name='case[]' value='" . $row['number'] . "'> </td>";
}
echo "<td align=center >" . $row['number'] . "</td>";
echo "<td align=center >" . $row['class_name'] . "</td>";
echo "<td>" . $row['http_method'] . "</td>";
echo "<td style='font-weight:bold'>" . $row['endpoint'] . "</td>";
echo "</tr>";
}
if(isset($_POST['save'])){
echo "<script>console.log(" . $checkboxes.length . ");</script>";
$rows = $_POST['case'];
foreach($rows as $row){
$sql = "UPDATE url SET checked = 1 WHERE number = " . $case;
$result = mysqli_query($con,$sql);
}
}
mysqli_close($con);
echo "</tbody></table>";
echo "<input type='submit' name='save' id='save' value='Save' />";
?>
</body>
</html>
Any help would be appreciated.
image:
EDIT:
Solved - here is the code:
<?php
if(isset($_POST['save'])){
echo "<script>console.log(" . $checkboxes.length . ");</script>";
$con = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con,DB_NAME);
$rows = $_POST['case'];
foreach($rows as $row){
$sql = "UPDATE url SET checked = 1 WHERE number = " . $row;
$result = mysqli_query($con,$sql);
}
}
?>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#import "demo_page.css";
#import "header.ccss";
#import "demo_table.css";
#import "select.dataTables.min.css";
#import "jquery.dataTables.min.css";
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8" src="RowGroupingWithFixedColumn.js"></script>
<script>$(document).ready(function(){load_(); console.log('load running')});</script>
</head>
<body id="dt_example">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="endpoints">
<thead>
<tr>
<th></th>
<th>Nr.</th>
<th>Java Class Name</th>
<th>http Method</th>
<th>URL</th>
</tr>
</thead>
<tbody>
<?php
$con = mysqli_connect('sql7.freemysqlhosting.net','sql7117068','GZqaZj69G9','sql7117068');
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con,'sql7117068');
$sql='SELECT * FROM url';
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_array($result)) {
print $row['method'];
switch ($row['http_method']) {
case "GET":
echo "<tr class='gradeA'>";
break;
case "PUT":
echo "<tr class='gradeC'>";
break;
case "POST":
echo "<tr class='gradeU'>";
break;
case "DELETE":
echo "<tr class='gradeX'>";
break;
default:
echo "<tr>";
}
if($row['checked']){
echo "<td><input type='checkbox' id=case name='case[]' value='" . $row['number'] . "' checked> </td>";
} else {
echo "<td><input type='checkbox' id=case name='case[]' value='" . $row['number'] . "'> </td>";
}
echo "<td align=center >" . $row['number'] . "</td>";
echo "<td align=center >" . $row['class_name'] . "</td>";
echo "<td>" . $row['http_method'] . "</td>";
echo "<td style='font-weight:bold'>" . $row['endpoint'] . "</td>";
echo "</tr>";
}
mysqli_close($con);
echo "</tbody></table>";
echo "<input type='submit' name='save' id='save' value='Save' />";
echo "</form>";
?>
</body>
</html>
PS: There may be many leaks and bad programming style in the code, but know that I'm not a PHP developer and it doesn't matter if there can be different attacks on my server. I only wanted to solve the problem and move on. Don't have time to stop at every point.
Use code below to check if a check box is checked or not. Then set some flags on some variables to insert data to to db accordingly.
//html
<input type='checkbox' name='boxname' value='1' />
//php
<?php
if(isset($_POST['boxname'])
{
echo "check box is checked";
}
?>
Related
When I click the delete button it should delete the user from that row from the Database. I also want help for my modify button in this table if I click the modify button it should change the user type (Admin, Chief, user). I already tried everything but I don't know how a can solve it that's why I'm asking your help.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pannel</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
<style type="text/css">
body {
font: 14px sans-serif;
text-align: center;
}
</style>
</head>
<body>
<div class="page-header">
<h1> Admin Pannel</h1>
</div>
<div>
</div>
</body>
</html>
<?php
session_start();
require 'config.php';
$strSQL = "SELECT username, email, type FROM benutzer";
$rs = mysqli_query($link, $strSQL);
echo "<table border='1' style='margin: 0 auto'>
<tr>
<th class='text-center'>Name / Vorname</th>
<th class='text-center'>Email</th>
<th class='text-center'>Type</th>
<th class='text-center'>Modify</th>
<th class='text-center'>Delete</th>
</tr>";
while ($row = mysqli_fetch_array($rs)) {
echo "<tr>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['type'] . "</td>";
echo "<td><input type='submit' value='Modify' class='btn' name='modify'></td>";
echo "<td><input type='submit' value='Delete' class='btn' name='delete'></td>";
echo "</tr>";
}
echo "</table>";
if (isset($_POST['modify'])) {
$username = $row['username'];
$modify_query = mysqli_query($link, "UPDATE benutzer SET type='Mitarbeiter, Chef' WHERE username=$username");
if ($modify_query) {
mysqli_close($link);
header("location:welcome.php");
exit;
} else {
echo mysqli_close($link);
}
}
if (isset($_POST['delete'])) {
$username = $row['username'];
$delete_query = mysqli_query($link, "DELETE FROM benutzer WHERE id=$username");
if ($delete_query) {
mysqli_close($link);
echo "Record deleted successfully";
exit;
} else {
echo mysqli_close($link);
}
}
?>
Try this you were missing hidden input types so the php can't see your code you submitted.
Since you are showing alot of username's you will need to create a bunch of input hidden types with name=username1, name=username2 etc.. or it won't work well I can show you a easier way to do it (look below this code)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pannel</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
<style type="text/css">
body {
font: 14px sans-serif;
text-align: center;
}
</style>
</head>
<body>
<div class="page-header">
<h1> Admin Pannel</h1>
</div>
<div>
</div>
</body>
</html>
<?php
session_start();
require('config.php');
$strSQL = "SELECT username, email, type FROM benutzer";
$rs = mysqli_query($link, $strSQL);
echo "<table border='1' style='margin: 0 auto'>
<tr>
<th class='text-center'>Name / Vorname</th>
<th class='text-center'>Email</th>
<th class='text-center'>Type</th>
<th class='text-center'>Modify</th>
<th class='text-center'>Delete</th>
</tr>";
while ($row = mysqli_fetch_array($rs)) {
echo "<tr>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['type'] . "</td>";
echo "<form action='pannel.php' method='post'>";
echo "<input type='hidden' id=username' name='username' value='".$row['username']."'>";
echo "<input type='hidden' id=email' name='email' value='".$row['email']."'>";
echo "<input type='hidden' id=type' name='type' value='".$row['type']."'>";
echo "<td><input type='submit' value='Modify' class='btn' name='modify'></td>";
echo "<td><input type='submit' value='Delete' class='btn' name='delete'></td>";
echo "</form>";
echo "</tr>";
}
echo "</table>";
if (isset($_POST['modify'])) {
$username = $_POST['username'];
$modify_query = mysqli_query($link, "UPDATE benutzer SET type='Mitarbeiter, Chef' WHERE username=$username");
if ($modify_query) {
mysqli_close($link);
header("location:welcome.php");
exit;
} else {
echo mysqli_close($link);
}
} else if (isset($_POST['delete'])) {
$username = $_POST['username'];
$delete_query = mysqli_query($link, "DELETE FROM benutzer WHERE username=$username");
if ($delete_query) {
mysqli_close($link);
echo "Record deleted successfully";
exit;
} else {
echo mysqli_close($link);
}
}
EDIT:
Easier way to do it
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pannel</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
<style type="text/css">
body {
font: 14px sans-serif;
text-align: center;
}
</style>
</head>
<body>
<div class="page-header">
<h1> Admin Pannel</h1>
</div>
<div>
</div>
</body>
</html>
<?php
session_start();
require('config.php');
$strSQL = "SELECT username, email, type FROM benutzer";
$rs = mysqli_query($link, $strSQL);
echo "<table border='1' style='margin: 0 auto'>
<tr>
<th class='text-center'>Name / Vorname</th>
<th class='text-center'>Email</th>
<th class='text-center'>Type</th>
<th class='text-center'>Modify</th>
<th class='text-center'>Delete</th>
</tr>";
while ($row = mysqli_fetch_array($rs)) {
echo "<tr>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['type'] . "</td>";
echo "<td><a href='pannel.php?delete=".$row['username']."'>Delete ".$row['username']."</a></td>";
echo "<td><a href='pannel.php?modify=".$row['username']."'>Modify ".$row['username']."</a></td>";
echo "</tr>";
}
echo "</table>";
if (isset($_GET['modify'])) {
$username = $_GET['modify'];
$modify_query = mysqli_query($link, "UPDATE benutzer SET type='Mitarbeiter, Chef' WHERE username=$username");
if ($modify_query) {
mysqli_close($link);
header("location:welcome.php");
exit;
} else {
echo mysqli_close($link);
}
} else if (isset($_GET['delete'])) {
$username = $_GET['delete'];
$delete_query = mysqli_query($link, "DELETE FROM benutzer WHERE username=$username");
if ($delete_query) {
mysqli_close($link);
echo "Record deleted successfully";
exit;
} else {
echo mysqli_close($link);
}
}
I have a data table to show on the table one row is called "address". There are only two types of address can be output "dhaka" and "yaka" . I want to show the font colour as red when the output is "dhaka" and green when the output is "yaka".
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dashboard</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.js"></script>
<style type="text/css">
.wrapper{
width: 650px;
margin: 0 auto;
}
.page-header h2{
margin-top: 0;
}
table tr td:last-child a{
margin-right: 15px;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});
</script>
</head>
<body>
<div class="wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<?php
require_once "config.php";
$sql = "SELECT * FROM student_record";
if($result = mysqli_query($conn, $sql)){
if(mysqli_num_rows($result) > 0){
echo "<table class='table table-bordered table-striped table-hover '>";
echo "<thead>";
echo "<tr>";
echo "<th>#</th>";
echo "<th>Name</th>";
echo "<th>Address</th>";
echo "<th>Marks</th>";
echo "<th>Action</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while($row = mysqli_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['address'] . "</td>";
echo "<td>" . $row['marks'] . "</td>";
echo "<td>";
echo "<a href='read.php?id=". $row['id'] ."' title='View
Record' data-toggle='tooltip'><span class='glyphicon glyphicon-eye-open'></span></a>";
echo "<a href='update.php?id=". $row['id'] ."' title='Update
Record' data-toggle='tooltip'><span class='glyphicon glyphicon-pencil'></span></a>";
echo "<a href='delete.php?id=". $row['id'] ."' title='Delete
Record' data-toggle='tooltip'><span class='glyphicon glyphicon-trash'></span></a>";
echo "</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
mysqli_free_result($result);
} else{
echo "<p class='lead'><em>No records were found.</em></p>";
}
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($conn);
}
mysqli_close($conn);
?>
<form method="post" action="search1.php?go" id="searchform">
<input type="text" name="name">
<input type="submit" name="submit" value="Search">
</form>
</div>
</div>
</div>
</div>
</body>
</html>
You need to actually use if elseif statements:-
<?php
if ($row['address'] == 'dhaka') {
$color = 'RED';
} elseif ($row['address'] == 'yaka') {
$color = 'GREEN';
}
echo "<td><span style=\"color: $color\">" . $row['address'] . "</span></td>";
Please try to include this code inside while loop
if($row['address'] =='dhaka'){$color='red';}
else{$color='green';}
And update the address line with
echo "<td style='color:'.$color.'>" . $row['address'] . "</td>";
I want to have a table that contains words and their meaning from database, in another column i want to have checkbox for each row, that user will check them and show what words he/she know.
i have two question in this case:
1- how can i hide the meaning in the first and after clicking in show meaning visible them?
2- how can i set checkboxes?
i have this code until now but it doesn't work
please help me if you can
<script type="text/javascript">
function ShowMeanings(){
document.getElementsByClassName('hiding').item(0).style.visiblility = 'visible';
}
</script>
<?php
$con = mysql_connect("localhost", "root", "")
or die(mysql_error());
if (!$con) {
die('Could not connect to MySQL: ' . mysql_error());
}
mysql_select_db("project", $con)
or die(mysql_error());
$result = mysql_query("select * from words");
echo "<table border='1'>
<tr>
<th>word</th>
<th>meaning</th>
<th>check</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['word'] . "</td>";
echo "<td>";
echo "<div";
echo "class='hiding' style='visibility:hidden'>" . $row['meaninig'];
echo "</div>";
echo "</td>";
echo "<td>";
echo "<input";
echo "type= 'checkbox' name = 'checkbox' id = 'checkbox' value = '' />";
echo "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
</div>
<button onclick="ShowMeanings()">showmeaning</button>
getElementByClassName is an inexistant function. You mean getElementsByClassName, which will however return a list of the elements, so you need to select one.
document.getElementsByClassName('hiding').item(0).style.visibility = 'visible';
For hide a suggestion:
echo "class='hiding' style='display:none'>" . $row['meaninig'];
To show the meaning:
//for Jquery
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
function ShowMeanings(){
$('.hiding').shoW();
}
</script>
Or
//for plain old javascript
<script type="text/javascript">
function ShowMeanings(){
document.getElementsByClassName('hiding').style.visibility = 'visible';
}
</script>
Your code Edited:
<html><head>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
function ShowMeanings(){
$('.hiding').shoW();
}
</script>
</head>
<body>
<?php
$con = mysql_connect("localhost", "root", "")
or die(mysql_error());
if (!$con) {
die('Could not connect to MySQL: ' . mysql_error());
}
mysql_select_db("project", $con)
or die(mysql_error());
$result = mysql_query("select * from words");
echo "<table border='1'>
<tr>
<th>word</th>
<th>meaning</th>
<th>check</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['word'] . "</td>";
echo "<td>";
echo "<div";
echo "class='hiding' style='display:none'>" . $row['meaninig'];
echo "</div>";
echo "</td>";
echo "<td>";
echo "<input";
echo "type= 'checkbox' name = 'checkbox' id = 'checkbox' value = '' />";
echo "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
</div>
<button onclick="ShowMeanings()">showmeaning</button>
</body>
I really need some help about how to pass returndate value in next page(save.php). the value that i cant' pass was under this "(input type='hidden' name='retDate[$i]' value='$retDate')".
I'm using calendar datepicker at this website(http://www.triconsole.com/php/calendar_datepicker.php). Appreciate if someone can help me about this and do refer below for my coding.
under "result.php"
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"></br>
<h1>RESULT </h1>
<p><b>Escalation Date : </b>
<?php echo $_POST["date1"] ?> until <?php echo $_POST["date2"] ?>
</p>
<?php
......
//Select database
$selected = mssql_select_db($myDB, $link)
or die("Couldn't open database $myDB");
//declare the SQL statement that will query the database
$query = "SELECT.....";
//execute the SQL query and return records
if ($result = mssql_query($query, $link)){
echo "<form name='form1' method='post' action='save.php'>";
echo "<table border='1'>
<tr>
<th>batch_exception_id</th>
<th>batch_id</th>
<th>process_date_time</th>
<th>Return Date</th>
</tr>";
$i=0;
while ($row = mssql_fetch_assoc($result)) {
$rDate = $row['ReturnDate'];
$beID = $row['batch_exception_id'];
$proc_dt = $row['process_date_time'];
echo "<tr>";
echo "<td>" . $beID . "<input type='hidden' name='beID[$i]' value='$beID'/></td>";
echo "<td>" . $row['batch_id'] . "</td>";
echo "<td>" . $proc_dt . "<input type='hidden' name='procDT[$i]' value='$proc_dt'/></td>";
if($rDate == ""){
echo "<td>";
$f_name="retDate[".$i."]";
$myCalendar = new tc_calendar($f_name, true, false);
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setDate(date('d'), date('m'), date('Y'));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(2000, 2020);
$myCalendar->dateAllow('2000-01-01', '2020-01-01');
$myCalendar->setDateFormat('j F Y');
$myCalendar->setAlignment('left', 'bottom');
//$myCalendar->setSpecificDate(array("", "0", "0"), 0, 'year');
//$myCalendar->setSpecificDate(array("0", "0"), 0, 'month');
//$myCalendar->setSpecificDate(array("0"), 0, '');
$myCalendar->writeScript();
echo "<input type='hidden' name='retDate[$i]' value='$retDate'/>";
//echo "<input type='hidden' name='retDate[$i]' value='".$myCalendar->getDate()."'/>";
$i++;
echo "</td>";
} else {
echo "<td>" . $rDate . "</td>";
}
echo "</tr>";
}
echo "</table><br/>";
echo "<input type='button' value='<<' onclick='history.back(-1)'/>";
echo "<input type='hidden' name='total_rec' value='$i'/>";
echo "<input type='submit' value='Save'/>";
echo "<input type='button' value='Print' onclick='window.print()'/>";
echo"</form>";
}
//close the connection
mssql_close($link);
?><br/>
</body>
under "save.php"
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"></br>
<?php
//$ReturnDate = $_POST["rDate"];
$arrbeID = $_POST["beID"];
$tot_rec = $_POST["total_rec"];
$arrprocDT = $_POST["procDT"];
$arrretDate = $_POST["retDate"];
for ($i=0; $i<$tot_rec;$i++) {
echo "Batch Esc. ID: ".$arrbeID[$i]."
| Proc. DateTime: ".$arrprocDT[$i]."
| Ret. Date: ".$arrretDate[$i]."
<br>";
}
?><br/>
</body>
I think you need this line:
echo "<input type='hidden' name='retDate[$i]' value='$retDate'/>";
to be:
echo "<input type='hidden' name='retDate[$i]' value='$rDate'/>";
because $rDate is where you have actually stored the return date that you fetched from the database:
$rDate = $row['ReturnDate'];
solution:-
Put below sript under head in Result.php
<link rel="stylesheet" title="Style CSS" href="cwcalendar.css" type="text/css" media="all" />
<script type="text/javascript" src="calendar.js"></script>
Add below code under body in Result.php
$date="date[".$i."]";
echo "<input type='text' name='date[$i]' id='$date' value=' ' onclick=\"fPopCalendar('".$date."')\">";
script reference:
http://codetale.com/2009/06/21/javascript-calendar-widget-108/
I am new to web dev, PHP, CSS and html. I want to put a CSS in my table displaying the data on my database, but it doesn't work.
Here is my code:
My CSS file is named "table.css" ...
<html>
<head>
<title>WEW</title>
<head>
<link href="table.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
$con = mysql_connect("localhost","abc123","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database_ME", $con);
$result = mysql_query("SELECT * FROM id");
$data->set_css_class("table");
echo "<table class="table">
<tr>
<th>id</th>
<th>password</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['password'] . "</td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";
mysql_close($con);
?>
</body>
</html>
I'm assuming the CSS file is well written, and that it uses the .table selector.
There's several syntax errors in there, all because you need to escape the inner " like so:
echo "A 'string with several \"nesting\" levels' needs escaping.";
echo "<table class="table">
change to
echo "<table class='table'>
AND
echo "<tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">";
change to
echo "<tr onmouseover=\"this.style.backgroundColor='#ffff66';\" onmouseout=\"this.style.backgroundColor='#d4e3e5';\">";