pixy Posted June 13, 2006 Share Posted June 13, 2006 Alrighty, I know it's connected because if it couldn't connect to the database it has an error message to give me. So, the problem is when I attempt to add a new advertisement, it tells me table 'ads.danceinside_monica' doesn't exist. However, I know table 'ads' exists, but it shouldn't be concatenating the two...This is my code for ads.php?action=add. Please tell me if you see something I dont--because I've been trying to get to this work. O_O[code]elseif ($action=='add') { $errors = array(); if (isset($_POST['submitted'])) { if (empty($_POST['name'])) { $errors[] = 'You forgot to enter a name!'; } else { $name = $_POST['name']; } if (empty($_POST['banner'])) { $errors[] = 'You forgot to link to a banner!'; } else { $banner = $_POST['banner']; } if (empty($_POST['url'])) { $errors[] = 'You forgot to enter a url!'; } else { $url = $_POST['url']; }// Check for errors in the $errors array if (empty($errors)) { $query = "INSERT INTO ads (name, banner, url) VALUES ('$name', '$banner', '$url')"; $result = @mysql_query($query) or die(mysql_error()); if ($result) { echo "<b>Advertisements updated successfully!</b><p> If you would like to add another banner, <a href=\"ads.php?action=add\">click here</a>."; mysql_free_result ($result); mysql_close(); } else { print 'Couldn\'t insert information into database.'; } } else { print '<b>Error!</b><br>'; foreach ($errors as $msg) { echo "- $msg<br>"; } mysql_free_result ($result); mysql_close(); } } else { print "To add a new banner, fill in the information below:"; echo '<form action="ads.php?action=add" method="post"> <b>Name:</b> <input type="text" name="name" size="15"> <br><b>Banner Img:</b> <input type="text" name="banner" size="15" value="http://"> <br><b>Links to:</b> <input type="text" name="url" size="15" value="http://"> <input type="hidden" name="submitted" value="TRUE"> <center><input type="submit" name="submit" value="Add New Advertisement"></center></form>'; }}[/code] Quote Link to comment Share on other sites More sharing options...
pixy Posted June 14, 2006 Author Share Posted June 14, 2006 Bump? Does anyone know why I'm having this problem? Quote Link to comment 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.