Jump to content

filtering message from the database


izlik

Recommended Posts

hello.

 

i hope someone could help me with a little problem.

 

i have a page where people can send in MMS pictures and they get uploaded and displayed on my page, they need to type a keyword in the MMS like "sendmms" to make it work. if they also write "sendmms hey look at me" it also works since "sendmms" was at the beginning of the message and "sendmms hey look at me" get's added to the row "message" in my database. the pictures get an ID in the database and saved with the same ID on the server.

 

so under each picture sent in i wanted to add the comment they added after the "senmms" part.

 

so in short, how do i make it filter out "sendmms" and only display "hey look at me" ? and if the Page ID is let's say 13 it should display the "messsage" column for the ID in the database that has the same ID as the page ID is.

 

i hope someone can help me with this.

Link to comment
https://forums.phpfreaks.com/topic/51011-filtering-message-from-the-database/
Share on other sites

nothing on the filter, but the code bellow are for teh images. atm the message wont appear at all on "visabild.php"

 

"when someone clicks and image it gets opened in "visabild.php"

 

$res = mysql_query('SELECT *,unix_timestamp(tstamp) as utstamp FROM mms
    ORDER BY tstamp DESC LIMIT 6');
echo "<table cellspacing=\"3\" cellpadding=\"1\" border=\"2\"><tr>";
while ($row = mysql_fetch_assoc($res)) {
    echo "<td>";
    $row['message'] = substr($row['message'],strpos($row['message'],' '));

    if ( file_exists('data/' . $row['id'] . '.jpeg') ) {
        $row['picture'] = 'data/' . $row['id'] . '.jpeg';
    } else $row['picture'] = '';

    if ( $row['picture'] != '' ) {
        echo '<a href="'.$row['picture'].'"OnClick="window.open('."'".'visabild.php?id='.$row['id']."'".',null,'."'".'width=593,height=721'."'".'); return false;">';
        echo '<img width="125" src="' . $row['picture'] . '"></a>'; 
    }
    
    echo "</td>";
}
    echo "</tr></table>";
?>

 

Visabild.php

 

<head><link href="/comments/style.css" rel="stylesheet" type="text/css" 

/></head>
<?php error_reporting(E_ALL ^ E_NOTICE); ?>

<center><img width="350" src="data/<?=$_GET['id']?>.jpeg"></center>
<br>
<?php echo $_GET["message"]; ?>
<br>
<?php include 'comments/comments.php';?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.