Re: error message ... never seen this one before.
| From: | Marek Kilimajer | Date: | Wed, 19 Mar 2003 18:18:55 +0000 |
| Subject: | Re: error message ... never seen this one before. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-140320@lists.php.net to get a copy of this message | ||
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