Jump to content

Help with a project. :]


Dark_Archon

Recommended Posts

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

Link to comment
Share on other sites

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. :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. :)

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.