View Single Post
  #9 (permalink)  
Old 02-05-07, 02:11 PM
sn0wy sn0wy is offline
Newbie Coder
 
Join Date: Jan 2006
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Ok for some reason this is not inserting into a database

PHP Code:

<?PHP

include ("includes/db.php");

$id2 $_POST['id2'];

$free_text mysql_real_escape_string($_POST['free_text']); 
$awards_text mysql_real_escape_string($_POST['awards_text']);  

$table_name "baccount";
      
          
$connection = @mysql_connect($dbserver$dbuser$dbpass) or die ("Couldn't Connect to database");
          
$db = @mysql_select_db($dbname$connection) or die(mysql_error());
          
$sql "UPDATE $table_name set free_text= '$free_text', awards_text= '$awards_text' WHERE id = '$id2'";
          
$result = @mysql_query($sql,$connection) or die(mysql_error()); 
        
          
?>
          
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>foodplanet infonet</title>
<link href="includes/default.css" rel="stylesheet" type="text/css" />
</head><body>
<div id="extra">Classifications    (<?php echo ''.$id2.''?>)</div><div id="extra1">
Classification update completed<br />
<?php echo ''.$free_text.''?>
<a href="Javascript: self.close()">Close Window</a>
</div>   
</div>
</body>
</html>
The error i get is this

PHP Warning: mysql_real_escape_string(): A link to the server could not be established in /home/f/o/foodplanet/public_html/info/extratext2.php on line 7
__________________
Power is in my programming fingers
Reply With Quote