Jump to content

gosox345

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Everything posted by gosox345

  1. oh! lol quotes around the variables in my query made all the difference! now my code works and updates the mySQL entry! thankyou so much!!
  2. soo baisically i have a table in a mySQL database called 'pages'. the fields are as follows: 'id' (int(11)) 'name' (varchar(30) 'title' (varchar(30) 'content' (varchar(65466) 'id' is the primary key, set to auto-increment, and is unique. 'name' is just for development proposes to make the database easier to interpret for the developer when looking at the records, i think it might be in my code in maby 1 place, but for the most part this field is useless. 'title' is the what will be echoed in an <h1> tag at the top of the web page. im planning on phassing this out soon and just merging it with the html contained in the 'content field' 'content' is echoed inside a <div>. this contains all sorts of html tags (thus why it has such a high varchar upper-limit) and all of the html code and content of the page other than the site's general layou. so ive incorporated a WYSIWYG in-page html edior called FCKeditor ( http://www.fckeditor.net/ ) that is user-freindly, and is easy to handel posted data with. The code to incorporate the editor to your page is this at the top of your code: <?php include_once("fckeditor/fckeditor.php") ; ?> and this wherever you want the editor to show up: <?php $oFCKeditor = new FCKeditor('FCKeditor1') ; $oFCKeditor->BasePath = 'fckeditor/' ; $oFCKeditor->Value = '<p>HTML content to be edited can go here!</p>' ; $oFCKeditor->Create() ; ?> the content of the editor in the code aboved is suposidly will behave like a normal <INPUT>. the string that is currently set to 'FCKeditor1' will be of equivalence to the 'name property' of the <INPUT> (in other words it should emulate html that looks like this <input name='FCKeditor1'>). the PHP developers guide for FCKeditor can be found here: http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Integration/PHP ---------------------------------------------------------------------------------- NOW, heres my code. edit_pagename.php <?php include_once("fckeditor/fckeditor.php") ; ?> <html> <head> <title>Edit Page: Pagename</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <center><b>Edit Page: Pagename</b></center> <a href='javascript:history.back(-1)'><img src="back.gif" alt="Go Back" border="0" /></a> <a href="logout.php"><img src='logout.gif' onmouseover="this.src='logoutover.gif'" onmouseout="this.src='logout.gif'" alt="Logout" border='0' /></a> <hr> <form action="pages_edit_about_update.php" method="post"> Header: <input type="text" name="title" id="title" value=" <?php mysql_connect("localhost", "database_username", "password") or die(mysql_error()); mysql_select_db("some_database") or die(mysql_error()); $result = mysql_query("SELECT * FROM pages WHERE name='pagename'") or die(mysql_error()); $row = mysql_fetch_array( $result ); echo $row['title']; ?> " /> //^^ this sets the value property of an <input> tag to a specific 'title' value. //see above where i define the fields of my mySQL table <br> <?php mysql_connect("localhost", "database_username", "password") or die(mysql_error()); mysql_select_db("some_database") or die(mysql_error()); $result = mysql_query("SELECT * FROM pages WHERE name='about'") or die(mysql_error()); $row = mysql_fetch_array( $result ); $gotdata = stripslashes($row['content']) ; $oFCKeditor = new FCKeditor('FCKeditor1') ; $oFCKeditor->BasePath = 'fckeditor/' ; $oFCKeditor->Value = $gotdata ; $oFCKeditor->Create() ; ?> <br> <input type="submit" value="Submit"> </form> <br> <a href="techsupport.php">Technical Support</a> </body> </html> edit_pagename_update.php see above in this post where i have what all the fields are about in my database table <?php $mytitle = $_POST['title']; $content = $_POST['FCKeditor1']; $myid = 3; $con = mysql_connect("localhost","database_username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("some_database", $con); mysql_query("UPDATE pages SET content = $content WHERE id = $myid") or die(mysql_error()); mysql_close($con); ?> now this is the beginning value of the 'content' field entry im trying to do a PHP/mySQL update on: '<p>About site can go here!</p>' this is the value im trying to update it to: <p>About site can go here! testingtesting123!</p> ------------------------------------------------ now heres the eror i get on edit_pagename_update.php with posted data contained from edit_pagename.php You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' About site can go here! testingtesting123! WHERE id = 3' at line 1 =/ i think my syntax is correct. im not sure what the problem could be. ive been stumped on this for afew days now and I really want to move on lol. help! i used notepad++ to write all my PHP code if that helps this is my first real PHP project lol, just picking up the language as I go so im stumped
  3. OK, so im designing and developing a website for a local municipality, one of their requirements is that they need to be able to upload files (primarily .PDF's and images. possibly even .DOC's). Is their any free and/or open-source php file manager application out their that I can use in my project to allow my clients to upload files and manage their uploads? Preferably that can be embedded onto the side of pages that I have set that allow the site moderators to edit the content of their pages?
×
×
  • 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.