Close

MySQL combine two columns and add into new column

MySQL combine two columns and add into new column [code language=”sql”] UPDATE tablename SET combined = CONCAT(zipcode, ‘ – ‘, city, ‘, ‘, state) [/code] Output: zipcode – city, state MySQL combine two columns and add into new column where year is a number [code language=”sql”] UPDATE `tablename` SET cat_path = CONCAT(year, ‘/’, name) WHERE…

PHP: Check broken links using curl

[code language=”php”] function check_url($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); $headers = curl_getinfo($ch); curl_close($ch); return $headers[‘http_code’]; } $mainurl = "http://www.google.com"; $myurl = "http://www.google.com/gggg"; $mainsite = check_url($mainurl); $satus = check_url($myurl); if($mainsite == ‘200’){ if($satus == ‘200’){ echo "Its works"; }else{ echo "broken url"; } }else{ echo…