Digitry Designs Posted April 28, 2010 Share Posted April 28, 2010 Ok so I am trying to send information from a form to a data base. I keeps giving me an error, to be specific, the error for querying the database. Any suggestions? Thank you in advance. <?php $name = $_POST['name']; $organization = $_POST['organization']; $phone = $_POST['phone']; $email = $_POST['email']; $description = $_POST['description']; $dbc = mysqli_connect('localhost', 'root', 'password', 'my_database') or die('We are sorry, due to extensive server overload we were unable to process your mail.'); $query = "INSERT INTO mail (name, organization, phone, email, description) " . "VALUES ('$name', '$organization', '$phone', '$email', '$description')"; $result = mysqli_query($dbc,$query) or die('We are sorry, your email could not be sent at this time. Please try again in a few minutes'); mysqli_close($dbc); echo '<meta HTTP-EQUIV="REFRESH" content="0; url=../admin/digitrycms_panel.php">'; ?> Link to comment https://forums.phpfreaks.com/topic/200080-having-trouble-querying-my-database-can-someone-please-help/ Share on other sites More sharing options...
jdavidbakr Posted April 28, 2010 Share Posted April 28, 2010 Add mysql_error() to your "die" section to see why the query is failing. Link to comment https://forums.phpfreaks.com/topic/200080-having-trouble-querying-my-database-can-someone-please-help/#findComment-1050131 Share on other sites More sharing options...
Digitry Designs Posted April 28, 2010 Author Share Posted April 28, 2010 Add mysql_error() to your "die" section to see why the query is failing. how would I add that? "or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/200080-having-trouble-querying-my-database-can-someone-please-help/#findComment-1050133 Share on other sites More sharing options...
AdRock Posted April 28, 2010 Share Posted April 28, 2010 yes Link to comment https://forums.phpfreaks.com/topic/200080-having-trouble-querying-my-database-can-someone-please-help/#findComment-1050161 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.