Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't Insert data into MySQL using PHP
    primarykey
    data
    text
    <p>I am stumped :( I've done searches and have tried many variations but can't seem to pin point my problem so alas here I am. </p> <ul> <li><em>First off I'm new at this and I am learning through web searches and experimentation so please before you rip me a new one for being a noob just keep in mind that I am a noob and have admitted it and would rather talk about my solution rather than anything else.</em> </li> </ul> <p><strong>Project</strong>: Trying to make a little web app that allows me to insert comic book information into a mysql database. I have built the form to accept the data and pass it to my php page which does the insert into mysql. </p> <ul> <li>This is a self app / This will not have exposure to the outside world / while I know and am currently developing data checks I need to get info into the DB before collection gets out of hand. </li> </ul> <p>Here is the code that I currently have. I've tried so many variations that I don't know which way is up....</p> <pre><code>$idcomic_db = $_POST['idcomic_db']; $publisher = $_POST['publisher']; $comic_name = $_POST['comic_name']; $comic_num = $_POST['comic_num']; $comic_cover = $_POST['comic_cover']; $price_paid = $_POST['price_paid']; $quantity = $_POST['quantity']; $sql_insert = "INSERT INTO `comic_info_db`.`comic_db` (`idcomic_db`, `publisher`, `comic_name`, `comic_num`, `comic_cover`, `price_paid`, `quantity`) VALUES ('$idcomic_db', '$publisher', '$comic_name', '$comic_num', '$comic_cover', '$price_paid', '$quantity')"; $mysql_con = mysqli_query($sql_insert, $con); $error = mysqli_error($mysql_con); ?&gt; &lt;!-- HTML Header Information --&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;link rel="stylesheet" type="text/css" href="/style/style.css"&gt; &lt;head&gt; &lt;title&gt;Comic Database Results&lt;/title&gt; &lt;meta http-equiv="content-type" content="text/html;charset=utf-8" /&gt; &lt;/head&gt; &lt;!-- HTML Body Area --&gt; &lt;body&gt; &lt;?php echo "$idcomic &lt;br /&gt;"; echo "$publisher &lt;br /&gt;"; echo "$comic_name &lt;br /&gt;"; echo "$comic_num &lt;br /&gt;"; echo "$comic_cover &lt;br /&gt;"; echo "$price_paid &lt;br /&gt;"; echo "$quantity &lt;br /&gt;"; echo "&lt;br /&gt;"; echo $sql_insert; echo $error; ?&gt; &lt;?php // Close Connection mysqli_close($con); ?&gt; </code></pre> <p>I've got some code I was playing with to do checks against values but alot of the values are set in the form itself. </p> <p>Also I was doing those echos at the end just to see the values coming over from the html form and I've also got some other code that is the connection info to the DB as well as the error (if there is one) and that comes back just fine. </p> <p>Any help would be great. I apologize again if this is simple I can't seem to get it so I throw myself on the alter. </p>
    singulars
    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