Jump to content

[SOLVED] I'm being stupid and I've overlooked something


haakuturi

Recommended Posts

hey people - first post and I'm making a fool of myself already lol

 

here's my code:

 

<!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>
<title>CDDB@HOME :: Add New Artist</title>
<meta http-equiv="content-type"
    content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php if (isset($_POST['ArtistName'])):

  // A new author has been entered
  // using the form below.

  $dbcnx = @mysql_connect('xxxxx', 'xxxxx', 'xxxxx');
  if (!$dbcnx) {
    exit('<p>Unable to connect to the ' .
        'database server at this time.</p>');
  }

  if (!@mysql_select_db('cddb')) {
    exit('<p>Unable to locate the ' .
        'database at this time.</p>');
  }

  $name = $_POST['ArtistName'];
  $sql = "INSERT INTO TblArtist SET
      ArtistName='$ArtistName'";
  if (@mysql_query($sql)) {
    echo '<p>New artist added</p>';
  } else {
    echo '<p>Error adding new artist: ' .
        mysql_error() . '</p>';
  }

?>

<p><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Add another artist</a></p>
<p><a href="manageartists.php">Return to artist list</a></p>

<?php else: // Allow the user to enter a new author ?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<p>Enter the new artist:</p>
<label>Name: <input type="text" name="ArtistName" /></label><br />
<input type="submit" value="SUBMIT" />
</form>

<?php endif; ?>

</body>
</html>

 

Now what's happening is that when I add a new artist, I'm told that it was successfully added, but when I view the artists, there's a blank space! I haven't got a screenshot of it, but here's the general idea:

 

Manage Artists
Sarah McLachlan Edit Delete
Placebo Edit Delete
Deep Forest Edit Delete
Edit Delete
Enigma Edit Delete
Natalie Merchant Edit Delete
Edit Delete
Edit Delete

 

Any clues? Please? I just know it's something really really obvious that I just can't see :(

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.