Intranet Journal

Go Back   IT Management Forum > Intranet Journal

Intranet Journal The new discussion forum for Intranet Journal readers. Leave comments and questions for IJ authors. Suggest story ideas and provide feedback.

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-12-2004, 08:18 AM
RAIA RAIA is offline
Member
 
Join Date: Sep 2004
Posts: 1
Creating a PHP-Based Content Management System

When will you add new article?

PS:Sorry for my English, I cant speak very well
Reply With Quote
  #2 (permalink)  
Old 09-13-2004, 09:01 AM
MikeP MikeP is offline
Registered User
 
Join Date: Aug 2004
Location: Connecticut
Posts: 84
The next article (Part 4) in the series is due to run during the first week of October.

For those of you who want to read the parts that have been published to this point, here are the links:

Creating a PHP-Based Content Management System
Part 1: http://www.intranetjournal.com/artic...07_06_04a.html

Part 2: http://www.intranetjournal.com/artic...08_05_04a.html

Part 3: http://www.intranetjournal.com/artic...09_07_04a.html
Reply With Quote
  #3 (permalink)  
Old 09-22-2004, 01:53 PM
samlutley samlutley is offline
Registered User
 
Join Date: Sep 2004
Location: Tifton, GA
Posts: 3
Parse Error

First off, great articles. I've really enjoyed reading them.

But, when I went to newArticle.php, I got an error:
Parse error: parse error, unexpected T_STRING in /www/n/name/htdocs/folder/cmsadmin/newArticle.php on line 7

I'm not sure what the problem is.

Here's the file:

<html>
<head>
<title>Submit New Article</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<?php

require_once("../includes/DbConnector.php");

// Check whether a form has been submitted. If so, carry on
if ($HTTP_POST_VARS){

// Create an instance of DbConnector
$connector = new DbConnector();

// IMPORTANT!! ADD FORM VALIDATION CODE HERE - SEE THE NEXT ARTICLE

// Create an SQL query (MySQL version)
$insertQuery = "INSERT INTO cmsarticles (title,tagline,section,thearticle) VALUES (".
"'".$HTTP_POST_VARS['title']."', ".
"'".$HTTP_POST_VARS['tagline']."', ".
$HTTP_POST_VARS['section'].", ".
"'".$HTTP_POST_VARS['thearticle']."')";

// Save the form data into the database
if ($result = $connector->query($insertQuery)){

// It worked, give confirmation
echo '<center><b>Article added to the database</b></center><br>';

}else{

// It hasn't worked so stop. Better error handling code would be good here!
exit('<center>Sorry, there was an error saving to the database</center>');

}

}
?>

<body>
<form name="form1" method="post" action="newArticle.php">
<p>&nbsp;Title:
<input name="title" type="text" id="title">
</p>
<p>&nbsp;Tagline:
<input name="tagline" type="text" id="tagline">
</p>
<p>&nbsp;Section:
<input name="section" type="text" id="section">
</p>
<p>&nbsp;Article:
<textarea name="thearticle" cols="50" rows="6" id="thearticle"></textarea>
</p>
<p align="center">
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>

thanks,
Sam
Reply With Quote
  #4 (permalink)  
Old 09-22-2004, 02:33 PM
petez petez is offline
Registered User
 
Join Date: Sep 2004
Posts: 35
Hi Sam, glad you're enjoying the articles!

I've tried the code you posted, it works perfectly on my computers. The message states there's a "parse error", meaning there's nothing wrong with the database connection or anything like that.

Please try changing
PHP Code:
<?php
to
PHP Code:
<?
on line 6, and tell me what happens!

Peter.
Reply With Quote
  #5 (permalink)  
Old 09-22-2004, 02:51 PM
samlutley samlutley is offline
Registered User
 
Join Date: Sep 2004
Location: Tifton, GA
Posts: 3
What happens

Parse error: parse error, unexpected T_STRING in /www/n/name/htdocs/folder/cmsadmin/newArticle.php on line 8
Reply With Quote
  #6 (permalink)  
Old 09-22-2004, 02:54 PM
samlutley samlutley is offline
Registered User
 
Join Date: Sep 2004
Location: Tifton, GA
Posts: 3
Solution

Guess it didn't like being written in WordPad...

Works now.

sam
Reply With Quote
  #7 (permalink)  
Old 10-01-2004, 02:08 AM
matthijs matthijs is offline
Registered User
 
Join Date: Oct 2004
Location: Netherlands
Posts: 13
Thanx from me too! Great articles. I'm also a newbee on php/mysql OOp etc, so this tutorial is great. For people like me, who can build xhtml/css sites, but want to expand on that to be able to make a simple cms for axample, this is very nice.

And I think that with this object oriented programming, I'll be able to expand on this system without a problem, right?

I can't wait till the next part.

matthijs.
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 04:54 AM.





Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0