bam2550
Members-
Posts
41 -
Joined
-
Last visited
Never
Everything posted by bam2550
-
Thanks, i fixed it!
-
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>
-
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"]));
-
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?
-
Hmm okay thanks a lot. Nice tutorials
-
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
-
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.
-
Yes, i was thinking about doing that. But how? and where?
-
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
-
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
-
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!
-
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??)
-
^^ that last thing worked perfectly! not i just have to edit it a little to retreive it correctly!
-
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"; } ?>
-
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
-
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
-
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...
-
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 ' ??
-
<?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" } ?>
-
Yes, i have kind of only been using yours the hole time
-
sooo close... Parse error: syntax error, unexpected T_VARIABLE in /opt/lampp/htdocs/test/send.php on line 10 it looks right...
-
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
-
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
-
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
-
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!)