Jump to content


Photo

Need suggestions please


  • Please log in to reply
3 replies to this topic

#1 Franchise

Franchise
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 15 July 2006 - 03:12 AM

Hey guys,

I am looking for a simple, script that I am not sure what it would be called. I need a script that would allow users to leave a message, sort of like a shout. That messagewould then be put in order to form a sentence.

Sort of like this

1st persons shout is Hi, 2nd is My, 3rd is Name.. etc..

and at the bottom of the page 'Hi My Name' appears. Anyone know what script would be able to do this?

#2 pixy

pixy
  • Members
  • PipPipPip
  • Advanced Member
  • 295 posts

Posted 15 July 2006 - 05:52 PM

Do you mean like where people are adding sentances to one single message that appears on the bottom...

I can make one really easy, if that's what you're talking about. Do you have a database this can be stored in?

This is a .44 Caliber Loveletter straight through my heart.

Tabulas + Threadless + Hire Me!


#3 Franchise

Franchise
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 16 July 2006 - 01:05 AM

Do you mean like where people are adding sentances to one single message that appears on the bottom...

I can make one really easy, if that's what you're talking about. Do you have a database this can be stored in?


I mean like a word association kind of game, where everyone who comes to the site can add a word, and only 1 word. After they enter the word it then appears at the bottom of the page but in sentence form. Sort of like this if you can see it

http://www.thecomput...thread.php?t=16



#4 pixy

pixy
  • Members
  • PipPipPip
  • Advanced Member
  • 295 posts

Posted 16 July 2006 - 10:52 PM

If you have a database, this is essentially what you'd do.

Asumming you access the "associations" through stories.php?id=123 where 123 is the "association" being worked on.

<?php
// Connect to database
if (isset($_GET['id'])) {
    if (!is_numeric($_GET['id'])) {
        die('you stupid hacker');
    }
    else {
        $id = $_GET['id'];
    }
}
$query = "SELECT story FROM stories WHERE story_id='$id'";
$result = mysql_query($query);
$row = myqsl_fetch_array($result, MYSQL_NUM);
$story = $row[0];

if (isset($_POST['story'])) {
    if (empty($_POST['word'])) {
        die('you did not enter a word');
    }
    else {
        $word = $_POST['word'];
        $storyid = $_POST['story'];
        $newstory = ' '.$word;
        $query = "UPDATE stories SET story='$newstory' WHERE story_id='$story_id'";
        $result = mysql_query($query);
        if ($result) {
            echo 'Thanks for adding your word to story story.<br>
            <a href="stories.php?id='.$story_id.'">View updated story!</a>';
        }
        else {
            echo 'There has been an error.';
        }
    }
}
else {
    echo $story . '<br>Would you like to add to this story:
    <form action="stories.php" method="post">
    <b>Add a Word:</b> <input type="text" name="word"> 
    <input type="hidden" name="story" value="'.$id.'">
    <input type="submit" name="submit" value="Add Word"></form>';
}
?>

You'd need a database and a table called stories with fields "story_id" and "story".

This is a .44 Caliber Loveletter straight through my heart.

Tabulas + Threadless + Hire Me!





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users