izlik Posted May 12, 2007 Share Posted May 12, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/51011-filtering-message-from-the-database/ Share on other sites More sharing options...
MadTechie Posted May 12, 2007 Share Posted May 12, 2007 what do you have so far ? Quote Link to comment https://forums.phpfreaks.com/topic/51011-filtering-message-from-the-database/#findComment-251000 Share on other sites More sharing options...
izlik Posted May 12, 2007 Author Share Posted May 12, 2007 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';?> Quote Link to comment https://forums.phpfreaks.com/topic/51011-filtering-message-from-the-database/#findComment-251018 Share on other sites More sharing options...
chiprivers Posted May 12, 2007 Share Posted May 12, 2007 You have not sent the message variable as part of the url for the second page so how are you expecting to access using $_GET? Quote Link to comment https://forums.phpfreaks.com/topic/51011-filtering-message-from-the-database/#findComment-251034 Share on other sites More sharing options...
izlik Posted May 12, 2007 Author Share Posted May 12, 2007 You have not sent the message variable as part of the url for the second page so how are you expecting to access using $_GET? im having a problem with that part, each time i trye to ad it i break the code Quote Link to comment https://forums.phpfreaks.com/topic/51011-filtering-message-from-the-database/#findComment-251042 Share on other sites More sharing options...
chronister Posted May 12, 2007 Share Posted May 12, 2007 <?php $sendmms="sendmms What's Up?"; $comment=str_replace('sendmms','',$sendmms); echo $comment; // returns What's Up? ?> http://www.php.net/manual/en/function.str-replace.php Quote Link to comment https://forums.phpfreaks.com/topic/51011-filtering-message-from-the-database/#findComment-251115 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.