0

can somebody help me by telling me what the problem is this is my error i keep getting
Notice: Array to string conversion in C:\wamp\www\plaincart\library\config.php on line 61

Notice: Array to string conversion in C:\wamp\www\plaincart\library\config.php on line 61

Notice: Array to string conversion in C:\wamp\www\plaincart\library\config.php on line 61
Unknown column 'A' in 'where clause'

and this is the code

if (!get_magic_quotes_gpc()) {
	if (isset($_POST)) {
		foreach ($_POST as $key => $value) {
			$_POST[$key] =  trim(addslashes($value)); //line 61
		}
	}
	
	if (isset($_GET)) {
		foreach ($_GET as $key => $value) {
			$_GET[$key] = trim(addslashes($value));
		}
	}	
}

this is the full code

<?php
ini_set('display_errors', 'On');
//ob_start("ob_gzhandler");
error_reporting(E_ALL);

// start the session
session_start();

// database connection config
$dbHost = 'localhost';
$dbUser = 'ronny';
$dbPass = 'password';
$dbName = 'plaincart';
//$dbHost = 'mysql9.000webhost.com';
//$dbUser = 'a2597057_shyeb';
//$dbPass = 'shyebahmed786';
//$dbName = 'a2597057_shyeb';


// setting up the web root and server root for
// this shopping cart application
$thisFile = str_replace('\\', '/', __FILE__);
$docRoot = $_SERVER['DOCUMENT_ROOT'];


$webRoot  = str_replace(array($docRoot, 'library/config.php'), '', $thisFile);
$srvRoot  = str_replace('library/config.php', '', $thisFile);

//define('WEB_ROOT', $webRoot);
//define('SRV_ROOT', $srvRoot);
define('WEB_ROOT', '/plaincart/');
//define('WEB_ROOT', '/public_html/');
define('SRV_ROOT', 'c:/wamp/www/plaincart/');
//define('SRV_ROOT',('/home/a2597057/public_html/');

// these are the directories where we will store all
// category and product images
define('CATEGORY_IMAGE_DIR', 'images/category/');
define('PRODUCT_IMAGE_DIR',  'images/product/');

// some size limitation for the category
// and product images

// all category image width must not 
// exceed 75 pixels
define('MAX_CATEGORY_IMAGE_WIDTH', 75);

// do we need to limit the product image width?
// setting this value to 'true' is recommended
define('LIMIT_PRODUCT_WIDTH',     true);

// maximum width for all product image
define('MAX_PRODUCT_IMAGE_WIDTH', 300);

// the width for product thumbnail
define('THUMBNAIL_WIDTH',         75);

if (!get_magic_quotes_gpc()) {
	if (isset($_POST)) {
		foreach ($_POST as $key => $value) {
			$_POST[$key] =  trim(addslashes($value));
		}
	}
	
	if (isset($_GET)) {
		foreach ($_GET as $key => $value) {
			$_GET[$key] = trim(addslashes($value));
		}
	}	
}

// since all page will require a database access
// and the common library is also used by all
// it's logical to load these library here
require_once 'database.php';
require_once 'common.php';

// get the shop configuration ( name, addres, etc ), all page need it
$shopConfig = getShopConfig();
?>

Edited by ronny22: n/a

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by darkagn
0

You have three entries in your $_POST array that are themselves arrays. The addslashes function expects a string and can't parse the array. Try this to see what is going on:

if (isset($_POST)) {
echo "<pre>";
print_r($_POST);
echo "</pre>";

This will print out your $_POST array in a neat format and you will be able to see what the inner arrays are.

EDIT: By the way, you might want to delete the full code part of your previous post as it contains your mysql password!

Edited by darkagn: Warning added.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.