h4v0c Posted September 1, 2006 Share Posted September 1, 2006 Hi All,Im relatively new to php and am working on a project for a client. I am using the FCKeditor(www.fckeditor.net) version 2.1. The webserver the PHP is running on is(to my knowledge) windows 2000 server, and the PHP version on the server is the latest stable version(which I dont remember the actual number). The editor is posting the data to my script. My post handler script is as follows:[code]$sValue = stripslashes( $_POST['PSP_editor'] ) ;$posted_id = $_POST['page_id_value'] ;mysql_connect("database URL", "Username", "Password") or die ('I can?t connect to the database.') ;mysql_select_db("clientd_psp") ;mysql_query("UPDATE content_tbl SET page_content=$sValue WHERE page_id=$posted_id") ;[/code]Obviously I have changed the URL, username and password. This has me stumped, if I comment out the mysql commands and have it echo the 2 variables and they come back with the correct data, but it refuses to successfully update the fields. I do have read and write access to the database as I entered the content into the DB. Whats up?Thanks is advance,John Quote Link to comment Share on other sites More sharing options...
xyn Posted September 1, 2006 Share Posted September 1, 2006 try...$sValue = stripslashes( $_POST['PSP_editor'] ) ;$posted_id = $_POST['page_id_value'] ;mysql_connect("database URL", "Username", "Password") or die ('I can?t connect to the database.') ;mysql_select_db("clientd_psp") ;mysql_query("UPDATE content_tbl SET page_content='$sValue' WHERE page_id='$posted_id'") ;if not i'll read the problem.. :/ Quote Link to comment Share on other sites More sharing options...
xyn Posted September 1, 2006 Share Posted September 1, 2006 Or try:[code=php:0]$host="localhost"; // default is this change if nessesary.$login="user";$pwd="pwd";$db="database_name";$conn = mysql_connect("$host", "$login", "$pwd") or die('SQL Error: '.mysql_error().'');mysql_select_db($db, $conn);mysql_query("UPDATE content_tbl SET page_content='".stripslashes($_POST['PSP_editor'])."' WHERE page_id='".$_POST['page_id_value']."'");[/code] Quote Link to comment Share on other sites More sharing options...
h4v0c Posted September 1, 2006 Author Share Posted September 1, 2006 Thank you so much. the second one fixed it, now it works perfectly. OMG THANKS SO MUCH! ;D 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.