Jump to content

bam2550

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Everything posted by bam2550

  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
  15. now i get this error! 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 ''sendto', 'from', 'subject', 'message') VALUES ('mod123', 'admin', 'r', 'r')' at line 1 hmm
  16. 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 ''sendto', 'from', 'subject', 'message') VALUES ('', 'admin', 'r', 'r')' at line 1 is it not reading the from? it doesnt look like it is... seeing as from is blank in this error message, but it is aparent in the boxes... === I think i found why... ==== The onlything that was changed to sendto was the tables in MySQL...
  17. using that exact code i received this error... 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 ('', 'admin', 'fe', 'fe')' at line 1 do i have to use ยด or ` or ' ??
  18. <?php include("include/session.php"); $to = trim(mysql_real_escape_string($_POST["sendto"])); $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)) // This is Line 10 // $con = mysql_connect("localhost","iii","iii"); 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" } ?>
  19. Yes, i have kind of only been using yours the hole time
  20. sooo close... Parse error: syntax error, unexpected T_VARIABLE in /opt/lampp/htdocs/test/send.php on line 10 it looks right...
  21. but it is not solved I ran into another error, which is a good thing i think... Can you help? 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', 'hihi', 'hi')' at line 1
  22. oh great we are making progress it seems!! NEW E RROR 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', 'hihi', 'hi')' at line 1 Also i did so debugging in your script! hehe, also its not, to, in the table anymore... it is sendto thanks
  23. This is sooo annoying Want to test it out yourself? http://68.38.155.104/test/main.php Register 2 names, send a message from name1 to name2 and tell me if name2 receives it! hehe
  24. Nope no errors at all... when i fill out the form to send something, blank screen... When i click inbox.php, blank screen... Also, the table says nothing is recordered... so inbox.php is probably not the problem (since it is printing what it says it is printing... nothing!)
×
×
  • 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.