Jump to content

bam2550

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bam2550's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Okay, one small problem and one small thing to say! The one small thing is i didnt want a value, i just got my words mixed up The one small problem is that in my text editor (linux ubuntu, which usually always colors PHP syntax) is not coloring in my PHP stuff, only HTML... I think this is affecting the code since the script does not work now... This is my form... <html> <form action="send.php" method="POST"> <select name="to"> <?php $con = mysql_connect("localhost","3434","45345"); mysql_select_db("login", $con); $result = mysql_query("SELECT * FROM users", $con); while($row = mysql_fetch_array($result)) { ?> Send to: <option> <?php echo $row['username']; ?> </option> <?php } ?> </select> <br> Subject: <br><input type="text" name="sub"> <br> Your Message: <br><textarea name="msg" rows="10" cols="45"></textarea><br> <input type="submit" value="Send"> </form> <?php echo "<br>Back To [<a href=\"main.php\">Main</a>]<br><br/>"; ?> </html>
  2. Okay well, i have a private messaging system. I am trying to fix up the send form... But im hitting some brick walls... What my work looks like as of now! Question: 1) How do i set a value to a drop down menu so it sends the selected information (POST) to send.php 2) How do i make it so Subject is not invisible, and on the line below the drop down menu. Thanks thats it! Here is what you might need: form.html <html> <select> <?php $con = mysql_connect("localhost","3434","45345"); mysql_select_db("login", $con); $result = mysql_query("SELECT * FROM users", $con); while($row = mysql_fetch_array($result)) { ?> Send to: <option><?php echo $row['username']; ?></option> <?php } ?> <form action="send.php" method="POST"> <br> Subject: <br><input type="text" name="sub"> <br> Your Message: <br><textarea name="msg" rows="10" cols="45"></textarea><br> <input type="submit" value="Send"> </form> <?php echo "<br>Back To [<a href=\"main.php\">Main</a>]<br><br/>"; ?> </select> </html> This is what i want the drop down menu to be set to... $sendto = trim(mysql_real_escape_string($_POST["to"]));
  3. mysql_select_db("messaging", $con); $result = mysql_query("SELECT * FROM private_messages WHERE sendto='$username'", $con);; Is there anyway to sort it by the id? from highest number to lowest?
  4. Hmm okay thanks a lot. Nice tutorials
  5. 1.) I have never seen a PMing system tutorial... 2.) I really do not want to redo this PM system... Through all this debugging and building from scratch (which took me a while, and i learned a lot) I dont want to stop now. 3.) Thanks BlueSky
  6. Hmm, im still having much trouble with this. I can figure out how to apply a set number to it (0 for each one, 1 for each one, 2 for each one, ect ect) but not a unique one.
  7. Yes, i was thinking about doing that. But how? and where?
  8. uhhmm here ill pastebin all the import things for you. This is basically what it is (minus the control panel, minus the login screen (which i doubt is important)) PS... The includes are to help identify the $username sending and receiving... PPS... It actually works http://pastebin.com/m1b803a4
  9. You may remember me from a while back when i asked help about my Private Messaging System. Well its all good now, and i can effectively put in and take out the private message. My question is now, how can i make it like Invisionfrees/any forum private messaging? So far my inbox is like this: [From] admin [subject] Test [Message] Hey.... Test. And i would like it like [subject] Test [From] Admin And the word Test be incoded in a link to lead to a nice little page stating the From, Subject and Message. (Like a forum PM) I have no clue how to do this... Thanks
  10. I found the error... $username does not define to username correctly, so basically, everything is there except the to field. Which is bad, since no one can then receive the message!
  11. Okay... Yeah. Now my only problem is retreiving it in inbox.php. It is probably a similar problem to send.php ... If anyone would like to assist me... [code=php:0]<?php include("include/session.php"); ?> <?php $con = mysql_connect("localhost","~","~"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("messaging", $con); $result = mysql_query("SELECT * FROM private_messages WHERE 'sendto'='$username'", $con); if (!$result) { die( "Error, MySQL Said: " . mysql_error() ); } while($row = mysql_fetch_array($result)) { echo $row['from'] . " " . $row['message']; echo "<br />"; echo $row['sendto'] . " " . $row['subject']; } mysql_close($con); ?>[/php The way it is output is pretty crudy, but even if it is messy, idc. I just want to get it outputted (is that even a word??)
  12. ^^ that last thing worked perfectly! not i just have to edit it a little to retreive it correctly!
  13. Okay well i found the error was i didnt wrap the things in single quotes... i did and got a totally new error! My new error is: Unknown column 'mod123' in 'field list' PS mod123 is my to feild, atleast it should be! <?php include("include/session.php"); $to = trim(mysql_real_escape_string($_POST["to"])); $from = $username; $sub = trim(mysql_real_escape_string($_POST["sub"])); $msg = trim(mysql_real_escape_string($_POST["msg"])); if (isset($to)||isset($sub)||isset($msg)||!empty($to)||!empty($sub)||!empty($msg)){ $con = mysql_connect("localhost","r","l"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("messaging", $con); mysql_query("INSERT INTO private_messages (`sendto`,`from`,`subject`,`message`) VALUES (`$to`,`$from`,`$sub`,`$msg`)") or die(mysql_error());; mysql_close($con); } else { echo "Please fill out the form"; } ?>
  14. i still get... You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from,subject,message) VALUES (mod123,admin,r,r)' at line 1
×
×
  • 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.