Put single quotes around the strings in your sql statementS:
$sql2 = SELECT id FROM store_name WHERE name = '.$name[$i].';
^ ^
if this does not help, print out the query strings.
Daniel McCullough wrote:
I get this error.
Unknown column 'B' in 'where clause'
From this code.
$sql = SELECT * FROM store;
$result = mysql_query($sql) or die(mysql_error());
$store = mysql_fetch_array($result);
$count = mysql_num_rows($result);
$id = $store['id'];
$name = $store['name'];
$address = $store['address'];
$state = $store['state'];
$groups = $store['groups'];
for ($i=0; $i$count; $i++) {
$sql2 = SELECT id FROM store_name WHERE name = .$name[$i].;
$result2 = mysql_query($sql2) or die(mysql_error());
$store_name = mysql_fetch_object($result2);
$sql3 = SELECT id FROM store_address WHERE address =
.$address[$i].;
$result3 = mysql_query($sql3) or die(mysql_error());
$store_address = mysql_fetch_object($result3);
$sql4 = SELECT id FROM store_state WHERE state_name =
.$state[$i].;
$result4 = mysql_query($sql4) or die(mysql_error());
$store_state = mysql_fetch_object($result4);
$build_sql .= $id. - .$store_name. - .$store_address. -
.$store_state. - .$groups[$i].br\n;
}
any thoughts?
_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php