Use select with database, doesn`t show anything<

liunx

Guest
hey guys i studied this script for hours now but can`t find an asnwer.

<html>
<head>
<title>Change Cat</title>
</head>
<body>
<?php
include ("dbconnect.php");
if ($button && $name) {
$sql = "UPDATE Download _system SET name='$name' WHERE s_id=$sid";
if (!mysql_query($sql)) {
echo "Change system denied!";
exit;
}
echo "OK, system name is now $name.";
} else {
?>
<form method="post" action="<?php echo $PHP_SELF ?>">
Select system: <select name="sid">
<?php
$sql = "SELECT * FROM Download _system";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
echo "<option value=\"";
echo $row["s_id"]."\">";
echo $row["name"]."</option>\n";
}
?>
</select><br>
New Name: <input type="text" name="name"><br>
<input type="submit" name="button" value="change">
</form>
<?php
}
?>
</body>
</html>

If i only use select*from donwload_system in min ephpmyadmin, then it shows some result but with this script i don`t got any result ??is that the only page? you don't show any connection to the db.That is included in a dbconnect.php file,

The connection is working, i also uses it with other scripts
<?
mysql_connect("localhost", "******", "*****")or
die ("Could not connect to database");
?>sorry not sure how I missed that. ok, so you connect, what about the selecting the db?

what is in the file? cause I don't see anythign wrong with the query or the code.OOps :o totaly forgot to select the database itself.

Works fine now
 
Back
Top