Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 344
0 Users 4 Guests Online
Forum Index » PHP + MySQL » Personal Blog for Users
Posted on Friday 8th June 2007 at 04:24 AM
MCP
templates/default/images/noavatar.png's Avatar
Junior Member
On the RMB user system. I would like this feature. But I don't know how to make it. Could someone help me?
Posted on Friday 8th June 2007 at 05:11 AM
SkillMaster
templates/default/images/noavatar.png's Avatar
Senior Member
What features would it need?
Posted on Friday 8th June 2007 at 06:53 AM
MCP
templates/default/images/noavatar.png's Avatar
Junior Member
It would look like so:

Title
Body

That is it. On the viewing of the person's profile it shows either their latest blog or a link to it. Or a link saying "View my Blog" or something along those lines.
Posted on Friday 8th June 2007 at 10:33 PM
SkillMaster
templates/default/images/noavatar.png's Avatar
Senior Member
ill whip one up now. k
Posted on Friday 8th June 2007 at 10:58 PM
SkillMaster
templates/default/images/noavatar.png's Avatar
Senior Member
members.php
Code

Blogs:<br>";
$fetch = mysql_query("SELECT * FROM `blog` WHERE `username` = '$user[username]'");
while($blog = mysql_fetch_array($fetch))
{
echo("- <a href='blog.php?title=$blog[title]'>$blog[title]</a><br>");
}
echo "

after
Code

Sex: $user[sex]<br>
Age: $user[age]

make a new file called blog.php
PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php 
session_start
();
include (
"config.php"); 
if (
$logged[username])
{
switch(
$_GET[page])
{
default:
$title = ("$_GET[title]");
$fetch mysql_query("SELECT * FROM `blog` WHERE `title` = '$title'");
$blog mysql_fetch_array($fetch);
if (
$logged[username] == $blog[username])
{
echo (
"<a href='?page=addblog'>Add blog</a>");
}
else
{
echo(
"<b>$blog[title]</b><br>$blog[message]");
}
break;

case 
'addblog'
echo (
"
<form method='POST' action='?page=insertblog'> 
<table width='100%'> 
<tr>
<td align='right' width='25%'>Title</td> 
<td align='left'> 
<input size='25' name='title'></td> 
</tr> 
<tr>
<td align='right' width='25%'>Message</td> 
<td align='left'> 
<textarea cols='30' rows='10' name='message'></textarea></td> 
</tr>
<tr> 
<td align='center'></td> 
<td align='left'> 
<input type='submit' name='submit' value='New Blog'></td> 
</tr> 
</table> 
</form>  
"
);
break;

case 
'insertblog':
$title htmlspecialchars($_POST[title]);
$message htmlspecialchars($_POST[message]);
$insert mysql_query("INSERT INTO `forum_category` (`name`, `message`, `username`) VALUES ('$category', '$message', '$logged[username]')");
echo (
"New Blog Created.");
break;
}
}
?>
Posted on Friday 8th June 2007 at 10:58 PM
SkillMaster
templates/default/images/noavatar.png's Avatar
Senior Member
Code

CREATE TABLE `blog` (
`id` int(10) NOT NULL auto_increment,
`title` varchar(225) NOT NULL default '',
`message` varchar(225) NOT NULL default '',
`username` varchar(225) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

thats the mysql code
Posted on Friday 8th June 2007 at 11:02 PM
SkillMaster
templates/default/images/noavatar.png's Avatar
Senior Member
Thats basic you can modify it make it better post as a tut if you like.
Posted on Saturday 9th June 2007 at 02:31 AM
MCP
templates/default/images/noavatar.png's Avatar
Junior Member
All I get with this is a blank page.

Below is my code.
PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php 
session_start
();
include (
"config.php"); 
if (
$logged[username])
{
switch(
$_GET[page])
{
default:
$title = ("$_GET[title]");
$fetch mysql_query("SELECT * FROM `blog` WHERE `title` = '$title'");
$blog mysql_fetch_array($fetch);
if (
$logged[username] == $blog[username])
{
echo (
"<a href='?page=addblog'>Add blog</a>");
}
else
{
echo(
"<b>$blog[title]</b><br>$blog[message]");
}
break;

case 
'addblog'
echo (
"
<form method='POST' action='?page=insertblog'> 
<table width='100%'> 
<tr>
  <td align='left' width='13%'>Title</td> 
  <td width='87%' align='left'><input size='25' name='title'></td> 
</tr> 
<tr>
  <td align='left' width='13%'>Body</td> 
  <td align='left'><textarea cols='30' rows='10' name='message'></textarea></td> 
</tr>
<tr>
  <td colspan='2'><left><input type='submit' name='submit' value='Post Blog'></left></td>
</tr>
</table></form> 
"
);
break;

case 
'insertblog':
$title htmlspecialchars($_POST[title]);
$message htmlspecialchars($_POST[message]);
$insert mysql_query("INSERT INTO `forum_category` (`name`, `message`, `username`) VALUES ('$category', '$message', '$logged[username]')");
echo (
"New Blog Created.");
break;
}
}
?>
Posted on Friday 22nd June 2007 at 10:03 AM
dtnet
templates/default/images/noavatar.png's Avatar
Active Member
Its the same for me
Posted on Friday 13th July 2007 at 03:12 AM
MCP
templates/default/images/noavatar.png's Avatar
Junior Member
Hey Skillmaster any way to get this working, please?