homepage Welcome to WebmasterWorld Guest from 54.226.93.128
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / WebmasterWorld / New To Web Development
Forum Library, Charter, Moderators: brotherhood of lan & mack

New To Web Development Forum

    
How to build my own CMS
apollo23




msg:957927
 3:41 pm on Jun 13, 2006 (gmt 0)

Hi guys

I know that there are probably tons of free cms out there. However, i found it hard to get them set up or the learning of the cms is too time consuming.

Moreover, i dont think i need such a complicated cms anyway. Hopefully i can learn some php/mysql programming along the way as well.

Just need a cms to update my site via an admin page and another page to control the sequence of the menu bar.

To begin, i hv created a form to add the data into my mysql which i hv already created. However, i can only update individual field so far. Whenever i filled in all the fields, i hv error with tht code.

Can anybody shade more lights to it before i progress further? Below is my code.

<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<table width="700" border="0" cellpadding="2" cellspacing="1" align="center">
<tr>
<td width="100">Filename</td>
<td><textarea name="filename" cols="20" rows="1"></textarea></td>
</tr>
<tr>
<td width="100">Keywords</td>
<td><textarea name="keywords" cols="50" rows="3"></textarea></td>
</tr>
<tr>
<td width="100">Description</td>
<td><textarea name="description" cols="50" rows="2"></textarea></td>
</tr>
<tr>
<td width="100">Headline</td>
<td><textarea name="headline" cols="50" rows="2"></textarea></td>
</tr>
<tr>
<td width="100">Article</td>
<td><textarea name="article" cols="80" rows="20"></textarea></td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2" align="center"><input name="save" type="submit" value="Save Article"></td>
</tr>
</table>
</form>

<?php

// Get the PHP file to connect to mysql and database "db_cgig"

$dbcnx = @mysql_connect('localhost','root','');
if (!$dbcnx) {
exit ('<p> Unable to connect to the ' .
'database server at this time.</p>');
}

if (!@mysql_select_db('db_cgig')) {
exit ('<p> Unable to connect to the ' .
'database server at this time.</p>');
}

if(isset($_POST['save']))
{
$filename = $_POST['filename'];
$keywords = $_POST['keywords'];
$description = $_POST['description'];
$headline = $_POST['headline'];
$article = $_POST['article'];
$query = "INSERT INTO content (filename, keywords, description, headline, article)".
"VALUES ('$filename', '$keywords', '$description', '$headline', '$article')";

mysql_query($query) or die('Error ,query failed');

echo "Article '$filename' added";
}
?>

 

apollo23




msg:957928
 3:00 pm on Jun 29, 2006 (gmt 0)

Hi guys

Hv already overcame the form update.

Am now trying to create my dynamic menu. The menu should pick up the title and url of the file from my database.

The address of the url is showing fine and i am struggling to put the title in that url. Below is my code:

<?php
require('testconnection.php');

// Request to pick up the menu title

$sql="SELECT * from content";
$cmd=mysql_query($sql);
if (!$cmd) {
exit('<p>Error performing query' .
'at this time.</p>');
}
while ($row=mysql_fetch_array($cmd))
{
$menu=$row['menu'];
$filename=$row['filename'];

echo '<p>' . '<a href="'. $_SERVER['PHP_SELF'].
'?showmenu='. $filename. '">'.
'$menu </a></p>';
}
?>

And the result i get on the browser is this:

$menu

$menu

$menu

$menu

$menu

$menu

$menu

Pls enlighten. Will keep trying even while i posted this.

Thanks a million.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / New To Web Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved