Website Design and Development


php14 Jul 2008 04:50 pm

Nice way to dump out the names and values of the variables coming from a posted form:

foreach ( $_POST as $key => $value ) {
 echo $key . ” ” . “=” . ” ” . $value;
 echo  ”<BR>”;
}

php08 Jul 2008 02:26 pm

Get the parts of the current date into workable variables….

 

        $cday = date(‘d’,time());
        $cmonth = date(‘m’,time());
        $cyear = date(‘Y’,time());

Website Design and Development08 Jul 2008 12:43 pm

A small way to at least keep your pages looking current…and keep your copyright protection going…

<SCRIPT LANGUAGE=”JavaScript”>
<!–  today=new Date();
    y0=today.getFullYear();
    document.write(y0);
  // end hiding —>
</SCRIPT>   

Just stick this after a start year, and you are off to the races!

mysql05 Jul 2008 08:40 pm

One way of detecting of a select statement returned any results.  Using this currently…

  $result = mysql_query(“SELECT * FROM some_table where some_field = ’some_value’ “, $connection);

  if (!$result) 
    $count=0;
  else
    $count =mysql_num_rows($result);

  if ($count == 0) {
   die(“Database query failed: ” . mysql_error());