What do you want to save?
Add Code snippet
New code examples
-
PHP 2022-01-30 14:30:39
php generate unique id for mysql
A programmatic way can be to: add a UNIQUE INDEX to the field generate a random string in PHP loop in PHP ( while( ! DO_THE_INSERT ) ) generate another string Note: This can be dirty, but has the advantage to be DBMS-agnostic Even if you choose to use a... Add solution -
PHP 2022-01-30 08:15:09
php sql search form
<?php $localhost = "localhost"; $username = "root"; $password = ""; $dbname = "samueldb"; $con = new mysqli($localhost, $username, $password, $dbname); if( $con->connect_error){ die('Error: ' . $con->c... Add solution -
Other 2022-01-28 19:41:03
Export Sqlite Database as csv in android
public boolean exportDatabase() { DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault()); /**First of all we check if the external storage of the device is available for writing. * Remember that the ext... Add solution -
Javascript 2022-01-27 19:50:17
javascrpt formatBytes
function niceBytes(x){ const units = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; let l = 0, n = parseInt(x, 10) || 0; while(n >= 1024 && ++l){ n = n/1024; } return(n.toFixed(n < 10 && l > 0 ? 1 : 0) +... Add solution -
C++ 2022-01-27 19:21:07
visual studio 2019 read and write text file c++
#include <iostream> #include <fstream> #include <string> using namespace std; int main(){ fstream newfile; newfile.open("tpoint.txt",ios::out); // open a file to perform write operation using file object if(newfile.is... Add solution -
C 2022-01-26 12:21:39
divide a linked list into three parts based on their position mod 3.
int split_list(struct node *ll) { struct node *l1, *l2, *l3; if(!(ll && ll->next && ll->next->next)){ printf("Need atleast 3 elements\n"); return -1; } l1 = ll; l2 = ll->next; l... Add solution
Best helpers
Ranking is empty