haakuturi Posted July 7, 2007 Share Posted July 7, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/58823-solved-im-being-stupid-and-ive-overlooked-something/ Share on other sites More sharing options...
sasa Posted July 7, 2007 Share Posted July 7, 2007 change $name = $_POST['ArtistName']; $sql = "INSERT INTO TblArtist SET ArtistName='$ArtistName'"; to $name = $_POST['ArtistName']; $sql = "INSERT INTO TblArtist SET ArtistName='$name'"; Quote Link to comment https://forums.phpfreaks.com/topic/58823-solved-im-being-stupid-and-ive-overlooked-something/#findComment-291826 Share on other sites More sharing options...
haakuturi Posted July 8, 2007 Author Share Posted July 8, 2007 lol thanks Quote Link to comment https://forums.phpfreaks.com/topic/58823-solved-im-being-stupid-and-ive-overlooked-something/#findComment-292390 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.