Jump to content
Killersites Forums

Danno

Member
  • Posts

    21
  • Joined

  • Last visited

Profile Information

  • Location
    Bendigo, Australia

Contact Methods

  • Website
    http://www.vichost.com
  • LinkedIn
    http://twitter.com/danriordan
  • Other
    msn@eaglehawkit.com

Danno's Achievements

Newbie

Newbie (1/14)

0

Reputation

  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.
×
×
  • Create New...