leiaah
Mar 15 2005, 02:07 PM
| | I've been planning to put up a blog on my site but I'm having trouble with how I should do it. I don't really know how blogs are made. Is it a database or a flat file? I know how to write to a file using PHP but I still don't know how to put the last entry on the top of the file. That's a big issue in the shoutbox I made for my site. If you look at it, the shouts keep appending at the end of the file and I want it to be on top.
Can anyone help me please? It would be nice if you'd give me detailed instructions on how to put it up, with files or with MySQL. |
Reply
bjrn
Mar 15 2005, 02:35 PM
If you want a blog, I suggest that you use one of the systems available from your cPanel. Or some other already existing system you can upload to your account. Building your own blogging system from scratch can of course be fun if you're into that sort of thing and want to do loads of things with PHP (and perhaps MySQL).
Reply
mobious
Mar 15 2005, 03:38 PM
if you will just store blogs, you can just use flat files but for other stuff that has a high overhead such as login sessions, you better use mysql. but if you start to experience stuff like no read or write permission be of high overhead thats\'s the time you switch to mysql.
Reply
bjrn
Mar 15 2005, 04:47 PM
MovableType is pretty neat in the way it builds static pages from your database. So when you post a new entry it builds a static index.html file, which doesn't need to get loads of things from your database.
Reply
Mike
Mar 16 2005, 09:36 PM
Hmm.. You could always use one of the blog things in the cPanel but if you want to make one from scratch, I could help you. I made one from scratch for my site. CODE <?php
mysql_connect('localhost,'DBUSER','DBPASS'); mysql_select_db('DBNAME');
?> <html> <head> <title>My Blog</title> </head> <body bgcolor="#999999"> <font color="black"> <body> <table border=".01"> <tr bgcolor="#373737"> <td align="center" colspan="10"><b><i>RETURN TO:</i> [LINKS TO OTHER PLACES</b></td> </tr> <form action="<?=$_SERVER['PHP_SELF']?>" method="POST"> <tr bgcolor="black"> <td> <b><font color="white">Entry Title:</font></b> </td> <td> <input type="text" name="blog_title" /> </td> </tr> <tr bgcolor="white"> <td> <b>Entry Date:</b> </td> <td> <input type="text" name="blog_date" /> </td> </tr> <tr bgcolor="black"> <td> <b><font color="white">Current Mood:</font></b></td> </td> <td> <input type="text" name="blog_mood" /> </td> </tr. <tr bgcolor="white"> <td> <b>Blog Entry:</b> </td> <td> <textarea name="blog" rows="15" cols="30"></textarea> </td> </tr> <tr bgcolor="black"> <td> <input type="submit" name="new_entry" value="Submit Entry!" /> </td> <td> <input type="reset" value="Reset" /> </td> </tr> </form> </table> <?php
if(isset($_POST['new_entry'])) {
mysql_query("INSERT INTO blog SET title='{$_POST['blog_title']}',date='{$_POST['blog_date']}',mood='{$_POST['blog_mood']}',entry='{$_POST['blog']}'") or die(mysql_error());
echo '<tr bgcolor="red" colspan="10"><td><b><font color="blue">Entry submitted.</font></b></td></tr>';
} else {
echo '';
}
?> </body> </font> </font> </html>
SAVE THAT FILE AS blog.php
--MySQL--
CREATE TABLE `blog` ( `id` int(10) NOT NULL auto_increment, `title` varchar(255) NOT NULL default '', `date` varchar(255) NOT NULL default '', `mood` varchar(255) NOT NULL default '', `entry` text NOT NULL default '', PRIMARY KEY(`id`) ) TYPE=MyISAM;
TO POST THE BLOG ENTRIES ON YOUR SITE
<?php
mysql_connect('localhost','DBUSER','DBPASS'); mysql_select_db('DBNAME');
$query=mysql_query("SELECT title,date,mood,entry FROM blog ORDER BY id DESC"); while($row=mysql_fetch_row($query)) echo '<table border=".01" align="center"><tr><td><b><big>'.$row[0].'</big></b></td></tr><tr><td><b>Mood:</b> '.$row[2].'</td></tr><tr><td>'.$row[3].'</td></tr><tr><td>---------------<br /><small><b>Posted On:</b> '.$row[1].'</small></td></tr></table>';
?>
^^PUT THAT ON THE PAGE YOU WANT THE ENTRIES TO SHOW UP ON
You should edit the bgcolors/colors because I made that in case your site did not run on a CSS. if it did, include this under <head> <link rel="stylesheet" type="text" href="STYLESHEETNAME.css" /> then edit the tables and <font color>s and <body bgcolor> and <tr bgcolor> tags.
Reply
haron
Mar 17 2005, 01:39 PM
I work on one project and my aplication (Web PHP aplication) must work with txt files, because MySQL is not safe (losing and changing data). It's interesant, all forum is based on MySQL. If you want make blog from scratch, don't. Download any blog, and edit.
Reply
leiaah
Mar 17 2005, 02:30 PM
QUOTE(Mike @ Mar 17 2005, 05:36 AM) Hmm.. You could always use one of the blog things in the cPanel but if you want to make one from scratch, I could help you. I made one from scratch for my site. CODE <?php
mysql_connect('localhost,'DBUSER','DBPASS'); mysql_select_db('DBNAME');
?> <html> <head> <title>My Blog</title> </head> <body bgcolor="#999999"> <font color="black"> <body> <table border=".01"> <tr bgcolor="#373737"> <td align="center" colspan="10"><b><i>RETURN TO:</i> [LINKS TO OTHER PLACES</b></td> </tr> <form action="<?=$_SERVER['PHP_SELF']?>" method="POST"> <tr bgcolor="black"> <td> <b><font color="white">Entry Title:</font></b> </td> <td> <input type="text" name="blog_title" /> </td> </tr> <tr bgcolor="white"> <td> <b>Entry Date:</b> </td> <td> <input type="text" name="blog_date" /> </td> </tr> <tr bgcolor="black"> <td> <b><font color="white">Current Mood:</font></b></td> </td> <td> <input type="text" name="blog_mood" /> </td> </tr. <tr bgcolor="white"> <td> <b>Blog Entry:</b> </td> <td> <textarea name="blog" rows="15" cols="30"></textarea> </td> </tr> <tr bgcolor="black"> <td> <input type="submit" name="new_entry" value="Submit Entry!" /> </td> <td> <input type="reset" value="Reset" /> </td> </tr> </form> </table> <?php
if(isset($_POST['new_entry'])) {
mysql_query("INSERT INTO blog SET title='{$_POST['blog_title']}',date='{$_POST['blog_date']}',mood='{$_POST['blog_mood']}',entry='{$_POST['blog']}'") or die(mysql_error());
echo '<tr bgcolor="red" colspan="10"><td><b><font color="blue">Entry submitted.</font></b></td></tr>';
} else {
echo '';
}
?> </body> </font> </font> </html> SAVE THAT FILE AS blog.php
--MySQL--
CREATE TABLE `blog` ( `id` int(10) NOT NULL auto_increment, `title` varchar(255) NOT NULL default '', `date` varchar(255) NOT NULL default '', `mood` varchar(255) NOT NULL default '', `entry` text NOT NULL default '', PRIMARY KEY(`id`) ) TYPE=MyISAM; TO POST THE BLOG ENTRIES ON YOUR SITE <?php
mysql_connect('localhost','DBUSER','DBPASS'); mysql_select_db('DBNAME');
$query=mysql_query("SELECT title,date,mood,entry FROM blog ORDER BY id DESC"); while($row=mysql_fetch_row($query)) echo '<table border=".01" align="center"><tr><td><b><big>'.$row[0].'</big></b></td></tr><tr><td><b>Mood:</b> '.$row[2].'</td></tr><tr><td>'.$row[3].'</td></tr><tr><td>---------------<br /><small><b>Posted On:</b> '.$row[1].'</small></td></tr></table>';
?> ^^PUT THAT ON THE PAGE YOU WANT THE ENTRIES TO SHOW UP ON
You should edit the bgcolors/colors because I made that in case your site did not run on a CSS. if it did, include this under <head> <link rel="stylesheet" type="text" href="STYLESHEETNAME.css" /> then edit the tables and <font color>s and <body bgcolor> and <tr bgcolor> tags. Thanks Mike! I'll try out the code! I figured I can make archives with these.
Reply
OwrLam
Mar 17 2005, 04:38 PM
I think better on file. My page stand on my script and works at 100 %
Reply
Mike
Mar 23 2005, 01:22 AM
Dude, chill out. I think it would be better to use my code since it's easier to understand (most likely) than your file is. I have a file as well. Two actually, one is the actual blog; the other is view_blog.php . It switches to view_blog.php?user=USERIDOFUSER . So each user on my site gets their own blog.  Wait, where can I download your file though.. I want to check it out. I'll give you feedback. BTW- Did my code work?
Reply
mobious
Mar 24 2005, 01:18 AM
well just a thought... why don't you guys make use of template systems? so that your code will be easy to understand because it get rid of all tags in the script. it's also much efficient.
Reply
Similar Topics
Keywords : blog, php, files, mysql
- Audio Files?
(3)
Jar Executable Files
(1) I have been supplied with a digital log book for use this semester and it comes in the form of a
.jar file and a .mdb file. I tried running it on my mac but it crashes every time but it seems to
run perfectly on windows xp. Does anyone have any ideas why? I thought .jar files would be
computable on any platform. ....
Best Way To Transfer Files
I just bought a laptop (6) Hi there guys, I just bought a brand new Dell Inspiron laptop for $729.99. It has a
processing speed of 2.0ghz, 3GB RAM, and a 250gb hard drive. I'm really satisfied, especially
with the wireless internet and the fact that I can carry my computer around with me, allowing you to
use your computer in comfortable spots -- outside in the shade, on the train, or even in your bed
where I'm using it write now as I type. If you didn't already guess, this is my first
laptop. But I do have some issues. Does anyone happen to know an easy way to transfer some ....
1350 Great Free Logos (jpg + Psd)
With both jpg and original psd files to edit (7) 1350 Great Free Logos (With both jpg and psd files)
http://rapidshare.com/files/126291346/1346...Great.Logos.zip This is a great collection of
logos, they are already made logos which you can use like that or just use to create other logos, do
what you want, they are free, they came from free websites that give this logos for free and lot
more, but i just took the good ones mainly. There is also a small collection of 100 logos inside
the compressed file, which you can use to insert those graphics in your logo/design/web design
projects, do what you want with them ....
Why We Blog
Why we blog (12) I was scanning the net the other night and have noticed that so many of us, that have a website also
have blogs. Somethings that I saw there are very nice and yet others I found to be in bad taste. I
know when I was growing up somethings was meant to be private. Now we post everything and anything
in our little blogs. Myself encluded I have a weather blog. Was wondering how many of you also have
one and what its about?....
Website/blog Layout (circle Design)
(2) Opinions? Took me a while, don't look at the design in the middle the abstract that is there
just because i needed to put something there for a example. Judge the website layout it self. And
if anyone wants to purchase this i'm open to offers.....
Please Can You Review My Blog
List of recommended sites for making money online (3) I am currently in the process of constructing a list of the best sites through which to make money
online and would like people to take a look at the sites I have added so far. I am obviously still a
long way of completing it but just wondering whether people think it is a good site / idea
http://makeeasymoney247.blogspot.com Also if you have not yet signed up to ClixSense I would
highly recommend it. You can join for free but you are better of paying the small $10 yearly
membership fee as this will bring you a ton more paid adverts - more than any other site I ....
How Do I Find My Mysql Password? [resolved]
Cannot access my MySQL (5) After all the recent problems, my account has been restored. I have setup my parked domain agin, and
that works fine. However, I can no longer access my MySQL databases (I can from PHPMyAdmin, but
that's all). I had to create a new user for my databases, and created the user with exactly the
same username and password I had before, but some of my web pages do not let me access the pages I
have associated with my databases. Where could i find out what my DB password is? (Although I am as
good as sure I am using the right one). I have tried my old password, the new c....
Please Explain Me Mysql
How do i insert information into this config: (4) Hi, I wanted to try just to test how can i connect my website to another mysql server, but i have no
idea how to insert the other mysql information such as port and host etc.... so here is the config
file please give me an example CODE <?php // mySQL information $server =
'FRESHSQL.COM:3306'; // MySql server $username =
'vasilevich'; // MySql Username $password =
'*******'; // MySql Password $database =
'vasilevich'; // MySql Da....
Make Money Online Blog
(1) Hi, I need people to help me to review or give comments about my blog: bloggingdotprofits.com
One area lacking is content, how about other factors? Thanks in advance. /smile.gif"
style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />....
Remote Access Mysql
(8) Is it possible to directly access my local database from my website? For example, if somebody
submits info on my website, the info they submitted would be transferred to my local database
directly. Is that possible? And if so, how do I set that up? The reason I don't want to upload
my database to my subdomain is because it would be difficult to keep the website database and my
local database in sync . . . or is there a way to do that? Thanks for any replies.....
Debug Exe Files
How to debug an exe file. (4) Think that we have written a program, and some codes are wrong. We can go back to compiler and
change the code, and compile again. But I will show you how to correct our mistakes without using
the compiler. Let's start: I have written a program in Delphi. Let's see my mistake. I
have created a form like this. After this I wrote the codes in the Compare Button click as
below. CODE 1. procedure TForm1.ComparebuttonClick(Sender: TObject); 2. var
3. a,b:integer; 4. begin 5. a := StrToInt(EditA.Text); 6. b :....
Html Form!
Using MySQL?! (4) Hey, I need your help again! I need some good working tutorial how I can update my SQL through
HTML form. I did use some tutorials online found with the help of google; but they do not work
properly; I mean there are still small mistakes. I need to have a good tutorial to follow. It
should be based on security and more things. It has to be done in proper way.......
Converting Audio Files In Vista
how do you do it? (7) Ok, so I have some .wav files that I'd like converted into .mp3. I knew how to do it in XP, but
I can't find windows audio converter in Vista....does vista even have that, or is it under a new
name? Also, is it possible to convert video files, like .flv into .avi?....
Mysql-essential-5.0.51 Installion Problem
please help me.(urgent) (2) Dear friend, please help me. Iam working on php project (matchmaking site). I have downloaded mysql
essensial 5.0.51. When i was installing mysql 5.0.51, i got following error - Error 1901: Error
attempting to read from the source installation database:
c:\windows\installer\527ec6.msi What is solution of this problem ? Iam using
windows xp professional version 2002 (service pack 2). Please post your reply. Iam waiting for your
answer. ....
Database With Mysql++
getting mySQL++ to work with trap17 (7) Hi, I'm trying to build an online game and figured the easiest way to do the server list would
be to make a mySQL database for it; however, I use the con() command on the IP i get from pinging my
website and I always get an abnormal program termination; however, it will work with the mySQL on my
own machine. The code is below: CODE #include <iostream> #include <iomanip>
#include <mysql++> #include "pass.h"//holds my password (i program at
school) int main(void) { Connection con("t3jem3_test","....
Mysql Won't Update
(4) Ok, so I'm making some arcade administration software so I don't have to add games the hard
way, well anyway, one of the features I have is that on the homepage is a featured author and as
such I just have it so it updates one line in the mySQL. Well, the page with the form passes on the
varibles fine and the updating page recieves them because I echoed everything, then I build the
query and I even echo the query and it comes out exactly how I want it to, but for some reason, the
database itself won't update even though all the varibles are there. Here's....
How To Disable "show Hidden Files And Folders" In Folder Option
(11) How to disable "Show hidden files and folders" in Folder Option As you know, you can hide files
or folders in Microsoft Windows ( to hide a file or folder , right click on file or folder >select
properties and then select Hide file) But if you open Folder Option and check "Show hidden files
and folders " you can see hidden files. to disable "Show hidden files and folders" feature follow
below steps : 1- Click start > Run > type regedit to run Windows Registry Editor. 2- Go to following
address: QUOTE HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/Current Versio....
Blog Money
Discover the hidden money potential of your Blog (13) Hi Friends, Here is a dedicated site for online money making http://magicomedy.blogspot.com/
Please vivit and coment sherif www.sherifmayika.com....
Qupis : Free Hosting With Php, Mysql, Cpanel. (one Line Text Ad At Bottom)
a member of Xisto (41) Hello Members, We are proud to introduce a new member to Xisto group of sites.
Qupis : Free Web Hosting 150 MB space, 5000 MB Bandwidth, php,
mysql, CPanel (Latest). Emails, FTP, Addon domains, Parked Domains etc.
http://www.Qupis.com
Feel free to add your reviews and comments about it. -Trap17
Management ....
Informix To Sql Server (or How To Open .unl Files)
how to import .unl files into SQL Server 2000 without Informix softwar (2) Does anyone know how to import .unl files into SQLServer 2000? My boss gave me this task to migrate
an old database into SQLServer. I don't have informix installed since the files were sent to me
via email. All files have .unl extension and I don't have a clue how to view them. I've
tried opening them using excel but it can't be read. Does anyone know how to do this? Or at
least know how to open/view the file using excel or any other program that could be easily migrated
to sqlserver? Please, I need to migrate the files as soon as possible. Thanks....
Strange .log Files On My Desktop
(10) Since this morning, two new visitors has camped out on my desktop. One is lcapi0.log , & when you
open it you get: QUOTE 19:50:36.703 F20:F24 WARN :: module=lcapi flavor=fre
version=1.7.226.0 (RTC Version 4.3.5371.0) 19:50:38.109 F20:F24 INFO :: Initialize(0) 19:50:38.609
F20:F24 INFO :: MUI not Enabled 19:50:44.625 F20:F24 INFO :: SetDeviceDisabled 0->0 19:50:44.656
F20:F24 INFO :: SetDeviceDisabled 0->1 19:50:44.656 F20:F24 TRACE :: SetDevice 00000000->00000000
19:50:44.656 F20:F24 INFO :: SetDeviceDisabled 0->0 19:50:44.656 F20:F24 TRACE :: SetDevic....
Is It Possible To Access The Mysql Remotely?
(10) I like to experiment with a lot of things and I was thinking of making a sort of instant messenger
in Python, but I want to let people have actual accounts so I need to be able to access the mySQL
remotely. If that's not possible, are we allowed to run Python scripts on the server?....
Check Referrer To Prevent Linking Yours From Other Sites
Check referrer with Php and Mysql (8) Check Referrer Using Php To Prevent People Linking To Your Downloads From Other Sites Ever
find that found some people are listing items, images and tuts and linking directly to the download
url (those that are like my photoshop tutorial.php?id=0), which is a .php to count the number of
downloads. To prevent this, you can add a piece of code to the download pages that checks which page
referred them to the download page: if it's my domain, it downloads the file normally, if
it's not, it will redirect to my home page instead. Important : Not all browser....
Linux Question: Amarok And File Permissions
please help, i can't get it to work with all music files (4) hey, i use to use Linux DC++ to download music from some hubs and i usually download it to
/home/downloads/ and then i move the files to my collection on another HDD a sata one, on
sda3/music/ but when i move the files using krushader root mode they become posessed by root and
amarok can't play them displaying a locker on the file's icon. I tried to " chmod 774 music
", where music is my music directory, as root in konsole but no luck. What should i do to make a
whole directory accessible from amarok as user?....
Mysql Database Size
related to the free database space (6) hi all! this is my first post /biggrin.gif' border='0' style='vertical-align:middle'
alt='biggrin.gif' /> and i have a doubt, how much mysql space i am allowed to use... i mean how
much is available for my free account....
Import From Excel File Into Mysql Database
(7) Has anyone tried using the excel import function that comes with phpmyadmin
http://www.phpmyadmin.net/home_page/ - it does not require any additional plug-ins or scripts and
is fairly straightforward to use. In phpmyadmin, if you click on the database table which you wish
to import the data to , there is a link on the bottom left corner which says "insert data from a
text file into the table" - although it says text file it still can be used to import an excel file.
When you click on this link you will be taken to a page where you will be asked for the file name
(the....
Does Anyone Know How To Make Exe Files
(17) Does anyone know any software for making exe files, I want to make simple programs not propper
one's. Thanks.....
Complete Login System
With PHP + MYSQL (56) Its an complete login sistem made and tested by me and I think itwill be very usefull for people who
are tryn to learn PHP. First, let's make register.php: CODE <?
include("conn.php"); // create a file with all the database connections
if($do_register){ // if the submit button were clicked if((!$name)
|| (!$email) || (!$age) || (!$login) ||
(!$password) || (!$password2)){ print "You can't let
any fields in blank....
Converting Video Files From One Format To Another
help plz :) (6) hey i have learnt this nice way to open mov files in imageready and insert them in sigs,graphics and
other stuff its really cool,this only works with .mov files and i really need to know if sumone here
can do that,i need to change a wmv file into a .mov file so i cant add the movie to a sig,i have
tried many video format conversion programs but they dont accept the mov format,the mov format is a
quicktime video format,so anyone here know how to change a video file into a quicktime mov video
format? thnx in advance....
Looking for blog, php, files, mysql
|
|
Searching Video's for blog, php, files, mysql
|
advertisement
|
|