Posted on November 27, 2019, 11:27 pm, by admin, under
mysql,
php.
<?php $dbname = ‘dbname’; $dbuser = ‘user’; $dbpass = ‘pass’; $dbhost = ‘hostname’; $connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to ‘$dbhost’"); mysql_select_db($dbname) or die("Could not open the db ‘$dbname’"); $test_query = "SELECT 1,2,3,4 FROM yourtable"; $result = mysql_query($test_query); $tblCnt = 0; while($tbl = mysql_fetch_array($result)) { $tblCnt++; echo $tbl[0]."<br />\n"; echo […]
Posted on November 22, 2019, 12:41 pm, by admin, under
bash.
If your job is running in terminal do bg — Move running process to background — jobs — list the jobs in background and get id of the job you want to detach — disown %1 — use job id from previous query for detaching from the terminal —
Posted on November 22, 2019, 12:00 pm, by admin, under
mysql.
Posted on November 15, 2019, 1:09 pm, by admin, under
php.
function getNearestMatch($number, $candidates) { $candidates = is_array($candidates) ? $candidates : array($candidates); $size = count($candidates); if ($size > 0) { //absolute difference between 0th element and input value $diff = abs($candidates[0] – $number); //element closest to input value $ret = $candidates[0]; //loop through the rest of the array for ($i = 1; $i < […]