Jump to content

Recommended Posts

I dont understand why im getting this error:

Unknown column 'be1' in 'field list'

 

The code is:

<?
if($_POST['submit']){
   $status=clean_up($_POST['status']);
   $rpp=clean_up($_POST['rpp']);
   $sitename=clean_up($_POST['sitename']);
   $url=clean_up($_POST['url']);
   $topads=$_POST['topads'];
   $bottomads=$_POST['bottomads'];
   $be1=$_POST['be1'];
   $be2=$_POST['be2'];
   $theme=clean_up($_POST['theme']);
mysql_query("UPDATE settings SET `sitename`='$sitename',`url`='$url',`status`='$status',`rpp`='$rpp',`topads`='$topads',`bottomads`='$bottomads',`theme`='$theme', `be1`='$be1', `be2`='$be2' where id=1") or die(mysql_error());
echo '<div class="done">Settings updated</div><br />';
}else{

echo "<div class='header'>Site Settings</div>";

echo'<form action="admin.php?action=settings" method="POST"><div class="content">

Site Status: <select type="dropdown" name="status">
<option value="online">Online</option>
<option value="offline">Offline</option>
</select>
<br />

Site URL: <input class="tarea" type="text" name="url" size="30" value="'.$settings3[url].'">
<br />

Site Name: <input class="tarea" type="text" name="sitename" size="30" value="'.$ssitename.'">
<br />

Site Theme: <input class="tarea" type="text" name="theme" size="30" value="'.$settings3[theme].'">
<br />

Results Per Page: <input class="tarea" type="text" name="rpp" size="20" value="'.$resultspp.'">
<br />
<br />

Top Ads:<br />
<textarea class="tarea" name="topads" rows="5" cols="40">'.$settings3[topads].'</textarea><br />
<br />

Bottom Ads:<br />
<textarea class="tarea" name="bottomads" rows="5" cols="40">'.$settings3[bottomads].'</textarea><br />
<br />

Banner Exchange <small>(Left Side)</small>:<br />
<textarea class="tarea" name="be1" rows="5" cols="40">'.$settings3[be1].'</textarea><br />
<br />

Banner Exchange <small>(Right Side)</small>:<br />
<textarea class="tarea" name="be2" rows="5" cols="40">'.$settings3[be2].'</textarea><br />
<br />

<input type="submit" name="submit" id="submit" value="Change!"></div></form>';
}
?>

Link to comment
https://forums.phpfreaks.com/topic/169996-solved-unknown-column-error/
Share on other sites

Just a wild guess, but your settings table probably does not have a column named be1. Are you sure that is the query and the file where the error is occurring?

 

If your table does in fact have a column by that name, with that exact spelling and capitalization (assuming you are on an operating system that is case-sensitive), you need to form your query in a variable so that you can echo it to see exactly what is in the query.

nope the settings table has be1 and the query im getting the $settings3[be1] from looks like this:

$settings2=mysql_query("SELECT * from settings where id='1'") or die("Could not get settings");
$settings3=mysql_fetch_array($settings2);

 

be1 is all non-caps too.

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.