FloridaNutz Posted August 24, 2006 Share Posted August 24, 2006 Ok, I have a page where I can edit the entries I have and it works fine. I think the problem is that there is multiple entries that will have UCF as their area... I want the sql to go through and only display the bars in that area[code]$idm = $_GET[id];$sql = "SELECT * FROM $table_name WHERE UCF_id=$idm";[/code]but when I try to bring up only a certain area of bars I get an error[code]$barAreaM = "$_GET[barMenu]";$sql = "SELECT * FROM $table_name WHERE barName=$barAreaM";[/code]Unknown column 'UCF' in 'where clause' Quote Link to comment Share on other sites More sharing options...
FloridaNutz Posted August 24, 2006 Author Share Posted August 24, 2006 [code]<?//access the database$barAreaM = "$_GET[barMenu]";$db_name = "cfuf"; $table_name = "dso_bars";$connection = @mysql_connect("+++", "+++", "+++") or die(mysql_error());$db = @mysql_select_db($db_name, $connection) or die(mysql_error());$sql = "SELECT * FROM $table_name WHERE barName=$barAreaM";$result = @mysql_query($sql, $connection) or die(mysql_error());while ($row = mysql_fetch_array($result)) { $barArea = $row['barArea']; $UCF_id = $row['UCF_id']; $barName = stripslashes($row['barName']); $barPhone = stripslashes($row['barPhone']); $barAddress = stripslashes($row['barAddress']); $barVIP = stripslashes($row['barVIP']); $barCity = stripslashes($row['barCity']); $barZip = stripslashes($row['barZip']); $barComments = stripslashes($row['barComments']); $barKey = stripslashes($row['barKey']); $barKey = unserialize($row['barKey']); $view = '<a href="../bar/do_viewbar.php?id='. $UCF_id. '"> <img src="../images/search.png" width="16" height="16" border="0"></a>'; $edit = '<a href="../bar/edit_bar.php?id='. $UCF_id. '"> <img src="../images/edit.png" width="16" height="16" border="0"></a>'; $delete = '<a href="../bar/delete_confirm.php?id='. $UCF_id. '"><img src="../images/delete.png" width="16" height="16" border="0"></a>';$display_block .= "<p><strong>$barName:</strong> $barAddress, $barCity $barZip<br> Phone: $barPhone VIP Line: $barVIP $view $edit $delete</p><br> <strong>Bar Key:</strong> $barKey[0] $barKey[1] $barKey[2] $barKey[3] $barKey[4] $barKey[5] $barKey[6] $barKey[7] $barKey[8]<br> $barKey[9] $barKey[10] $barKey[11] $barKey[12]<hr />";} ?><html><head><title>View Bars</title></head><body><p><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><img src="../images/admin_head.gif" width="380" height="51" /></font><a href="../admin_main.html"><img src="../images/Menu.png" width="94" height="32" border="0"></a></p><hr /><span class="Heading"><strong class="Heading"><font color="#B5BFCC" size="6" face="Verdana, Arial, Helvetica, sans-serif">Orlando </font><font color="#B5BFCC" size="6" face="Verdana, Arial, Helvetica, sans-serif">Area<br></font></strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><br><br><? echo "$display_block"; ?></font></body></html> [/code]This is how I would get all the bars before[code]$sql = "SELECT * FROM $table_name ORDER BY UCF_id";[/code] Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 24, 2006 Share Posted August 24, 2006 I don't understand how you get an unknown column UCF from a query looking for the column barName.Try restructuring your code - and remove the @ symbols so you see errors.[code]$barAreaM = $_GET['barMenu'];$sql = "SELECT * FROM $table_name WHERE barName = '$barAreaM' ";$result = mysql_query($sql) or die("Error: ". mysql_error(). " with query ". $sql); // helpful error message[/code] Quote Link to comment Share on other sites More sharing options...
FloridaNutz Posted August 24, 2006 Author Share Posted August 24, 2006 ok, i changed [code]$sql = "SELECT * FROM $table_name WHERE barName=$barAreaM";to$sql = "SELECT * FROM $table_name WHERE barName='$barAreaM'";[/code]but now I get no bars at all... Quote Link to comment Share on other sites More sharing options...
FloridaNutz Posted August 24, 2006 Author Share Posted August 24, 2006 sorry, typo[code]$sql = "SELECT * FROM $table_name WHERE barName='$barAreaM'";[/code]I have no idea why I put barName instead of barArea.... too much time infornt of the computer...Fixed it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.