Jump to content
Killersites Forums


  • Posts

  • Joined

  • Last visited

Everything posted by Danno

  1. Danno

    Post Time Issue

    Sorry. I don't speak enough jargon. The DB Table: CREATE TABLE IF NOT EXISTS `articles` ( `date` datetime NOT NULL, `pagetitle` varchar(60) NOT NULL COMMENT 'Tes?', `content` text NOT NULL, PRIMARY KEY (`pagetitle`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; The section in index.php where the info is being displayed: <?php $sql = "select * from articles"; $result = mysql_query ($sql); while ($row = mysql_fetch_array($result)) { $field1= $row["pagetitle"]; $field2= $row["content"]; $field3= $row["date"]; echo "$field1 "; echo "$field3 "; echo "$field2 "; } ?> and go.php which sends the info to the db: <?php include '../includes/config.php'; $insert = "INSERT INTO articles (pagetitle, content, date) VALUES ('".$_POST['pagetitle']."', '".$_POST['content']."', '".$_POST['date']."')"; $add_data = mysql_query($insert); ?> If you need other info just tell me what you need.
  2. Danno

    Post Time Issue

    I took out the code that gave the error again. Current go.php <?php include '../includes/config.php'; $insert = "INSERT INTO articles (pagetitle, content, date) VALUES ('".$_POST['pagetitle']."', '".$_POST['content']."', '".$_POST['date']."')"; $add_data = mysql_query($insert); ?> Sorry guys for being such a no0b and a pain in the arse.
  3. I did mate and it just doesn't make sense to me. I am unsure on what I need to change etc, as the one posted already has values in the code, if that makes sense.
  4. Danno

    Post Time Issue

    Ok, I have added that code to go.php and when I submit the form I get this: "Column count doesn't match value count at row 1" The display still show all zeros.
  5. Danno

    Post Time Issue

    I am trying to get MySQL to send out the date of the article and display it when the article is posted. Just like on a blog or here on the forums. Using the timestamp feature in MySQL. Also tried timedate in MySQL but that sends out the same. All zeros.
  6. Nah it just adds another article under the current one.
  7. Danno

    Post Time Issue

    I am trying to get the time to show for articles. I have set up the field in articles table but each time I post a new article the time comes up as 0000-00-00 00:00:00 Here is the code sending the info to the database: <?php include '../includes/config.php'; $insert = "INSERT INTO articles (pagetitle, content, date) VALUES ('".$_POST['pagetitle']."', '".$_POST['content']."', '".$_POST['date']."')"; $add_data = mysql_query($insert); ?> And here is the section on my php page that displays the articles: <?php $sql = "select * from articles"; $result = mysql_query ($sql); while ($row = mysql_fetch_array($result)) { $field1= $row["pagetitle"]; $field2= $row["content"]; $field3= $row["date"]; echo "$field1 "; echo "$field3 "; echo "$field2 "; } ?> Any ideas?
  8. Ok I am stuck again. Now, when I submit new text, what I want it to do is replace the current content. Instead, it adds to it. Be great if I was doing a Blog, but I aint. Any ideas? I searched Google but can only find Delete or Update. Neither work.
  9. All working I send the data from the form to go.php, which in turn sends it to MySQL. I then use the following code to get the table data and display it on the page: <?php $sql = "select * from articles"; $result = mysql_query ($sql); while ($row = mysql_fetch_array($result)) { $field1= $row["content"]; $field2= $row["pagetitle"]; echo "$field2 "; echo "$field1 "; } ?> The next things I need to do: 1. Find how to keep the edited text in the editor so I can come back at a later date and update it. 2. As mentioned by krillz, I gotta make everything secure. I am posting everything here, and will also post on my personal blog later so others may find it helpful.
  10. Don't tell me you are just puting in $_POST[] variables without checking them' date=' as that is the biggest no-no you can do in terms of php security. Read up on SQL injections as your code has nothing that even tries to prevent them.[/quote'] I'm just putting it together at the mini mate. Will add the security later once I have everything working. Thanks for that. Update. Got the pagetitle working now too.
  11. Making Progress!!! I changed go.php again to: <?php include '../includes/config.php'; $insert = "INSERT INTO articles (pagetitle, content) VALUES ('".$_POST['pagetitle']."', '".$_POST['content']."')"; $add_data = mysql_query($insert); ?> It sends the content data to the relevent field in MySQL. However, it seems the pagetitle is not being sent or inserted. Just need to sort that young man out and then get the code to display. Which will not be too hard.
  12. I changed go.php to the following: <?php include '../includes/config.php'; $mysql = array(); // create array of mysql escaped values $mysql['pagetitle'] = mysql_real_escape_string( $_POST['pagetitle'] ); $mysql['content'] = mysql_real_escape_string($_POST['content'] ); $sql = "INSERT INTO articles ( pagetitle, content ) VALUES ( '{$mysql['pagetitle, content']}' )"; //insert your comment to db mysql_query( $sql ); ?> It gives a blank page, which tells me I am doing something right. But it's not sending the info to the database. Maybe I am misunderstanding this. This is meant to insert the content into the pagetitle and content fields in my db right?
  13. Getting the following error now:
  14. Page Title: Content: This is some content that will be editable with TinyMCE.
  15. Exactly. I forked apps before. Easy as pie to do. But I could never say it was mine. I'm over that crap now. Wanna do something of my own. But, need as much tuition as possible to get started and so far, you've put me in a good direction.
  16. Thanks a million mate. You mentioned about WP, Joomla! etc. I agree. There are loads and loads of ready-made applications out there that people can use and are easy to install. I personally use Joomla! and WP for my sites. However, most of the packages available are bloated with features. My plan is to create something that is severely lightweight. What I have done so far, which is the layout and design, is something like 60kb and that's including Readme and License files etc. Takes about 3 seconds to upload and extract the zip file in cPanel. Now, that being said, there are lots of systems out there that are just like that. But, I guess by doing this one, I get to learn and advance and people interested in using it, get an easy to use website for free. Joomla! and Wordpress are fantastic apps and there are many more out there that are just as good. Silverstripe, for one, has great potential. But I want to contribute to the Open Source world and by doing something like this, I can sit back, hold my head up and say "I did that!".
  17. Thanks Benjamin. Your help so far is really appreciated. I will look into all of this and see what happens.
  18. Ok here is what I am at. I want to create a website that will make it easier for those who have no webdesign knowledge at all, to have their own website where they can update the content on each page using WYSIWYG. So, say they want to update their index.php page, they login to admin and go to editindex.php where it will display TinyMCE with the content in the editor. They make the changes they want, click save, and the changes are visible in index.php. I know I am jumping right in for someone with very little knowledge of PHP and MySQL but I know with a little tuition I can do this.
  19. The part that's confusing me at the moment is creating a table in the database that will contain the info for the pages. Like, I know that CREATE TABLE tells MySQL that I want to create a new table etc. What's killing me is what I need to do to create rows for each page. Or, do I need to create a table for each page? Like, for say, index.php: CREATE TABLE `content` ( `indexpage` text NOT NULL, `contactpage` text NOT NULL ); Or: CREATE TABLE `indexpage` ( `content` text NOT NULL ); As I said, I am new to this lol
  20. Thank you very much mate. I am very new to this so me+php+mysql=Complete and Utter Confusion. I will try this out on a test account later and see how it all goes. Thanks again.
  21. Hi folks, I am very new to PHP, MySQL etc and am in the middle of designing my first application in PHP. I want to install TinyMCE so I can easily edit pages from the admin backend. I have TinyMCE showing in the editindex.php page but am stuck on what I need to do in order to get it to send data to MySQL and for MySQL to send the data to the section on the index.php page where I want the data to be displayed. Hope I am making sense here. If anyone can please walk me through it, I would very much appreciate it and will credit you in the finished product, which I hope to release under the GPL. Thanks in advance. Danno
  • Create New...