View Full Version : Disable Data From Mysql Table

08-27-2009, 09:29 AM

Sorry Lately i been posting too many Quastions , Forgive me , Just trying to learn . :) and i ask when i dont know how to get it right .

Now the quastion is .

I have Mysql .. there is a Tabel Called Message with 3 Rows (sender , Reciver , Message ) .. Now i need to make little script . reads the data from the tabel . like this

1- Sender of the Message
2- Reciver of the Message
3-the Message

the script will print Out the message that Been Sent between the Sender and the Reciver .. when spicif the sender id and the Reciver id ..
Please see the Html form for More understanding


<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>


<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><p>
<input type="text" name="T1" size="20" value="Sender">&nbsp;&nbsp; To&nbsp;&nbsp;
<input type="text" name="T2" size="20" value="Reciver"><input type="submit" value="Show me the Message" name="B1"></p>
<p>Print Out the Message here ...</p>



Phil Jackson
08-27-2009, 09:56 AM

$con = mysql_pconnect("localhost", "username", "password");
$db = mysql_select_db("databasename", $con);

$reciever = "JohnDoe";
$query = mysql_query("SELECT * FROM `Message` WHERE Reciever = '$reciever' order by ID DESC");
while($array = mysql_fetch_array($query))
$DBsender = $array['sender'];
$DBreciever = $array['Reciever'];
$DBmessage = $array['Message'];

<p>your html would go here using the variables above</p>
echo "No messages in you inbox";


Phil Jackson
08-27-2009, 09:58 AM
The above code is something i've just knocked up in 2mins, but its a great start for you to adapt it as you learn more.

EDIT: i noticed you haven't got an ID in your mysql table - i would add one - auto_increment - index

08-27-2009, 10:01 AM
Thank you .. i'm working oN it