Last active
January 4, 2016 20:09
-
-
Save ryansukale/8672086 to your computer and use it in GitHub Desktop.
A sample mysqli insert-update statement for strings, numbers and dates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $now = date("Y-m-d H:i:s"); | |
| //Insert | |
| $query = 'insert into '.$tableNamespace.'tableName(field1, field2, field3, field4) values ('. | |
| '"'.$strValue1.'",'. | |
| '"'.$strValue2.'",'. | |
| $intValue3.','. | |
| '"'.$now.'"'. | |
| ')'; | |
| mysqli_query($con,$query); | |
| //Update | |
| $query = 'update '.$tableNamespace.'tableName set numeric_field = 1, date_field="'.$now.'" where numeric_condition='.$numeric.' string_condition ="'.$string.'"'; | |
| mysqli_query($con,$query); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment