Jump to content

Recommended Posts

Hi,

  I posted this problem a few weeks ago and have come back to trying to get this to work again. I have a rather large script that someone else wrote and I'm trying to alter. The script takes a product that someone wants to upload (form based) and they add info about what they want to upload. I've added to the associative array the exact way that the rest of it is written. Any other time you add something to any other category it works just fine, but when you try to add something to the new category it gives me the error "Unknown column in 'field list' " The strange thing about it is the info actually gets loaded into the database and shows up on the rest of the site, although the person who wants to upload their product has no way of knowing that it went in and they can't alter any information after the fact because it doesn't show up in their section to look at what they have posted. The script works perfectly otherwise and has worked since before I was hired at this job. I'll post in the necessary parts of the files:

 

This is the file that allows the user to upload their info on their products (I have it echoing some of the arrays and variables that I was trying to see if they had values, they all do and even the column 'chainguides' that I'm having problems with has an issue being loaded even after it says it has a value)


<?
$access_level = 1;
include("../includes/init.php");
include("../includes/database_class.php");
include("../includes/user_class.php");

$db = new DB();
$error = 0;
if (!is_null($_POST['cat']))
{
if (!is_numeric($_POST['price']))
{
	$error = "Please enter a valid price.";
	$data = $_POST;
}
else
{
	$check_road = 0;
	if ($_GET['guide'] == "road")
	{
		$check_road = 1;
	}
	else
	{
		$check_road = 0;
	}

	//echo $_SESSION['max_products'];
	if (getProductCount($_SESSION['company_id'])+1 > $_SESSION['max_products'])
	{
		$error = "You have exceeded the allowed number of products for your company.<br />Please contact H3 to upgrade your account.<br />If you have just upgraded your account, please logout and login again to complete the upgrade.";
		$data = $_POST;
	}
	else if (checkForModel($_POST['model'],$RB_products[$_POST['cat']]['tbl_name'],$RB_products[$_POST['cat']]['tbl_id'],$_SESSION['company_id'],0,$check_road))
	{
		$error = "A product with this model number is already in the system.<br />Please choose a different model number.";
		$data = $_POST;
	}
	else
	{
		print_r($_POST);
		$req = array();
		$opt = array();
		foreach ($RB_products[$_POST['cat']]['fields'] as $input_field)
		{
			if ($input_field['type'] == 'file')
			{
				continue;
			}
			if ($input_field['required'] != '')
			{
				$req[] = $input_field['db_name'];
				print $req['db_name'];
			}
			else
			{
				$opt[] = $input_field['db_name'];
				print $opt['db_name'];
			}
		}
		if ($RB_products[$_POST['cat']]['road'] === true && $RB_products[$_POST['cat']]['mtn'] === true)
		{
			$req[] = 'isroad';
			if ($_GET['guide'] == "road")
			{
				$_POST['isroad'] = "1";
			}
			else
			{
				$_POST['isroad'] = "0";
			}
		}
		$req[] = 'company_id';
		$req[] = 'date_added';
		$_POST['company_id'] = $_SESSION['company_id'];
		$_POST['date_added'] = 'Now()';

		print_r($req);
		print_r($opt);

		$db->Reset();
		print "<br />" . $RB_products[$_POST['cat']]['tbl_name'] . " " . $RB_products[$_POST['cat']]['tbl_id'] . "<br />"; //This is where I printed the array and it shows that the tbl_name is chainguides and the tbl_id is chainguides_id
		$db->SetTable($RB_products[$_POST['cat']]['tbl_name'],$RB_products[$_POST['cat']]['tbl_id']);
		$error = $db->Add($_POST,$req,$opt,$_FILES);

		if (!is_numeric($error))
		{
			$data = $_POST;
		}
		else
		{
			incrementProdCount($RB_products[$_POST['cat']]['tbl_name'],$_SESSION['company_id']);

			$comp = new DB();
			$comp->SetTable('companies', 'company_id');
			$comp->Load($_SESSION['company_id']);
			$email_body = "The Buyer's Guide company, ".$comp->Get('name').", has added a new product, bringing their product count to ".getProductCount($_SESSION['company_id'],false).".";
			//USER::SendEmail("New Product Added by ".$comp->Get('name'), $email_body,"christine@h3publications.com","admin@bicyclebuyersguide.com","Buyer's Guide Product Tracking");
			USER::SendEmail("New Product Added by ".$comp->Get('name'), $email_body,"frank@h3publications.com","admin@bicyclebuyersguide.com","Buyer's Guide Product Tracking");
		}
	}
}
}
include('../includes/user_header.php');
include('../includes/user_left_col.php');
?>

<div id="usercentercolumn">
<?=(!is_null($_POST['cat']) && !is_numeric($error))?"<p class='error'>$error</p>":""?>
	<?=(!is_null($_POST['cat']) && is_numeric($error))?"<p class='success'>Product added.</p>":""?>
	<form name="input_table" method="POST" enctype="multipart/form-data" onsubmit="return validateForm(this);">
		<table border="0" cellpadding="2" cellspacing="3" id="input_table">

		<tr>
			<td class="input_label">Guide:</td>
			<td class="input_value">
				<select name='guide' onchange="location.href='add_product.php?guide='+this.options[this.selectedIndex].value">
					<option value="">Select One</option>
					<option value='mtn'<?=($_GET['guide'] == 'mtn')?" selected='selected'":""?>>Mountain</option>
					<option value='road'<?=($_GET['guide'] == 'road')?" selected='selected'":""?>>Road</option>
				</select>
			</td>
		</tr>
		<?
		if ($_GET['guide'] == "mtn" || $_GET['guide'] == 'road')
		{
			?>
			<tr>
				<td class="input_label">Category:</td>
				<td class="input_value">
					<select name='cat' onchange="location.href='add_product.php?guide=<?=$_GET['guide']?>&cat='+this.options[this.selectedIndex].value">
						<option value="">Select One</option>
						<?
						$display_products = multiasort($RB_products,'name');
						foreach ($display_products as $tbl => $catdata)
						{
							if($catdata[$_GET['guide']] !== true)
							{
								continue;
							}
							?>
								<option value="<?=$tbl?>" <?=($_GET['cat'] == $tbl)?"selected='selected'":""?>><?=$catdata['name']?></option>
							<?
						}
						?>
					</select>
				</td>
			</tr>
			<?
			if (in_array($_GET['cat'],array_keys($RB_products)))
			{
				$form_data = array();
				$form_data = $RB_products[$_GET['cat']]['fields'];
				//print_r($form_data);

				foreach ($form_data as $field_data)
				{

					if($field_data['type'] == 'text')
					{
						if ($field_data['required'] != '' && $field_data['db_name'] == 'price')
						{
							$validate = " alt='number' emsg='".$field_data['required']."'";
						}
						else if ($field_data['required'] != '' && $field_data['db_name'] != 'price')
						{
							$validate = " alt='blank' emsg='".$field_data['required']."'";
						}
						else
						{
							$validate = "";
						}

						?>

						<tr>
							<td class="input_label"><?=$field_data['name']?>:<?=($field_data['required'] != '')?"<span class='req'>*</span>":""?></td>
							<td class="input_value"><input type='text' name='<?=$field_data['db_name']?>' maxlength='<?=$field_data['input_size']?>' value='<?=$data[$field_data['db_name']]?>'<?=$validate?>'/>
							</td>
						</tr>
						<?
					}
					else if ($field_data['type'] == 'hidden')
					{
						?>
						<input type='hidden' name='<?=$field_data['db_name']?>' value='<?=$field_data['value']?>'/>
						<?
					}
					else if ($field_data['type'] == 'file')
					{
						?>
						<tr>
							<td class="input_label"><?=$field_data['name']?>:<?=($field_data['required'] != '')?"<span class='req'>*</span>":""?></td>
							<td class="input_value"><input type='file' name='<?=$field_data['db_name']?>'/>
							</td>
						</tr>
						<?
					}
				}

				?>
				<tr>
					<td colspan="2"><input type="submit" name="submit" value="Submit"/>
				</tr>
				<?
			}
		}
			?>
		</table>
	</form>
</div>

<?
//include(SERVER_ROOT.'includes/user_right_col.php');
include("../includes/user_footer.php");
?>

 

 

This is the database class that handles the uploading, the section under the Add() function is where it adds into the database


<?
/**
*	Database Contol Class
*
* 	Justin Brown
*	1-25-2007
*
*
*
**/

class DB
{
/**
 * The name of the database table for this class
 *
 * @var string
 *
 */
var $x_table_name;

/**
 * The name of the database primary key for the table used in this class
 *
 * @var string
 *
 */
var $x_table_id;

/**
 * The return row from the database for the current record
 *
 * @var array
 */
var $x_data;

/**
 * The multidimensional array containing a group of records to be procecessed
 *
 * @var array
 */
var $x_batch;



function DB()
{

}

/**
 * Retrieves the data for the id passed as an argument and places it in the private variables
 *
 * @param int $id
 * 	The id of the record to be loaded
 *
 * @return boolean
 *  If the input id is not numeric, false is returned; otherwise, true.
 *
 */
function Load($id)
{
	//Return false on bad input data
	if (!is_numeric($id) || is_null(($this->x_table_name)))
	{
		return false;
	}

	//Get the information for the given id from the database
	$sql = "SELECT * FROM $this->x_table_name WHERE `$this->x_table_id` = '$id'";
	$result = mysql_query($sql) or die (mysql_error());
	$row = mysql_fetch_assoc($result);

	//Populate the private variable
	$this->x_data = $row;

	return true;
}

/**
 * Retrieves the data for the id passed as an argument from the batch and places it in the private variables.
 * 	The batch variable must have been populated
 *
 * @param int $id
 * 	The id of the record to be loaded
 *
 * @return boolean
 *  If the input id is not numeric, false is returned; otherwise, true.
 *
 */
function LoadFromBatch($id)
{
	//Return false on bad input data
	if (!is_numeric($id) || is_null($this->x_batch))
	{
		return false;
	}

	$this->x_data = $this->x_batch[$id];
	return true;
}

function Reset()
{
	unset($this->x_data);
	unset($this->x_batch);
}

function ResetForBatch()
{
	unset($this->x_data);
}


function SetTable($table, $primary_key)
{
	if (!is_string($table) || !is_string($primary_key) || $table == "" || $primary_key == "")
	{
		return false;
	}
	else
	{
		$this->x_table_name = $table;
		$this->x_table_id = $primary_key;
	}
}


/**
  * Load() must be called first.
  *
  * @param string $field
  * 	The database field to be returned for the currently loaded record
  *
  * @return mixed
  *
  * @return boolean
  * 	false if Load() has not been called or if $field is not a string or is empty
  *
  */
function Get($field)
{
	if (!is_string($field) || $field == '' || is_null($this->x_data))
	{
		return false;
	}
	else
	{
		return $this->x_data[$field];
	}

}

/**
 * Returns the ids of all records in the system.
 *
 * @param optional boolean $batch
 *  If true, all results will be loaded into the x_batch private array and the ids will be returned; if false, only the ids will be returned.
 *
 * @param optional array $conditions
 * 	An array containing optional where conditions (column names in the keys and conditions in the values)
 *
 * @param optional string $sort
 *  The column by which the return set should be sorted
 *
 * @param optional string $custom
 * 	A string containing custom where conditions that inserted before the ORDER BY clause. (you need to add your own spaces and any 'AND's)
 *
 * @return array
 */
function GetAllRecords($batch = false, $conditions = array(), $sort = '', $custom = '')
{
	$ids = array();
	if ($batch == true)
	{
		$sql = "SELECT * FROM $this->x_table_name WHERE 1";
	}
	else
	{
		$sql = "SELECT `$this->x_table_id` FROM $this->x_table_name WHERE 1";
	}

	foreach ($conditions as $column => $value)
	{
		$sql .= " AND `$column` = ".make_clean($value);
	}

	if (is_string($custom) && $custom != '')
	{
		$sql .= $custom;
	}

	if (is_string($sort) && $sort != '')
	{
		$sql .= " ORDER BY $sort";
	}

	//echo $sql."<br />";
	//echo $this->x_table_id;
	$result = mysql_query($sql) or die (mysql_error());

	if ($batch == true)
	{
		while ($row = mysql_fetch_assoc($result))
		{
			$this->x_batch[$row[$this->x_table_id]] = $row;
			$ids[] = $row[$this->x_table_id];
		}
	}
	else
	{
		while ($row = mysql_fetch_assoc($result))
		{
			$ids[] = $row[$row[$this->x_table_id]];
		}
	}

	return $ids;
}

/**
  * Enters a new record
  *
  * @param array $data
  * 	An associative array containing all the information needed to create a record
  * 	The keys of this array must match the names of the db fields they coorespond to.
  *
  * @param array $required
  * 	An array containing the required fields.
  *
  * @param array $optional
  * 	An array containing the optional fields.
  *
  * @param optional array $file_data
  * 	If this record includes a file, this contains the $_FILES superglobal
  *
  * @return int $id
  * 	The id of the newly created record
  *
  * @return string
  * 	Returns an error message on bad data or if a required field from is missing in the $data array
  *
  */
function Add($data, $required, $optional, $file_data = array())
{
	//Bail on bad data
	if (!is_array($data) || !is_array($required) || !is_array($optional))
	{
		return "Invalid input.";
	}

	//Set the error variable
	$error = 0;

	//Initialize variables for processing of the $required and $optional arrays
	$fields = array();
	$values = array();

	//Loop through the required fields, confirming that they are present in the $data array and not blank or otherwise invalid
	foreach ($required as $var)
	{
		if (make_clean($data[$var]) !== "NULL")
		{
			$fields[] = "`$var`";

			//Don't escape the mysql Now() command
			if ($data[$var] == 'Now()')
			{
				$values[] = $data[$var];
			}
			else
			{
				$values[] = make_clean($data[$var]);
			}
		}
		else
		{
			$error = "The required field '$var' was not found. Please enter valid information in this field.";
		}
	}

	//Add the optional fields
	foreach ($optional as $var)
	{
		if (make_clean($data[$var]) !== "NULL")
		{
			$fields[] = "`$var`";

			//Don't escape the mysql Now() command
			if ($data[$var] == 'Now()')
			{
				$values[] = $data[$var];
			}
			else
			{
				$values[] = make_clean($data[$var]);
			}
		}
	}

	//Check to see if we have all the required variables
	if ($error === 0)
	{
		//Prepare the arrays we've just created to be included in the SQL INSERT
		$field_string = join(",",$fields);
		$value_string = join(",",$values);

		//Create the SQL INSERT and execute the query
		$sql = "INSERT INTO $this->x_table_name ($field_string)
				VALUES	($value_string)";
		mysql_query($sql) or die(mysql_error());

		//Return the id for this newly created record.
		$new_fileid =  mysql_insert_id();

		foreach ($file_data as $current_file)
		{
			//print_r($current_file);
			if ($current_file['error'] === 0)
			{
				$file_result = upload($current_file, $this->x_table_name, $this->x_table_id, 'img_filename', UPLOADS_DIR."company_".$_SESSION['company_id']."/",$new_fileid);
				if ($file_result!== true)
				{
					$sql = "DELETE FROM $this->x_table_name WHERE `$this->x_table_id` = '$new_fileid'";
					mysql_query($sql) or die (mysql_error());
					return "Error on file ".substr($current_file['name'],3,1).":<br />".$file_result;
				}
			}
			else if ($current_file['error'] === 1)
			{
				return "Filesize exceeds server limit. (5 MB)";
			}
			else if ($current_file['error'] !== 4 && $current_file['error'] > 0)
			{
				return "There is a problem with this file. It cannot be uploaded.";
			}
		}

		return $new_fileid;
	}
	else
	{
		return $error;
	}
}


/**
  * Modifies a record
  *
  * @param array $data
  * 	An associative array containing all the information needed to modify a record
  * 	The keys of this array must match the names of the db fields they coorespond to.
  *
  * @param array $required
  * 	An array containing the required fields.
  *
  * @param array $optional
  * 	An array containing the optional fields.
  *
  * @param int $id
  * 	The id of the record to be modified
  *
  * @param optional array $file_data
  * 	If this record includes a file, this contains the $_FILES superglobal
  *
  * @return boolean
  * 	Returns true on success
  *
  * @return string
  * 	Returns an error message on bad data or if a required field from is missing in the $data array
  *
  */
function Modify($data, $required, $optional, $id, $file_data = array())
{
	//Bail on bad data
	if (!is_array($data) || !is_array($required) || !is_array($optional) || !is_numeric($id))
	{
		return "Invalid input.";
	}

	//Initialize variables for processing of the $required and $optional arrays
	$error = 0;
	$fields = array();
	$values = array();

	//print_r($data);
	if ($data['del_img'] == "1")
	{
		//deleteImg($data['current_img'],$_SESSION['company_id']);
	}

	//Loop through the required fields, confirming that they are present in the $data array and not blank or otherwise invalid
	foreach ($required as $var)
	{
		if (make_clean($data[$var]) !== "NULL")
		{
			$fields[] = "`$var`";

			//Don't escape the mysql Now() command
			if ($data[$var] == 'Now()')
			{
				$values[] = $data[$var];
			}
			else
			{
				$values[] = make_clean($data[$var]);
			}
		}
		else
		{
			$error = "The required field '$var' was not found. Please enter valid information in this field.";
		}
	}

	//Add the optinal fields
	foreach ($optional as $var)
	{
		if (make_clean($data[$var]) !== "NULL")
		{
			$fields[] = "`$var`";

			//Don't escape the mysql Now() command
			if ($data[$var] == 'Now()')
			{
				$values[] = $data[$var];
			}
			else
			{
				$values[] = make_clean($data[$var]);
			}
		}
	}

	foreach ($file_data as $current_file)
	{
		if ($current_file['error'] === 0)
		{
			$file_result = upload($current_file, $this->x_table_name, $this->x_table_id, 'img_filename', UPLOADS_DIR."company_".$_SESSION['company_id']."/",$id);
			if ($file_result!== true)
			{
				//deleteImg($data['current_img'],$_SESSION['company_id']);
				//$sql = "UPDATE $this->x_table_name SET `img_filename` = NULL WHERE `$this->x_table_id` = '$id'";
				//mysql_query($sql) or die (mysql_error());
				return "Error on file ".$current_file['name'].":<br />".$file_result;
			}
		}
		else if ($current_file['error'] === 1)
		{
			return "Filesize exceeds server limit. (5 MB)";
		}
		else if ($current_file['error'] !== 4 && $current_file['error'] > 0)
		{
			return "There is a problem with this file. It cannot be uploaded.";
		}
	}


	//Check to see if we have all the required variables
	if ($error === 0)
	{
		$update_string = "";
		if (count($fields) > 0)
		{
			for ($i = 0; $i < count($fields); $i++)
			{
				if ($i > 0)
				{
					$update_string .=", ";
				}
				$update_string .= $fields[$i]." = ".$values[$i];
			}
			if ($data['del_img'] == "1")
			{
				$update_string .= ", `img_filename` = NULL";
			}
		}
		else
		{
			return 0;
		}

		//Create the SQL INSERT
		$sql = "UPDATE $this->x_table_name SET $update_string".
		" WHERE `$this->x_table_id` = '$id'";

		//Execute the query
		mysql_query($sql) or die(mysql_error());
		return $error;
	}
	//If there is an error return the message.
	else
	{
		return $error;
	}
}

/**
  * Deletes a record. If each of the optional fields is populated,
  * 	the file found using that data will be deleted from the server.
  *
  * @param int $id
  * 	The id of the record to be deleted
  *
  * @param optional string $file_field
  * 	Contains the field in the database that contains the file to be deleted
  *
  * @param optional string $file_path
  * 	Contains the server file path to the directory containing the file to be deleted.
  *
  * @param optional string $split_string
  * 	Contains the first part of $file_field which is used to find the actual filename.
  *
  * @return boolean
  * 	Returns true on success; false on bad data or if no record was deleted.
  *
  *
  */
function Delete($id, $file_field="", $file_path="",$split_string="")
{
	//Bail on bad data
	if (!is_numeric($id))
	{
		return false;
	}
	else
	{
		if ($file_field != "" && $file_path != "" && $split_string != "")
		{
			$sql = "SELECT `$file_field` FROM `$this->x_table_name` WHERE `$this->x_table_id` = ".make_clean($id);
			$result = mysql_query($sql) or die (mysql_error());
			if (mysql_num_rows($result))
			{
				$row = mysql_fetch_assoc($result);
				$img_data = split("$split_string",$row['img_url']);
				if ($row[$file_field] != '' && file_exists("$file_path".$img_data[1]))
				{
					unlink("$file_path".$img_data[1]);
				}
			}
		}

		$sql = "DELETE FROM $this->x_table_name WHERE `$this->x_table_id` = ".make_clean($id);
		mysql_query($sql) or die (mysql_error());

		if (mysql_affected_rows() < 1)
		{
			return false;
		}
		else
		{
			return true;
		}
	}
}

/**
 * Loads all the data for each id given in the argument array into the private array x_batch to be loaded by LoadFromBatch().
 * 	This function was created to reduce mysql calls
 *
 * @param array $ids
 * @return array
 * 	Returns the keys of the batch (obviously in the order of any sort that is applied)
 */
function GetBatch($ids, $sort = '')
{
	if (!is_array($ids))
	{
		return false;
	}
	else if (count($ids) < 1)
	{
		return false;
	}

	$this->x_batch = array();
	$id_string = join(',',$ids);

	$sql = "SELECT * FROM $this->x_table_name WHERE `$this->x_table_id` IN ($id_string)";
	if (is_string($sort) && $sort != '')
	{
		$sql .= " ORDER BY ".$sort."";
	}
	$result = mysql_query($sql) or die (mysql_error());
	while ($row = mysql_fetch_assoc($result))
	{
		$this->x_batch[$row[$this->x_table_id]] = $row;
	}
	return array_keys($this->x_batch);
}


}
?>

 

 

This is only a small part of the associative array, it's a huge file but I'll put in one part of it that was already there and works properly, then the second one will be the chainguides part that I've added, the syntax is correct in context


'pants' => array( 'import_id'=>'30',
		'name'=>'Shorts / Pants',
		'tbl_name'=>'pants',
		'tbl_id'=>'pants_id',
		'road'=>false,
		'mtn'=>true,
		'fields'=>array(
				  0 => array('name'=>'Features',
							'db_name'=>'features',
							'input_size'=>'200',
							'type'=>'text',
							'required'=>''
							),
				  1 => array('name'=>'Model',
							'db_name'=>'model',
							'input_size'=>'200',
							'type'=>'text',
							'required'=>'Please enter a model number.'
							),
				  2 => array('name'=>'U.S. MSRP',
							'db_name'=>'price',
							'input_size'=>'7',
							'type'=>'text',
							'required'=>'Please enter a price (numbers and decimal point only).'
							),
				  3 => array('name'=>'Image',
							'db_name'=>'img_filename',
							'input_size'=>'0',
							'type'=>'file',
							'required'=>''
							),
				  4 => array('name'=>'More Info URL',
							'db_name'=>'url',
							'input_size'=>'200',
							'type'=>'text',
							'required'=>''
							),
				  5 => array('name'=>'Category',
							'db_name'=>'category',
							'input_size'=>'200',
							'type'=>'text',
							'required'=>''
							)
				  )
),
'chainguides' => array( 'import_id'=>'31',
		'name'=>'Chain Guides',
		'tbl_name'=>'chainguides',
		'tbl_id'=>'chainguides_id',
		'road'=>false,
		'mtn'=>true,
		'fields'=>array(
				  0 => array('name'=>'Year/Model',
							'db_name'=>'model',
							'input_size'=>'200',
							'type'=>'text',
							'required'=>'Please enter a model number.'
							),
				  1 => array('name'=>'U.S. MSRP',
							'db_name'=>'price',
							'input_size'=>'7',
							'type'=>'text',
							'required'=>'Please enter a price (numbers and decimal point only).'
							),
			      2 => array('name'=>'Features',
							'db_name'=>'features',
							'input_size'=>'200',
							'type'=>'text',
							'required'=>''
							),
			      3 => array('name'=>'Category',
							'db_name'=>'category',
							'input_size'=>'200',
							'type'=>'text',
							'required'=>''
							),
				  4 => array('name'=>'Mount Type',
							'db_name'=>'mount_type',
							'input_size'=>'200',
							'type'=>'text',
							'required'=>''
							),
				  5 => array('name'=>'Number of Chain Rings',
							'db_name'=>'chain_rings',
							'input_size'=>'200',
							'type'=>'text',
							'required'=>''
							),
				  6 => array('name'=>'Backplate Material',
							'db_name'=>'backplate_material',
							'input_size'=>'200',
							'type'=>'text',
							'required'=>''
							),
                      7 => array('name'=>'Color',
                                'db_name'=>'color',
                                'input_size'=>'200',
                                'type'=>'text',
                                'required'=>''
                                ),
                      8 => array('name'=>'Weight',
                                'db_name'=>'weight',
                                'input_size'=>'200',
                                'type'=>'text',
                                'required'=>''
                                ),
				  9 => array('name'=>'Image',
							'db_name'=>'img_filename',
							'input_size'=>'0',
							'type'=>'file',
							'required'=>''
							),
			      10 => array('name'=>'URL',
							'db_name'=>'url',
							'input_size'=>'200',
							'type'=>'text',
							'required'=>''
							)
				  )
) //end of chain_guides

 

It's completely strange! Thanks for taking a look!

 

-Frank

Link to comment
https://forums.phpfreaks.com/topic/175436-unknown-column-in-field-list/
Share on other sites

Okay.. I'm not going to read all of that,

the problem is simple.. a field name doesn't exist in the table

 

find the line that is causing the error and change from

mysql_error()

to

$sql.mysql_error()

review the line and compare the field names to the ones in the table

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.