Mistři v programování na #hovnokod

Krasna pyramida

if ($predvypln_pocet_kin == 1) {
            $nahrad["{test}"] = $table_test1;
        } elseif ($predvypln_pocet_kin == 2) {
            $nahrad["{test}"] = $table_test1 . $table_test2;
        } elseif ($predvypln_pocet_kin == 3) {
            $nahrad["{test}"] = $table_test1 . $table_test2 . $table_test3;
        } elseif ($predvypln_pocet_kin == 4) {
            $nahrad["{test}"] = $table_test1 . $table_test2 . $table_test3 . $table_test4;
        } elseif ($predvypln_pocet_kin == 5) {
            $nahrad["{test}"] = $table_test1 . $table_test2 . $table_test3 . $table_test4 . $table_test5;
        } elseif ($predvypln_pocet_kin == 6) {
            $nahrad["{test}"] = $table_test1 . $table_test2 . $table_test3 . $table_test4 . $table_test5 . $table_test6;
        } elseif ($predvypln_pocet_kin == 7) {
            $nahrad["{test}"] = $table_test1 . $table_test2 . $table_test3 . $table_test4 . $table_test5 . $table_test6 . $table_test7;
        } elseif ($predvypln_pocet_kin == 8) {
            $nahrad["{test}"] = $table_test1 . $table_test2 . $table_test3 . $table_test4 . $table_test5 . $table_test6 . $table_test7 . $table_test8;
        } elseif ($predvypln_pocet_kin == 9) {
            $nahrad["{test}"] = $table_test1 . $table_test2 . $table_test3 . $table_test4 . $table_test5 . $table_test6 . $table_test7 . $table_test8 . $table_test9;
        } elseif ($predvypln_pocet_kin == 10) {
            $nahrad["{test}"] = $table_test1 . $table_test2 . $table_test3 . $table_test4 . $table_test5 . $table_test6 . $table_test7 . $table_test8 . $table_test9 . $table_test10;
        } elseif ($predvypln_pocet_kin == 11) {
            $nahrad["{test}"] = $table_test1 . $table_test2 . $table_test3 . $table_test4 . $table_test5 . $table_test6 . $table_test7 . $table_test8 . $table_test9 . $table_test10 . $table_test11;
        } elseif ($predvypln_pocet_kin == 12) {
            $nahrad["{test}"] = $table_test1 . $table_test2 . $table_test3 . $table_test4 . $table_test5 . $table_test6 . $table_test7 . $table_test8 . $table_test9 . $table_test10 . $table_test11 . $table_test12;
        } elseif ($predvypln_pocet_kin == 13) {
            $nahrad["{test}"] = $table_test1 . $table_test2 . $table_test3 . $table_test4 . $table_test5 . $table_test6 . $table_test7 . $table_test8 . $table_test9 . $table_test10 . $table_test11 . $table_test12 . $table_test13;
        } elseif ($predvypln_pocet_kin == 14) {
            $nahrad["{test}"] = $table_test1 . $table_test2 . $table_test3 . $table_test4 . $table_test5 . $table_test6 . $table_test7 . $table_test8 . $table_test9 . $table_test10 . $table_test11 . $table_test12 . $table_test13 . $table_test14;
        } elseif ($predvypln_pocet_kin == 15) {
            $nahrad["{test}"] = $table_test1 . $table_test2 . $table_test3 . $table_test4 . $table_test5 . $table_test6 . $table_test7 . $table_test8 . $table_test9 . $table_test10 . $table_test11 . $table_test12 . $table_test13 . $table_test14 . $table_test15;
        } elseif ($predvypln_pocet_kin == 16) {
            $nahrad["{test}"] = $table_test1 . $table_test2 . $table_test3 . $table_test4 . $table_test5 . $table_test6 . $table_test7 . $table_test8 . $table_test9 . $table_test10 . $table_test11 . $table_test12 . $table_test13 . $table_test14 . $table_test15 . $table_test16;
        } elseif ($predvypln_pocet_kin == 17) {
            $nahrad["{test}"] = $table_test1 . $table_test2 . $table_test3 . $table_test4 . $table_test5 . $table_test6 . $table_test7 . $table_test8 . $table_test9 . $table_test10 . $table_test11 . $table_test12 . $table_test13 . $table_test14 . $table_test15 . $table_test16 . $table_test17;
        } else {
        }

Anonymous,

Aneb když po kolegovi debugujete proč NULL z SQL leze do ToDo #2 Kód byl záměrně vyčištěn k zachování firemní politiky. PS: Zabiju ho!

$sql = "SELECT * FROM table WHERE id='".$value."";
$data = mysqli_query($link, $sql);
while($row = mysqli_fetch_assoc($data)){
    if($row['key']==""){
        //ToDo #1
    }else{
        //ToDo #2
    }
}

Anonymous,

Jak vyjebat s chybovou hláškou kterou nechci řešit

error_reporting(0);
$mpdf->WriteHtml(Yii::$app->controller->renderPartial(self::PATH_TEMPLATE . 'credit-note', $data)); // call mpdf write html
error_reporting(E_ALL);

Anonymous,

public function actionHtmlResponse()
{
	//FIXME: WTF?
	$query = $this->getHttpRequest()->getQuery();
	dump($this->datatablesHelper->getAllProductsForList($this, $query, $this->projectDomainId, $this->locale));
	exit;
}

Třešťák Huho,

foreach ($params as $p) {
	//TODO: make it better somehow, find potential bugs
	if ($p['parameter_type_id']) {
		$parameters[(int) $p['parameter_type_id']][] = $p->toArray();
	} else {
		$parameters[(int) $p['parameter_type_id']][] = $p->toArray();
	}
}

Třešťák Huho,