Note that there are some explanatory texts on larger screens.

plurals
  1. POError Updating Database with PHP
    primarykey
    data
    text
    <p>I'm currently attempting to insert data into a MySQL database using PHP. To help, I am following <a href="http://teamtutorials.com/web-development-tutorials/php-tutorials/inserting-data-into-a-mysql-database-using-php" rel="nofollow">this</a> tutorial.</p> <p>Thus far, I have taken the following steps:</p> <ul> <li>Manually created a database via phpMyAdmin named "core_group_me" on my WAMPSERVER</li> <li><p>Created a form page named "form.php" (code below):</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form method="post" action="update.php"&gt; Username:&lt;br /&gt; &lt;input type="text" name="id" size="30" /&gt;&lt;br /&gt; First Name:&lt;br /&gt; &lt;input type="text" name="firstname" size="30" /&gt;&lt;br /&gt; Last Name:&lt;br /&gt; &lt;input type="text" name="lastname" size="30" /&gt;&lt;br /&gt; Email:&lt;br /&gt; &lt;input type="text" name="email" size="30" /&gt;&lt;br /&gt; Location:&lt;br /&gt; &lt;input type="text" name="location" size="30" /&gt;&lt;br /&gt; Expertise:&lt;br /&gt; &lt;input type="text" name="expertise" size="30" /&gt;&lt;br /&gt;&lt;br /&gt; &lt;input type="submit" value="Update Database" /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre></li> <li><p>Created a page to update the "core_group_me" database named "update.php" (code below):</p> <pre><code>&lt;?php $id = $_POST['id']; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $email = $_POST['email']; $location = $_POST['location']; $expertise = $_POST['expertise']; mysql_connect ("localhost", "core_group_me", "") or die ('Error: ' .mysql_error()); mysql_select_db ("members"); $query="INSERT INTO members (id, firstname, lastname, email, location, expertise)VALUES ('".$id."', '".$firstname."', '".$lastname."', '".$email."', '".$location."', '".$expertise."')"; mysql_query($query) or die ('Error updating database'); echo "Database Updated With: " .$id. " " .$firstname. " ".$lastname. " ".$email. " " .$location. " " .$expertise ; ?&gt; </code></pre></li> </ul> <p>That being said, when I open up the "form.php" page, input information in the specified fields and submit everything, I receive the the following error: "Error updating database". I'm <em>very</em> new to programming in PHP and working with MySQL databases, so I honestly have absolutely no idea where I've gone wrong. Any help would be much appreciated!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload