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' Link to comment https://forums.phpfreaks.com/topic/30752-my-stupidity-solved/ 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] Link to comment https://forums.phpfreaks.com/topic/30752-my-stupidity-solved/#findComment-141738 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 Link to comment https://forums.phpfreaks.com/topic/30752-my-stupidity-solved/#findComment-141739 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.