Code: Select all
<?php # update.php
require_once ('mysql_connect.php'); // Connect to the database.
require_once ('config.inc');
if (isset($_GET['song_id'])) { //
$query = "SELECT * FROM uploads,images,albums,artists WHERE uploads.image_id = images.image_id AND uploads.album_id = albums.album_id AND uploads.artist_id = artists.artist_id AND song_id={$_GET['song_id']} ";
$result = mysql_query ($query);
$row = mysql_fetch_array ($result, MYSQL_ASSOC);
?>
<?php
require_once ('mysql_connect.php'); // Connect to the database.
require_once ('config.inc');
if (isset($_POST['submit'])) { // Handle the form.
// Check for a song name.
if (!empty($_POST['song_title'])) {
$st = escape_data($_POST['song_title']);
} else {
$st = FALSE;
echo '<p><font color="red">Please enter the song\'s title!</font></p>';
}
if ($st) {
$query1 = "UPDATE uploads SET song_title='$st' WHERE song_id = {$_GET['song_id']} ";
$result = @mysql_query ($query1);
if ($result) {
echo '<p>The song details have been added.</p>';
} else { // If the query did not run OK.
echo '<p><font color="red">Your submission could not be processed due to a system error.</font></p>';
}
} else { // Failed a test.
echo '<p><font color="red">Please click "back" and try again. Possible duplicate entries either in song title or artist name or album title!</font></p>';
}
} else { // Display the form.
?>
<fieldset>
<legend><font face="Palatino Linotype, Verdana, Arial"><strong>Fill out the form to add a song to the database</strong></font></legend>
<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="13631488">
<table width="100%" border="0" cellspacing="4" cellpadding="0">
<tr>
<td width="14%"><b>Song Title:</b></td>
<td colspan="2"><input type="text" name="song_title" size="30" maxlength="60" value="<?php echo $row['song_title']; if (isset($_POST['song_title'])) echo $_POST['song_title']; ?>" /></td>
</tr>
<tr>
<td> </td>
<td colspan="2"><input type="submit" name="submit" value="Update" />
<input type="reset" name="reset" value="Reset" />
</td>
</tr>
</table>
</fieldset>
<div align="center"></div>
</form><!-- End of Form -->
<?php
} }// End of main conditional.
?>
</body>
</html>feyd | Please review how to post code using
Code: Select all
andCode: Select all
tags. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]