Posts

Showing posts with the label pdo

query insert only one row instead multiple rows

query insert only one row instead multiple rows I was trying to insert multiple values from the excel sheet, I got all data from excel sheet to an array variable. but when I insert it always inserts the 1st row only, I have a method to execute insert query by using PDO, My Data array (size=4) 1 => array (size=5) 'A' => string '*' (length=1) 'B' => string 'Title' (length=5) 'C' => string 'Author' (length=6) 'D' => string 'Publication ' (length=12) 'E' => string 'Container' (length=9) 2 => array (size=5) 'A' => float 1 'B' => string 'Test' (length=4) 'C' => string 'one' (length=3) 'D' => string 'two' (length=3) 'E' => string 'X1' (length=2) 3 => array (size=5) 'A' => float 2 'B' => string ...

nr. bound variables, missmatch number tokens

nr. bound variables, missmatch number tokens Hi I have been scanning the answers on this subject but they seem to be individual at most, so here goes. My code is from a free repository and it works when I remove the addition I have maid. I added "uname" because I wanted the users to be greeted by their name and not their username. It may be stupied but I like it this way. But I am missing something. My code is here: <?php // First we execute our common code to connection to the database and start the session require("common.php"); // At the top of the page we check to see whether the user is logged in or not if(empty($_SESSION['username'])) { // If they are not, we redirect them to the login page. header("Location: login.php"); // Remember that this die statement is absolutely critical. Without it, // people can view your members-only content without logging in. die("Redirecti...

Notice: Trying to get property 'id' of non-object in C:

<b>Notice</b>: Trying to get property 'id' of non-object in <b>C: When i tried to update or delete it give this notice <b>Notice</b>: Trying to get property 'id' of non-object in <b>C:UsersHusam Al-MasriPhpstormProjectsTODOapitasksupdate.php</b> on line <b>24</b><br /><br /> <b>Notice</b>: Trying to get property 'taskName' of non-object in <b>C:UsersHusam Al-MasriPhpstormProjectsTODOapitasksupdate.php</b> on line <b>25</b><br /> <br /> <b>Notice</b>: Trying to get property 'taskDescription' of non-object in <b>C:UsersHusam Al-MasriPhpstormProjectsTODOapitasksupdate.php</b> on line <b>26</b><br /> {"message": "task was updated."} in get and create the code worked, whats the wrong in my update code? I search in stackoverflow with the same title but i see every body has a case differe...

[PDO]collect data from database

[PDO]collect data from database I was follow this Guide to collect Questions from database after I reach the last question it keep repeat the same last question instead of displaying massage here is my code //////// Collected from databse /////// $question_id=$question_id+1; $no_questions = $dbo->query("select count(question) from questions left join servey_question on questions.question_id = servey_question.question_id where servey_id = 'serv01' ")->fetchColumn(); if($question_id > $no_questions){ $next='F'; // Flag is set to display thank you message }else{ $next='T'; // Flag is set to display next question $count=$dbo->prepare("select * from questions where question_id=$question_id"); if($count->execute()){ $row = $count->fetch(PDO::FETCH_OBJ); } } $main= array("data"=>array("q1"=>"$row->question","opt1"=>"$row->opt1","opt...