Hi,
I am trying to create an update script for my mysql database but cant get the thing to work 🙁
Heres the update script (update.php):
<?
// Connect to the database
$db = mysql_connect("localhost","epidemic_XTC","1311996");
mysql_select_db ("epidemic_test5");
// Ask the database for the information from the links table
$query="SELECT FROM links WHERE id='$id'";
$result = mysql_query("SELECT FROM links");
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$date=mysql_result($result,$i,"date");
$venue=mysql_result($result,$i,"venue");
$info=mysql_result($result,$i,"info");
?>
<form action="updated.php">
<input type="hidden" name="ud_id" value="<? echo "$id"; ?>">
Date: <input type="text" name="ud_date" value="<? echo "$date"?>"><br>
Venue: <input type="text" name="ud_venue" value="<? echo "$venue"?>"><br>
Info: <input type="text" name="ud_info" value="<? echo "$info"?>"><br>
<input type="Submit" value="Update">
</form>
<?
++$i;
}
?>
Heres updated.php
<?php
// Connect to the database
$db = mysql_connect("localhost","epidemic_XTC","1311996");
mysql_select_db ("epidemic_test5");
// Ask the database for the information from the links table
$query="UPDATE links SET date='$ud_date', venue='$ud_venue', info='$ud_info' WHERE id='$ud_id'";
@mysql_select_db($database) or die( "Unable to select database");
mysql_query($query);
echo "Record Updated";
mysql_close();
?>
I keep getting a blank page with "Unable to select database" after pressing 'update' on update.php
Can anyone help ?