Re: Your opinion needed

From: Date: Thu, 15 May 2003 09:28:00 +0000
Subject: Re: Your opinion needed
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-147681@lists.php.net to get a copy of this message
Ryan, My experience with these types of auto code writers are that they are great when it is prototype write quickly situations but in the long term you need to know what you code is really doing. Timothy Hitchens (HiTCHO) Web Application Consulting e-mail: tim@hitcho.com.au Thursday, May 15, 2003, 7:13:31 PM, you wrote: RA> Hi, RA> I have just started working with Dreamweaver MX -> PHP/MySql and need your RA> opinion. RA> The advanage of using DWMX with PHP/MySql is of course speed, I can write RA> scripts to insert/delete/edit etc in seconds and they execute perfectly with RA> or without magic_quotes or globals, this would normally take me an hour or RA> more, those headaches are taken away from me *BUT* RA> for every little operation (insert/delete etc) it writes around double or RA> more of what I would normally write (bloatware...?) RA> My question is....do you think it is worth it? or should i go back to RA> writing everything by hand in its codeview/notepad/some editor?? RA> Most of you guys are more experienced than me in PHP so.....your opinion RA> needed. RA> To give you an example of what i mean here is the code that was generated RA> for me to do a simple insert into 2 fields of a table, the database/php etc RA> is on my local win2000 machine, not on the web. RA> <?php require_once('Connections/test.php'); ?> RA> <?php RA> function GetSQLValueString($theValue, $theType, $theDefinedValue = "", RA> $theNotDefinedValue = "") RA> { RA> $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; RA> switch ($theType) { RA> case "text": RA> $theValue = ($theValue != "") ? "'" . $theValue . RA> "'" : "NULL"; RA> break; RA> case "long": RA> case "int": RA> $theValue = ($theValue != "") ? intval($theValue) : "NULL"; RA> break; RA> case "double": RA> $theValue = ($theValue != "") ? "'" . doubleval($theValue) . RA> "'" : RA> "NULL"; RA> break; RA> case "date": RA> $theValue = ($theValue != "") ? "'" . $theValue . RA> "'" : "NULL"; RA> break; RA> case "defined": RA> $theValue = ($theValue != "") ? $theDefinedValue : RA> $theNotDefinedValue; RA> break; RA> } RA> return $theValue; RA> } RA> $editFormAction = $HTTP_SERVER_VARS['PHP_SELF']; RA> if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { RA> $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING']; RA> } RA> if ((isset($HTTP_POST_VARS["MM_insert"])) && RA> ($HTTP_POST_VARS["MM_insert"] RA> == "form1")) { RA> $insertSQL = sprintf("INSERT INTO countries (country_code, country_name) RA> VALUES (%s, %s)", RA> GetSQLValueString($HTTP_POST_VARS['country_code'], RA> "text"), RA> GetSQLValueString($HTTP_POST_VARS['country_name'], RA> "text")); RA> mysql_select_db($database_test, $test); RA> $Result1 = mysql_query($insertSQL, $test) or die(mysql_error()); RA> $insertGoTo = "countries.php"; RA> if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { RA> $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; RA> $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING']; RA> } RA> header(sprintf("Location: %s", $insertGoTo)); RA> } ?>> RA> Kindly reply. RA> Cheers, RA> -Ryan.

« previous php.general (#147681) next »