note 6950 deleted from mysql_fetch_array by danbeck

From: Date: Thu, 07 Sep 2000 15:34:30 +0000
Subject: note 6950 deleted from mysql_fetch_array by danbeck
Groups: php.notes 
Request: Send a blank email to php-notes+get-4380@lists.php.net to get a copy of this message
There is a sure-fired way to stop all the NULL problems.<br> Make sure that your database never gets a NULL in it !!!<br> Plus it makes programming life simpler.<p> I've never found any reason to put up with the stupid bloody thing.<br> Look at it as a brand new clock waiting to be set. So set it with an "0" or "", as PHP doesn't care how it receives data.<p> Of course, the techno-phile will argue the point that NULL represents something that simply doesn't exist. If that's the case, why record it on a database???<p> Following is a simplified example to get rid of NULLS. It's for mSQL... but if you alter a few lines it should still work... famous last words...<br> Brian<br> <br> // ---create records without NULLS<br> <br> $record_id = $unique_record_no;<br> $item_name = "";<br> $item_no = 0;<br> $date = gmdate("d M Y H:i:s");<br> $locked = "no";<br> <br> // ---now put 6 million non-NULL<br> // ---records on database<br> <br> $i = 0;<br> while ($i < $6_million) {<br> <br> $Ins_str = "INSERT INTO $Table_name VALUES (<br> $record_id,<br> '$item_name',<br> '$item_no',<br> '$date',<br> '$locked')";<br> <br> $it_worked = MSQL($Dbname,$Ins_str);<br> if ($it_worked > 0) {echo "new record: $i";} // testline<br> <br> $i++; // increment counter<br> $record_id++; // next unique_record_no.<br> } // end of while loop<br> <br>

« previous php.notes (#4380) next »