mendoz Posted December 15, 2006 Share Posted December 15, 2006 HeyyyyyI'm just trying to update a single column in a single row but cannot...The table is 'site' and the column is 'scroll':if it's set to 'yes' then enter 'no, and vice versa[code]<?php// Connect to the databaseinclude("sql/conn.php");// Select the databsemysql_select_db($db_name) or die( "Unable to select database");// This will get the value from the database$query="SELECT scroll FROM site"; $scrollresult=mysql_query($query);$scroll=mysql_result($scrollresult,0,"scroll");echo "currently set to $scroll<br/><br/>";if ($scroll=="yes") { $newscroll="no";} else { $newscroll="yes";}echo "now it's set to $newscroll<br/><br/>";// here is where it dies$sql="update pc set scroll='$newscroll'"; // pc is the table and scroll is the column, there's only one row$result=mysql_query($sql,$connection) or die(mysql_error());?>[/code]returns:currently set to nonow it's set to yesUnknown column 'scroll' in 'field list' Quote Link to comment Share on other sites More sharing options...
taith Posted December 15, 2006 Share Posted December 15, 2006 you had pc... should be site[code]<?phpinclude("sql/conn.php");mysql_select_db($db_name) or die( "Unable to select database");$scrollresult=mysql_query("SELECT scroll FROM site");$scroll=mysql_result($scrollresult,0,"scroll");echo "currently set to $scroll<br/><br/>";if($scroll=="yes") $newscroll="no";else $newscroll="yes";echo "now it's set to $newscroll<br/><br/>";// here is where it dies$result=mysql_query("update site set `scroll`='$newscroll'") or die(mysql_error());?>[/code] Quote Link to comment Share on other sites More sharing options...
mendoz Posted December 15, 2006 Author Share Posted December 15, 2006 ok that was really dumbthanks taith god dammit ahhhhhhhhhhhhhhhhhhhh 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.