Feelay
Feb 16 2008, 10:34 PM
| | Hey! I just wanted to know, if I want to make a PM system, should I store the PMs in a database or how should I do it? And if I should store them in a database, how do I do that. Because I have acctually no idea, if I should create 50 tables to store 50 messages 
(And a little OT question[instead of creating a new topic]). How can i change the timestamp [time()] into real date? |
Reply
vujsa
Feb 17 2008, 03:30 AM
In short, yes! You would save PM's in the database... You create a table in your database with at least 4 columns (fields) then each message gets its own row (record). I suggest the following columns: message_id user_id_from user_id_to message_title message_contents message_date message_read The first is the id of the message which should be incremented in MySQL each message. (1,2,3,...) The second is the user id (username, id number, whatever) of the sender of the message. The third is the user id (username, id number, whatever) of the recipient of the message. The forth is the title of the message. The fifth is the actual contents of the message. (message body) Sixth is the date which the message was sent. Finally, seventh is a flag as to whether or not the message has been read. (Yes | No) OR (1 | 0) The system is actually very simple to code and I have confidence that you will be able to do it. I wouldn't try doing a filing system for PM's and when a user deletes a message, then remove it from the database. The new message alert would just be a database query to find any messages with the user's ID being the same as the user_id_to and that hasn't been marked as read. Now for your time issue... The PHP manual does a very good job of explaining how to use time and date functions. Here is the link: http://us.php.net/manual/en/function.date.phpOne thing to consider, if you are using a UNIX timestamp (seconds since 1/1/1970) then you enter that as the second argument of the data function like so: CODE echo date("F j, Y, g:i a", 3600); // January 1, 1970, 1:00 am Because, 3600 seconds is 1 hour from the Epoch (1/1/1970)! Likewise, this is what you would use for the date of January 5, 1970 at 2:34 pm: CODE echo date("F j, Y, g:i a", 484440); // January 5, 1970, 2:34 pm Because, 484440 seconds is 5 days 14 hours and 34 minutes from the Epoch! There are many formate examples on the page I linked to as well as a complete listing of every date code you can use with the date function. Hope this helps.  vujsa
Reply
Feelay
Feb 29 2008, 10:33 PM
Thanks alot Vujsa  ! Now I have made a version 0.1 PM script. I'll make a tutorial about it someday  And as you said, it was very easy to make the script  just took me 3 hours  Thanks again //Feelay
Reply
iGuest
May 12 2008, 02:16 PM
OK I AM A KID. BUT I OWN A SITE. BUT I KNOW ONLY HTML AND JAVA, NOT DATABASES. COULD ANYONE MAKE A TUTORIAL ON DATABASES? THE WORLD WILL LIKE IT.
How To Make A PM (Personal Message) System?
I own a site. But I use form systems for it. Presently, I am only 13 years old. Http://www.Schoolclub.Googlepages.Com By the way, I first designed my site on notepad with HTML, but forgot about publishing. Then I moved to GPC. Someone please teach me of databases. I would greatly appreciate it. By the way. The searches do not provide sufficient explanations on databases! Thank you! -reply by Thauwa
Reply
Mike gambino
Jul 25 2008, 04:18 AM
QUOTE(vujsa @ Feb 16 2008, 11:30 PM)  In short, yes! You would save PM's in the database... You create a table in your database with at least 4 columns (fields) then each message gets its own row (record). I suggest the following columns: message_id user_id_from user_id_to message_title message_contents message_date message_read The first is the id of the message which should be incremented in MySQL each message. (1,2,3,...) The second is the user id (username, id number, whatever) of the sender of the message. The third is the user id (username, id number, whatever) of the recipient of the message. The forth is the title of the message. The fifth is the actual contents of the message. (message body) Sixth is the date which the message was sent. Finally, seventh is a flag as to whether or not the message has been read. (Yes | No) OR (1 | 0) The system is actually very simple to code and I have confidence that you will be able to do it. I wouldn't try doing a filing system for PM's and when a user deletes a message, then remove it from the database. The new message alert would just be a database query to find any messages with the user's ID being the same as the user_id_to and that hasn't been marked as read. Now for your time issue... The PHP manual does a very good job of explaining how to use time and date functions. Here is the link: http://us.php.net/manual/en/function.date.phpOne thing to consider, if you are using a UNIX timestamp (seconds since 1/1/1970) then you enter that as the second argument of the data function like so: CODE echo date("F j, Y, g:i a", 3600); // January 1, 1970, 1:00 am Because, 3600 seconds is 1 hour from the Epoch (1/1/1970)! Likewise, this is what you would use for the date of January 5, 1970 at 2:34 pm: CODE echo date("F j, Y, g:i a", 484440); // January 5, 1970, 2:34 pm Because, 484440 seconds is 5 days 14 hours and 34 minutes from the Epoch! There are many formate examples on the page I linked to as well as a complete listing of every date code you can use with the date function. Hope this helps.  vujsa sign me up and create a template for me with login scripts.
Reply
Recent Queries:--
php personal messages - 13.70 hr back. (1)
-
schoolclub.googlepages.com - 13.50 hr back. (4)
-
personal message php - 0.43 hr back. (2)
-
how to make a website pm system - 37.19 hr back. (1)
-
how to make a message system - 38.21 hr back. (1)
-
pm personal message - 38.59 hr back. (1)
-
"private message" script simple "message.php" - 39.45 hr back. (1)
-
"how to" php messaging system - 54.34 hr back. (1)
-
mysql simple "private message system" script private messages send - 56.09 hr back. (1)
-
personal message code - 59.90 hr back. (1)
-
personal message game php code - 105.89 hr back. (1)
-
php mysql tutorial messagesystem - 137.40 hr back. (1)
-
personal message system php - 25.98 hr back. (2)
-
www pm personal - 163.56 hr back. (1)
Similar Topics
Keywords : make, pm, personal, message, system,
- Reading Xml Data
Within PHP (2)
Letting Users Add Mysql Data With Php
(1) I'm curious as to the best methods of letting users submit data to a MySQL database, displaying
that data, and removing any unwanted tags etc. from it. Currently, there's a handful of PHP
functions that I know of to help with this: mysql_real_escape_string() - perhaps the best known
and most commonly used function, it should be used in pretty much any MySQL query. It escapes
characters that have SQL significance. QUOTE(php.net) ...which prepends backslashes to the
following characters: \x00, \n, \r, \, ', " and \x1a I like....
How To Make A Value In The Database Raise Every Minute.
(50) Hi. I am trying to figure out how to make a value in the database raise every minute. Lets say, I
want the HP to raise every minute. The max HP is 100. I want it to raise 5 HP/ Hour. And the player
don't have to be online. Anyone who know how I can do it =? Thanks for any help. //Feelay....
Getting Certain Parts Of A Record
The character data (17) Ok I need help on this puzzling problem. At first I thought that this person stored the dates in the
MySQL database like this: August 27, 2007 That kinda freaked me out a little, because string dates
are hard to manipulate. Then I found out that he stored both th string data and numerical date,
which I found a little bit odd, but it was like this: 2007-08-27 I need to build a PHP program to
manipulate the data, but I need to access the year, month and day respectively by themselves. I
think that isolating the first 4 characters for the year, last 2 characters for da....
Five Common Php Database Problems
(0) I just read this excelent article from the IBM's developerWorks website, it's name is Five
common PHP database problems . This article shows five database problems that occur in PHP
applications as well as their solutions and include database schema design, database access, and the
business logic code that uses the database. It is a bit older -a year ago more or less- but i
think that can be helpful for everybody that works with PHP and MySql. Best regards,....
Sql Injection Prevention (passing Numerical Data Across Pages).
PHP/mySQL (9) Even if your building something as simple as a basic news page for your website, if your passing
along url variable strings like (mysite/index.php?page=1), you may be vulnerable to SQL injection
attacks. For cases like these (passing numerical data in url strings), I have a handy dandy little
function to thwart these attempts silly: CODE // For checking if value is a number, if not
return 1. function isNum($val) { if (!is_numeric($val)) {
$val = 1; } return ($val); } I have this function, within my ....
Retrieving Data And Displaying In Boxes
How do I make a grid of boxes? (6) I have successfully setup a MySQL Database with a few tables in it to store user input!
/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> /biggrin.gif"
style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> Woohoo! Now the
problem is displaying the data. I want 4 boxes echoing across with 3 rows down so that makes 12
boxes (12 of the most recent records). I have no clue how to do this because I cannot use the
W3Schools example of echoing into a table. Here is the code I used but it echoes the same
information a....
Proper Way To Grab User Data?
(1) I'm working on a script where there is a custom user profile and I was wondering if there was a
more efficient way to grab data stored in a database than this method: CODE $sql =
"SELECT * FROM users WHERE `access_name` = \"" .$active_user.
"\""; $row = mysql_fetch_array(mysql_query($sql)); //Link
the two tables together; grab the most common thing that is the *SAME* $user_id =
$row['id']; $sql2 = "SELECT * FROM content WHERE `cid` =
\....
How To Show Serial Nums In PHP Table For Contents Of MySQL DB
Serial Numbering for output contents of mysql in php table (4) Hello there, I'm looking for some education. How would you show the serial numbering for
outputted contents of mysql database. I used a table created in PHP to output content (i.e. an
alumni database) and I created a column for S/N, so that at a glance anyone can tell how many
members have registered. Thanks house. Neyoo....
Send XML Data To PHP Page
(0) Hi, i'm trying to send my xml file "xmlDoc" to a php page so I can save it. Does anyone have the
code for this?....
Data Passing - Re An Assignment For School - Please Help :)
(8) I'm working on a small assignment due tomorrow and am having some trouble. I have a functioning
form that you input the data on one php page, and then it does a little math and displays the result
on a new page. The assignment is to make this work on ONE page, and to add some error handling.
I'm having trouble with the basics of passing the data that has been input on the form, back to
itself. I am stuck with a few questions but I'll start with one. I have the data passing back
to itself so that when I start the error checking, the fields won't have ....
Need An Alternative To $http_post_data For PHP4
(5) Hi, my client's host site currently hosts just 4.0. I tried using the
file_get_contents("php://input") and $HTTML_post_data php file to save the XML file from Flash
but when loaded, it returns nothing. I need hlep....
Storing Data Into Xml With A Php Form
Need Help! (2) Hi, I just learned how to read an xml file with PHP. The problem now is that I don't know how to
write onto it. I would like to read my news content and be able to add more to it when another story
comes up but I don't know how to write into the xml via PHP. All I know how to do is to edit the
XML file itself manually. Can anyone help me?....
Need Help With 2-Way Password Encryption
How to properly store passwords in a database (8) Every article I've read on the internet so far suggests using MD5 or SHA1 to "encrypt" passwords
in a database, but MD5 and SHA1 are hashing functions; they only go one way. So then how do I let
users know what their password is if they forget it? I suppose I need a two-way encryption method,
right? Can somebody please tell me what the easiest way to solve my problem is with PHP and MySQL?
Thanks, Trevor....
What Database Do You Use With PHP
Regarding PHP supported database format (5) There are different database backends supported by PHP. However, most of us probably use MySQL and
the books on PHP mostly use MySQL as the backend database. These are the currently supported
database format: 1. dBase 2. FrontBase (functional since DB 1.7.0) 3. InterBase (functional since
DB 1.7.0) 4. Informix 5. Mini SQL (functional since DB 1.7.0)6. Microsoft SQL Server (NOT for
Sybase. Compile PHP --with-mssql) 6. MySQL (for MySQL 7. MySQL (for MySQL >= 4.1) (requires PHP 5)
(since DB 1.6.3) 8.Oracle 7/8/9 9. ODBC (Open Database Connectivity) 10. PostgreSQL 11. SQL....
Reading Data From Sessions
(2) Hello everyone! Before I start let me just say that ive read many threads on here about php and
sessions, several tutorials and the php manual but I still cant find a solution to my problem. My
problem is that when i try to read data from a session it just comes up blank, and an if statement
to see if the variable is null returns true. The code im using is for a login script which checks
the input from a user and compares it with the data in a database to log the user in, this works
fine, also reading the data from the session works perfectly on the page which the ....
[php] Index.php?section=xx&pag=yy
No MySQL or any other database (6) Hi everybody. This is my 3rd script, but this dont use MySQL It does this: divide the site in
SECTIONS and PAGES. Benefits: -You have to create just the text of your pages, no create ech page
with the entire layout again. -If its just the text that is included, you just have to have one page
with the layout, witch is the INDEX.PHP. -If you chanche the layout in the index.php, you DONT HAVE
TO change in the other pages. Here is the code: CODE <?php
//-----------------------------------------// //ACAF Paginação //
//by Alexandre Cis....
[PHP + MySQL] Encrypting Data
To protect the password of your DB, for example. (11) Hi! This is my 2nd code of PHP + MySQL. This code is VERY simple: it encript the data in the
MySQL DB. Here we go! ------------------------------------------------------------------------
CODE <?php $password = "abc"; $new_password = md5($password);
echo $new_password; ?> The password "abc" was codfied using md5() This will be:
900150983cd24fb0d6963f7d28e17f72 CODE <?php $normal_pass = "abc";
$encripted_pass = "900150983cd24fb0d6963f7d28e17f72"; if(md5($norm....
Coding A Private Message System
would like assistance (4) I am (trying) to code a private message system for my one website (the one I pay big bucks in... ok,
not big bucks, but a chunk of income). As being the first major script that I've ever coded, I
would like some assistance on the side. I've never tried anything such as this and the fact that
this is revolving around the core of my member's system (if I would have installed some
pre-built script, I could have easily intergraded my member's area) makes it a bit difficult as
it has to work off of my already existing database and user's table. I really....
Need Help With A PHP - MySQL Registration Script
Wont INSERT into the database (13) hey well can some one helpme make this code work it won't INSERT INTO THE DATABSE CODE
<?php # register1.php # common include file to MySQL include("DB.PHP");
$Username=$_POST['Username'];
$Password=$_POST['Password'];
$Name=$_POST['Name']; $Last=$_POST['Last'];
$Sex=$_POST['Sex']; $Month=$_POST['Month'];
$Day=$_POST['Day']; $Year=$_POST['Year&....
Possible To Do?
Reading a remote website's data .. (7) What I need to know is how to do the following? I'm completely confused, although I sort of
have a general feel of what I need to do, I just have no clue how to do it. I need to be able to
take some data from one page, displayed on their site as an HTML table, and then output certain
pieces of it to my site. I will disclaim here and now that what I intend to do does not violate
any laws, as I'm not stealing a persons content. I am using this to act as an online counter, to
see how long someone is online. I also have emailed the company to ask if what I'm....
Php/mysql Data Display
(3) Okay .. got a bit of a question here, so I'll do some explaining. I was asked to do a site for
an online roleplaying game, specifically, a "blackbook" site. I accepted and began my quest for
knowledge of PHP. I've gotten quite "far" to the point that I can now take a user inputted
search value and query the database with that value, and then display the values in a table. My
MySQL table setup is as below: CODE |Name|Reports|Type1|Type2|Quote|Confirmed| When queried
it displays the following: CODE Violator Name: ['Name'] # Repor....
Help With Multi Tier Mysql Application Over Net
receiving data connection from client (6) hi.. i want to make a connection from my desktop client into mysql database at web server.
currently i think it can be provided by PHP. 1. i'm thinking like this: CLIENT -> PHP + MYSQL
CLIENT {sent file} -> PHP {receive file, open connection to MYSQL, insert data from file} how it
will be done ??? 2. the security do you know how to secure it ? thanks......
Displaying Data From Mysql?
(2) how can i display data from mysql with php, just that on one page i want to display only the first
10 things and the next page the next 20 ...etc.. how can i do that? ....
In Php, How To Not Display Mysql Connection Error?
Don't want mysql_connect() message (4) In PHP, if the mysql database server cannot be connected, for example database server is handed or
turned off, an error message will be displayed: Warning: mysql_connect(): Unknown MySQL Server Host
"mysql.example.com" ... My question is how to not display this warning message? or can I customise
the error message? if so, how? Thank you.....
Php Problem Error Message
I'm working from a book (9) I get this error message when I try to view a small webpage. QUOTE Parse error: parse error,
unexpected T_STRING, expecting ',' or ';' in
/home/nilsc/public_html/bobs/processorder.php on line 27 Line 27 is in this php part: CODE
<?php echo '<p>Order processed.</p>'; echo $tireqty. '
tires<br />'; echo $oilqty. ' bottles of oil<br />'; echo
$sparkqty. ' spark plugs<br />'; $totalqty = 0; $totalqty =
$tireqty + $oilqty + $sp....
Php, Sql Lite: Storing Session's Data?
how so store session in SQLITE? (1) normally, in windows, session data is saved in the location as directed by the "session.save_path"
directives. they only show how to store session data in file. is it possible to store it inside the
SQLite? anyone?....
How Do I Connect Php To A Database ?
(3) How I can to connet to DB in PHP?....
script to send SMS message
(6) On my webiste (once I get hosted), I'd like to give users capability to SMS me. But the problem
is that, I don't know how to do it. So what I'm looking for is some script to send SMS
messages over the web. Any scripting language that astahost supports would do. Thanks in advance....
Looking for make, pm, personal, message, system,
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for make, pm, personal, message, system,
|
advertisement
|
|