Dark_Archon Posted January 13, 2008 Share Posted January 13, 2008 hellllo. im new to PHP. Ive been wanting to learn for a while and have finally decided to get going. someone i know who knows PHP very well, gave me some "homework" to do. I have to make a Instant message type of thing, that has a textarea to enter a message, and when submitted, shows up with a list of the other messages. theres also a username input. from my knowledge, its an easy database/php project. and i was just wondering if anyone would like to help me out, because its really hard to know what to look for when searching google, and it'd be cool to get someone to help me a bit. thanks allot. if you have AIM, MSN, or Yahoo, that'd be nice. thanks Quote Link to comment Share on other sites More sharing options...
twostars Posted January 13, 2008 Share Posted January 13, 2008 hellllo. im new to PHP. Ive been wanting to learn for a while and have finally decided to get going. someone i know who knows PHP very well, gave me some "homework" to do. I have to make a Instant message type of thing, that has a textarea to enter a message, and when submitted, shows up with a list of the other messages. theres also a username input. from my knowledge, its an easy database/php project. and i was just wondering if anyone would like to help me out, because its really hard to know what to look for when searching google, and it'd be cool to get someone to help me a bit. thanks allot. if you have AIM, MSN, or Yahoo, that'd be nice. thanks 1. Why can't you ask them for support? 2. You'll need: - a mySQL database (preferred) - a table to hold: -- message id [optional but preferred] -- author name -- message -- time [optional but preferred] - part of script to display output - part of script to handle database INSERTs. That is, the message going INTO the database. Its a very simple script overall, and I won't help you with full coding but with any usage snippets as you require. Good luck. Quote Link to comment Share on other sites More sharing options...
Dark_Archon Posted January 13, 2008 Author Share Posted January 13, 2008 i have mysql, and i have phpmyadmin. im using linux. just to let you know. :] but i already know i need to somehow get the message from the textbox to submit to the mysql database and pull the message from there to show up in another div box on the page or something. so pretty much the same look as your basic instant messenger screen. but there wont be loggin names, just a username to use when you type. but i kinda need someone to help me. because its not simple to understand everything just by looking at it. i know its super simple, so like i just would like an outline of some codes to use. Quote Link to comment Share on other sites More sharing options...
twostars Posted January 13, 2008 Share Posted January 13, 2008 i have mysql, and i have phpmyadmin. im using linux. just to let you know. :] but i already know i need to somehow get the message from the textbox to submit to the mysql database and pull the message from there to show up in another div box on the page or something. so pretty much the same look as your basic instant messenger screen. but there wont be loggin names, just a username to use when you type. but i kinda need someone to help me. because its not simple to understand everything just by looking at it. i know its super simple, so like i just would like an outline of some codes to use. Okay then, in pseudocode: Script to get all 'posts': <html> <head> <title>Title that won't be shown but good to have anyway</title> <meta http-equiv="refresh" content="5"> </head> <body> <?php mysql_connect("host", "user", "password"); @mysql_select_db("your database name"); $query = "SELECT all data from messages table"; $result = mysql_query($query); echo "The table, and the header row+columns"; while ($row = resulting row in array form) { echo "the row, and columns with data from the database in them"; } ?> </body> </html> Main script: <?php if (you have sent a POST variable, IE: the username and message fields in a HTML form) { mysql_connect("host", "user", "password"); @mysql_select_db("your database name"); $username = -check for anything that could be used for SQL injection or mess with the page-; $message = -check for anything that could be used for SQL injection or mess with the page-; $time = -get current time-; $query = "INSERT the username, password and time into your messages table"; mysql_query($query); } ?> <html> <head> <title>Your page title</title> </head> <body> <iframe src='./otherscript.php' width='100%' height='90%' /> <br /> form here to insert author and message with </body> </html> I think that just about concludes a basic layout of it. I've done more than I said I would, and given you some hints (using some keywords in there to Google with), but the rest is up to you. If you need help with something in particular, let us know. Quote Link to comment Share on other sites More sharing options...
Dark_Archon Posted January 13, 2008 Author Share Posted January 13, 2008 im not really sure where to put the 2 codes you gave me. do i put them both in the same text sheet?right now i have one text sheet, index.php. and when i go to http://localhost, it shows me all the php/html that i have in this index.php txt sheet. do i put both those codes in the same text document? Quote Link to comment Share on other sites More sharing options...
revraz Posted January 13, 2008 Share Posted January 13, 2008 And you can't get help from them why? someone i know who knows PHP very well, gave me some "homework" to do. Quote Link to comment Share on other sites More sharing options...
thomashw Posted January 13, 2008 Share Posted January 13, 2008 Maybe get a book on PHP. I found that it really helped me get going - as I had NO idea what to do at the beginning. Quote Link to comment Share on other sites More sharing options...
Dark_Archon Posted January 14, 2008 Author Share Posted January 14, 2008 And you can't get help from them why? well #1, hes on a trip. and #2, he wanted me to find all the information to do it on the web. like this forum. and google. obviously he could have just wrote all the script for me in 10 min. but does anyone know where i put those 2 codes hes talking about? Quote Link to comment Share on other sites More sharing options...
revraz Posted January 14, 2008 Share Posted January 14, 2008 That seems to be what we are doing for you. obviously he could have just wrote all the script for me in 10 min. Quote Link to comment Share on other sites More sharing options...
Dark_Archon Posted January 14, 2008 Author Share Posted January 14, 2008 yeah thats not what i want though. i want someone to kinda get me started. like aim msn or yahoo would be good. you know? so i can ask questions. Quote Link to comment Share on other sites More sharing options...
thomashw Posted January 14, 2008 Share Posted January 14, 2008 Like I said before, try buying a book written for using PHP and MySQL. One I use when I first started (which was VERY recently) was this one: http://www.amazon.com/Build-Database-Driven-Website-Using/dp/0975240218/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1200279896&sr=1-1 I read through the book almost completely. I then started trying things out, and went to the boards for help. I don't think we would be able to "help" you, or get you "started" without you having any basic knowledge. I think you need to do some tutorials, read a book, or something like that. For example - the code posted above. You'd know where it goes if you had a bit of background on the subject. Quote Link to comment Share on other sites More sharing options...
Lamez Posted January 14, 2008 Share Posted January 14, 2008 you could also take a look at: http://www.php-mysql-tutorial.com/php-mysql-select.php or http://www.phpmac.com/articles.php?view=239 and http://www.pantz.org/software/mysql/mysqlcommands.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.