PDO::PARAM_STR and PDO::PARAM_INT not giving error

Tags: php oop
$sql = $pdo->prepare("INSERT INTO test(name,city)VALUES(:vary,'china')");
$sql->bindParam('vary',$vary, PDO::PARAM_STR);

This should give error because i am not using string, for :vary parameter . but this is working fine and insert a row in table test. can someone explain why there is no error, i find same question on stackoverflow Php PDO::bindParam data types.. how does it work? But i am still confused, can someone PLEASE explain better..

By : beginner


This doesn't give you any errors because of PHP's type juggling. In other words: PHP silently casts the integer 1234 into the string 1234, when you try to use it as a string.

Read more about the type juggling in the PHP manual.

You have to get the collection object first as mentioned below

  var collection = db.collection("simple_document_insert_collection_no_safe");

// Insert a single document collection.insert({hello:'world_no_safe'});

Please refer the below link for more details.

mongod db collection using nodejs

I think you could rewrite this as a single query on the status table, using ORs to test each scenario, like so:

SELECT ss.int_tran_id
FROM   status SS
WHERE  ss.stage in ('ACHPayment_Confirmed', 'HIFV4', 'HIFV5_FTRINF', 'Payment_HIFV5_FTRINF')
OR     (ss.stage = 'PREVDAY'
                     FROM   references rf
                     WHERE  ss.int_tran_id = rf.int_tran_id
                     AND    rf.mid_ref IS NOT NULL)
                        FROM   app_data ad
                               INNER JOIN ach aa
                                 ON (ad.app_data_id = aa.ach_id)
                        WHERE  ss.int_tran_id = ad.int_tran_id
                        AND    aa.par_number IS NOT NULL)));
By : Boneist

This video can help you solving your question :)
By: admin