Note that there are some explanatory texts on larger screens.

plurals
  1. POPhp Query into database Fail?
    text
    copied!<p>I want to insert data into my database that is setup like this </p> <h2>Table</h2> <ul> <li>name varchar(35)</li> <li>department varchar(50)</li> <li>rating smallint(6)</li> <li>easiness smallint(6)</li> <li>textbook varchar(3)</li> <li>timestamp timestamp</li> <li>course char(10)</li> <li>curve char(3)</li> <li>comment text</li> </ul> <p>I insert the data with a query like this one below, and it doesnt actually insert into the database, the page reloads and thats it. here is the result from <code>print_r()</code> and <code>var_dump()</code>. The actual query function is below. What can be the issue? I'm thinking it can be the text type overflow of some sort. But I cant figure it out, thanks for your help</p> <p><code>print_r()</code> Result:</p> <pre><code>insert into professor(name,department,rating,easiness,textbook,course,curve,comment)values('Cherry, Mark','HUMANITIES','8','8','yes','PHIL 3311','no','Go to class. He doesn't require it but it will make the difference between an A or a B. It's very difficult to do anything without being in class. He gives all the answers you need so long as you show up. He's a very good teacher and I would recommend him to someone else') </code></pre> <p><code>var_dump()</code> Result:</p> <pre><code>string(424) "insert into professor(name,department,rating,easiness,textbook,course,curve,comment)values('Cherry, Mark','HUMANITIES','8','8','yes','PHIL 3311','no','Go to class. He doesn't require it but it will make the difference between an A or a B. It's very difficult to do anything without being in class. He gives all the answers you need so long as you show up. He's a very good teacher and I would recommend him to someone else')" bool(false) </code></pre> <p>Here is my code:</p> <pre><code>function processadd() { $name =htmlentities($_POST['prof']); $department =htmlentities($_POST['depart']); $rating =htmlentities($_POST['Rating']); $easy=htmlentities($_POST['Easiness']); $textbook =htmlentities($_POST['Book']); $course =htmlentities($_POST['course']); $curve =htmlentities($_POST['curve']); $comment =htmlentities($_POST['comment']); if($course == "" || $comment == "") { print"&lt;div class=error&gt;&lt;h3&gt; Empty Fields exist!, please fill out completely&lt;/h3&gt;&lt;/div&gt;"; } else { $db = adodbConnect(); $query = "insert into professor(name,department,rating,easiness,textbook,course,curve,comment)values('$name','$department','$rating','$easy','$textbook','$course','$curve','$comment')"; $result = $db -&gt; Execute($query); } print_r($query); print_r($result); print"&lt;br&gt;"; print"&lt;br&gt;"; print"&lt;br&gt;"; var_dump($query); var_dump($result); } </code></pre>
 

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