Should This Newbie Learn From Dreamweaver?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



First of all - I know this is an entirely subjective question, and I know
there's no single approach to learning this technology. I'm just looking for
a few hints from seasoned professionals basically whether Dreamweaver
verbose code (at least it looks like that to me at this beginning point) is
all 'needed & necessary'...

I have a background using ColdFusion, however I am new to php / mySQL.

I am caught between two learning approaches:

1 -  I know that generally, it is better to build my knowledge from the
'bottom up' - coding by hand from books and such etc. - and so far I have
been doing that with php and mySQL. Slowly I am getting there. Php is quite
powerful and impressive.

2 - Dreamweaver cs3 is pretty cool.  Creating recordsets -  dynamic data -
updating records etc. is pretty seductive it seems to work well.

A few questions:

One of my issues is that the Dreamweaver code that gets created seems quite
verbose and somewhat complex (like using switch & case in a simple query
listed below...), therefore even harder for this newbie to try to learn
from. My question is this:  Is this Dreamweaver code actually all
modern/necessary (vs a 'simple approach') - or is it way over the top?

Without getting too detailed:

- If in fact you folks say that most of the DW approach (for those that have
seen it) is  'necessary' & 'the right way to do things' - then I will be
happy to use it and try to figure out some of its complexities . But, if you
think that DW is over the the top ('...I don't use all that suff - I do a
query in just a few lines!') ... then I'll just start with the 'bottom up -
code by hand - do it yourself simple approach'.

BTW: if anyone wants to see more DW code - email me off-list - I'll be happy
to send more examples... (I don't want to clog up this cool list)

BTW: I also tried a happy medium - simplifying the DW code - however that
will break its usefulness in DW - and other DW interface items stop working,
so I guess that's not an option right now.

Interested in your thoughts... Dave

------------------------

Example get recordset query w DW:


<?php require_once('../Connections/weblink.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "",
$theNotDefinedValue = "")
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ?
mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" :
"NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue :
$theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_get_Recordset1 = "-1";
if (isset($_SESSION['mem_id'])) {
  $colname_get_Recordset1 = $_SESSION['mem_id'];
}
mysql_select_db($database_weblink, $weblink);
$query_get_Recordset1 = sprintf("SELECT * FROM tbl_test WHERE mem_id = %s
ORDER BY mem_id ASC", GetSQLValueString($colname_get_Recordset1, "int"));
$get_Recordset1 = mysql_query($query_get_Recordset1, $weblink) or
die(mysql_error());
$row_get_Recordset1 = mysql_fetch_assoc($get_Recordset1);
$totalRows_get_Recordset1 = mysql_num_rows($get_Recordset1);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
</body>Remember
</html>
<?php
mysql_free_result($get_Recordset1);
?>


--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux