Sunday 15 August 2010

mysql - Why does this php code not send its data to the database? -


I had asked a question before, but I had to change my code a bit and I still could not understand that my database was an entry I am new to php and I am following a book where you can get the source code.

I do not get any error messages after running the code, but my code is the way I want it and I believe this is because the data is not being kept in the database, The rest of the code depends on it.

My code is where to send data to the database starting at line 66

For whatever reason my code posts anything to the database, I really helped anybody I appreciate

Here's my code:

   
" This image prints "} Catch (exception $ E) {Dead ($ e-> getMessage) );}} And {$ img_path = NULL;} // include database credentials and include in the database_on 'db.inc.php'; $ Db = new PDO (DBNXFO, DB_USER, DB_ PASS); "Image Path" resonates Is $ img_path, "& lt; //; go out; Go out; Do not echo "in the book" but here at source; // Edit an existing entry if (empty ($ _ POST ['id'])) {$ sql = "Entry Entries SET title =?, Entry =?, Url =? WHERE id =? LIMIT 1 "; $ Stmt = $ db- & gt; Ready ($ sql); $ Stmt-> Execution (array ($ _POST ['title'], $ img_path, $ _POST ['entry'], $ url , $ _POST ['id'])); $ Stmt-> closeCursor ();} // Create a new entry // Line 66 {// enter $ sql = "entries to save the entry in the database (Page, title, image, entry, url) value (?,?,?,?,?) "; $ Stmt = $ db- & gt; Ready ($ sql); $ Stmt-> Execution (array $ _ POST ['page'], $ _POST ['title'], $ img_path, $ _POST ['entry'], $ url); $ stmt- & gt; closeCursor (); // for successful URL usage Page key Store the information $ page = htmlentities (Strip_tags ($ _ POST ['page']); // Send the user to the new entry; "Hopefully we come here"; Header ('location: / simple_blog /' Page. '' ''.); Go out;}} and {header ('location: ../'); go out;}? & Gt;

You have to bind the results in the query using $ stmt-> bind_result, after which you have to execute without any arguments.

No comments:

Post a Comment