PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 8th, 2005, 06:37 PM
keyboard keyboard is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 4 keyboard User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 16 sec
Reputation Power: 0
mistake in dreamweaver's update record script?

I get this message:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

This is the script DW generates:

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE cd SET cd_name=%s WHERE cd_pk=%s",
GetSQLValueString($_POST['cd_name'], "text"),
GetSQLValueString($_POST['cd_pk'], "int"));

mysql_select_db($database_Apress_pdav, $Apress_pdav);
$Result1 = mysql_query($updateSQL, $Apress_pdav) or die(mysql_error());

$updateGoTo = "artist.php?artist=".$_POST['artist']."";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}

if ((isset($_POST['cd_pk'])) && ($_POST['cd_pk'] != "")) {
$deleteSQL = sprintf("DELETE FROM cd WHERE cd_pk=%s",
GetSQLValueString($_POST['cd_pk'], "int"));

mysql_select_db($database_Apress_pdav, $Apress_pdav);
$Result1 = mysql_query($deleteSQL, $Apress_pdav) or die(mysql_error());

$deleteGoTo = "artist.php?artist=".$_POST['artist']."";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}

$colname_rstCD = "1";
if (isset($_GET['cd'])) {
$colname_rstCD = (get_magic_quotes_gpc()) ? $_GET['cd'] : addslashes($_GET['cd']);
}
mysql_select_db($database_Apress_pdav, $Apress_pdav);
$query_rstCD = sprintf("SELECT artist.artist_pk, artist.artist_name, cd.cd_pk, cd.cd_name FROM cd, artist WHERE cd_pk = %s AND cd.cd_artist = artist.artist_pk ", $colname_rstCD);
$rstCD = mysql_query($query_rstCD, $Apress_pdav) or die(mysql_error());
$row_rstCD = mysql_fetch_assoc($rstCD);
$totalRows_rstCD = mysql_num_rows($rstCD);

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > mistake in dreamweaver's update record script?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT