PDO check Value Operation

Description

Checks whether particular field of table contains some specific value or not. Many times, We needs to check for specific values like username,passwords etc. You can use the select functions also for this but this function is added seprately just to simplify it.

Function Reference :
boolean dbCheckValue(string $table_name, string $field_name, string $field_val)

Parameters

Name Type Required Parameter Info Example
table_name string Yes The name of the table to check values any table name like "employee_info"
field_name string Yes The name of column to check value against firstname,email,gender
field_val string Yes Field value which needs to be checked in column name "Ram"

Examples

                <?php        
                $sdb= new SimplifiedDB(); 
                $sdb->dbConnect("localhost","username","password","dbuser"); 
                $sdb->dbCheckValue("users","firstName","Ram"); 
                ?> 

Result

Returns true or false based on the field value, field name etc.

Debuging

Debug Operation Result/Output
$sdb->query SELECT `firstName` FROM `users` WHERE `firstName`='Ram'
$sdb->last_insert_id
$sdb->rows_affected
$sdb->message_info Connected to database
$sdb->error_info