DwZone Forum DwZone Forum
Welcome to the DwZone-it Forum
 
  FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups  
    RegisterRegister -->   LoginLogin  
Asp Upload and Resize  
DwZone Forum Index -> Asp Upload and Resize

Moderators: AdministratorsModerators 
Hint: For improved responsiveness, use Internet Explorer 4 (or above) with Javascript enabled, choose 'Dynamic' from the View dropdown and hit 'Set Options' to save your changes.
New Topic Search for
 View     Per page     Messages Since 
Messages 161 to 170 of 860 (Total: 366) First |  Prev |  Next |  Last  
 Subject Author Date  
   Re: Update Record Upload Error: "String or binary data would be truncated."  
View this persons public profile  Steve Skinner   15:50 20 Mar 2013  
   Out of string space error  
View this persons public profile  Steve Skinner   10:03 1 May 2012  
   Re: Out of string space error  
View this persons public profile  Gianluigi   10:13 1 May 2012  
   Re: Out of string space error  
View this persons public profile  Steve Skinner   10:21 1 May 2012  
   Re: Out of string space error  
View this persons public profile  Gianluigi   10:34 1 May 2012  
   ASP MYSQL 2004 MX  
View this persons public profile  GlenWhiting   5:43 2 Feb 2012  
   Re: ASP MYSQL 2004 MX  
View this persons public profile  Gianluigi   10:23 2 Feb 2012  
    Insert and Upload creating blank record in database  
View this persons public profile  PierreLetourneau   7:37 26 Jan 2012  
 
I am having a hard time figuring out what is going on.

Everytime that Insert/Upload a new image to the site, all of the fields and data are inserted correctly, but for some reason there is also a blank record that is created at the same time.

Here is the code:

<?php
//**********************
// DwZone Upload Resize
//**********************
require_once("dwzUpload/dwzUpload.php");
require_once('Connections/BergerAustralienDB.php');
?>
<?php require_once('Connections/BergerAustralienDB.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "IntranetLogin.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
$MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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;
}
}

mysql_select_db($database_BergerAustralienDB, $BergerAustralienDB);
$query_rsNoSequence = "SELECT Max(SequenceNo) FROM NosChiens";
$rsNoSequence = mysql_query($query_rsNoSequence, $BergerAustralienDB) or die(mysql_error());
$row_rsNoSequence = mysql_fetch_assoc($rsNoSequence);
$totalRows_rsNoSequence = mysql_num_rows($rsNoSequence);

mysql_select_db($database_BergerAustralienDB, $BergerAustralienDB);
$query_rsYesNO = "SELECT * FROM YesNo";
$rsYesNO = mysql_query($query_rsYesNO, $BergerAustralienDB) or die(mysql_error());
$row_rsYesNO = mysql_fetch_assoc($rsYesNO);
$totalRows_rsYesNO = mysql_num_rows($rsYesNO);
?>
<?php
//**************************
// INSERT RECORD UPLOAD
// http://www.DwZone-it.com
// Version: 1.1.8
//**************************
set_time_limit(5400);
$upload = new dwzUpload();
$upload->SetProgressBar("");
$upload->SetTempFolder("undefined");
$upload->SetTotalFileSize("");
$upload->SetRedirectUrl("Intranet.php");
$upload->SetFiles("/Photos/Nos Chiens/;1;;;;0;Image;1;;;;0;;;;Thumbnail;1;;1;Image@_@_@0@_@_@php@_@_@-1;800;600;80;-1;223;150;80;-1;_th;-1;1;0;;;80;0;_small;0@_@_@./@_@_@POST");
$upload->SetFormName("form1");
$upload->SetUploadType("insert");
$upload->SetValueToRedirectSend("Description|NomChien|NoSequence|YesNo");
$upload->SetDbParam($hostname_BergerAustralienDB, $database_BergerAustralienDB, $username_BergerAustralienDB, $password_BergerAustralienDB);
$upload->SetEditTable("NosChiens");
$upload->SetFields("NoSequence|value|NomChien|value|Description|value|YesNo|value");
$upload->SetColumns("SequenceNo|int|DogName|text|Description|text|DisplayInd|text");
$upload->Execute();
?>
<!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>
<?php
//**********************
// DwZone Upload Resize
//**********************
require_once("dwzUpload/dwzUploadClient.php");
?>
<meta name="robots" content="noindex">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Berger Australien - Ajouter Chiens</title>
</head>

<body>
<form ACTION="<?php echo $upload->GetEditAction(); ?>" onsubmit="return ProgressBar()" method="post" enctype="multipart/form-data" name="form1" id="form1">
<table width="100%" border="1" cellspacing="0" cellpadding="5">
<tr>
<td colspan="2">Enter les details</td>
</tr>
<tr>
<td width="12%"> </td>
<td width="88%"> </td>
</tr>
<tr>
<td>No Sequence:</td>
<td><label for="NoSequence"></label>
<input type="text" name="NoSequence" id="NoSequence" />
(Dernier # Séquence utiliser = <?php echo $row_rsNoSequence['Max(SequenceNo)']; ?>)</td>
</tr>
<tr>
<td>Nom du Chien:</td>
<td><label for="NomChien"></label>
<input type="text" name="NomChien" id="NomChien" /></td>
</tr>
<tr>
<td>Description:</td>
<td><label for="Description"></label>
<textarea name="Description" cols="100" id="Description"></textarea></td>
</tr>
<tr>
<td>Image:</td>
<td><label for="Image"></label>
<label for="Image2"></label>
<input name="Image" type="file" id="Image2" onchange="dwz_setEvent(this,'change')" onclick="dwz_setEvent(this,'click')" size="75" /></td>
</tr>
<tr>
<td>Display:</td>
<td><label for="YesNo"></label>
<select name="YesNo" id="YesNo">
<?php
do {
?>
<option value="<?php echo $row_rsYesNO['Value']?>"<?php if (!(strcmp($row_rsYesNO['Value'], "Y"))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsYesNO['Value']?></option>
<?php
} while ($row_rsYesNO = mysql_fetch_assoc($rsYesNO));
$rows = mysql_num_rows($rsYesNO);
if($rows > 0) {
mysql_data_seek($rsYesNO, 0);
$row_rsYesNO = mysql_fetch_assoc($rsYesNO);
}
?>
</select></td>
</tr>
<tr>
<td> </td>
<td><table border="0" cellspacing="0" cellpadding="5">
<tr>
<td><input type="submit" name="dwzSubmit" id="dwzSubmit" value="Submit" /></td>
<td><input type=button value="Cancel" onclick="javascript:window.location='Intranet.php';" /></td>
</tr>
</table></td>
</tr>
</table>
<input type="hidden" name="dwzUpload" id="dwzUpload" value="form1" />
</form>
</body>
</html>
<?php
mysql_free_result($rsNoSequence);

mysql_free_result($rsYesNO);
?>



Hoping some one can help

thanks in advance

Pierre Letourneau
 
Reply to this current thread  View this persons public profile  Send Private Message
   Foreign Key -Insert picture name in database  
View this persons public profile  JocelynFilion   17:53 28 Aug 2011  
   Re: Foreign Key -Insert picture name in database  
View this persons public profile  Gianluigi   9:12 29 Aug 2011  
Last Visit: Saturday 2 Nov, 2024 1:19 am First |  Prev |  Next |  Last  
 Login
Username:  Password:    
Read Message Read Message   Unread message Unread message
Read message [popular] Read message [popular]   Unread message [popular] Unread message [popular]
Read message [locked] Read message [locked]   Unread message [locked] Unread message [locked]
All times are GMT-1

Jump to: