PHP & MySQL – Create Table PHP uses mysqli query() or mysql_query() function to create a MySQL table. This function takes two parameters and returns TRUE on success or FALSE on failure. Syntax $mysqli->query($sql,$resultmode) Sr.No. Parameter & Description 1 $sql Required – SQL query to create a MySQL table. 2 $resultmode Optional – Either the […]
Author Archives: user
PHP & MongoDB – Error Handling MongoDB driver operations throws exceptions in case of any database operations and can be captured easily using following syntax: try { } catch (MongoDBDriverExceptionException $e) { echo “Exception:”, $e->getMessage(), “<br/>”; echo “File:”, $e->getFile(), “<br/>”; echo “Line:”, $e->getLine(), “<br/>”; } Example Try the following example to check database operation error […]
PHP & MongoDB – Limit Records First step to do any operation is to create a Manager instance. // Connect to MongoDB using Manager Instance $manager = new MongoDBDriverManager(“mongodb://localhost:27017”); Second step is to prepare and execute a Query object to record(s) in the collection and pass it filters and options to limit search results. $filter […]