Evo tog fajla
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>PHP Project</title>
<link href="http://fonts.googleapis.com/css?family=Oswald:400,300" rel="stylesheet" type="text/css" />
<link href="styledatabase.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
<div id="menu-wrapper">
<div id="menu" class="container">
<ul>
<li><a href="index.php">Homepage</a></li>
<li class="current_page_item"><a href="1-select.php">Update Database</a></li>
<li><a href="newfile1.php">Insert Into</a></li>
</ul>
</div>
</div>
<div id="header">
<div id="logo" class="container">
<p><?php
include("db_config.php");
$sql = "SELECT * FROM proizvodi";
$result = mysql_query($sql) or die(mysql_error());
//mysql_query — Send a MySQL query
echo "<table border=\"1\" align=\"center\">";
echo "<tr><th>Name</th><th>Type</th><th>Price( in $ )</th></tr>";
if (mysql_num_rows($result)>0)
//mysql_num_rows — Get number of rows in result
{
while ($record = mysql_fetch_array($result))
//mysql_fetch_array — Fetch a result row as an associative array, a numeric array, or both
echo "<tr><td>$record[name]</td><td>$record[s_type]</td>
<td>$record[price]</td>
<td><a href=\"5-from_db.php?id=$record[0]\">Change </a> </td>
<td><a href=\"3-delete.php?id=$record[0]\">Remove </a> </td></tr>";
}
else
{
echo "There is no data in the database!";
}
echo "</table>";
mysql_free_result($result);
//mysql_free_result — Free result memory
mysql_close($connection);
//mysql_close — Close MySQL connection
?></p>
<p> <p> <div></div>
</p></p>
</div>
</div>
</body>
</html>
i dbconfig(imao sam neke svoje tu podatke kao user i passwd, ali sam vratio na root, root)
<?php
$host = "localhost";
$username = "root";
$password = "root";
$db = "genvironment";
$connection = mysql_connect("$host", "$username", "$password") or die(mysql_error());
mysql_select_db("$db",$connection) or die(mysql_error());
?>
U phpmy admin izbaci gresku tipa
A to izbaci jer sam promenio ovde na root(sto koliko shvatam da treba, ako sam u dbconfig stavio da root ima sifru)
|