
PGTibs
Members-
Posts
73 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
PGTibs's Achievements

Member (2/5)
0
Reputation
-
It looks like it should work, i can't see any problems but then i'd normally run everything first to test it. Someone else might spot a problem but i can't see any.. Should work fine
-
I've managed to find this script... <script type="text/javascript" language="javascript"><!-- function Bolden() { var MyElement = document.getElementById("chatmsg"); MyElement.value("<b></b>"); return true; } //--></script> </head> <body> <a style='cursor: pointer;' onClick="Bolden()"><b>Bold</b></a> <input id="chatmsg" type="text" size="60" maxlength="80" onkeyup="keyup(event.keyCode);"> And basically its meant to be a very simple richtext editor, so you click the Bold link and in the input box it adds <b></b> to the input, which works. However, it just replaces any text with the bold tags instead of adding it on the end. Does anyone know the problem? I'm a complete beginner when it comes to javascript.
-
Id rather try and solve my problem the way my database is already but yano Its getting it from the person name, so the username is like ?user=name and then it looks in the database for a table with the member name as name And then basically it takes the id from that name and searchs for the table with that id with f after it.. E.g. name = bob then it looks for the id of bob = 1 and then it looks for and displays the data on table 1 f Full Page: <? session_start(); include "config.php"; include "online.php"; include('emoticon.php'); $em = new Emoticon(); $em->add('','faces/bigsmile.png'); $em->add(':-D','faces/bigsmile.png'); $em->add(":'(",'faces/cry.gif'); $em->add("",'faces/smile.png'); $em->add(":-)",'faces/smile.png'); $em->add("",'faces/sad.png'); $em->add(":-(",'faces/sad.png'); $em->add(":@",'faces/angry.png'); $em->add(":-@",'faces/angry.png'); $em->add("+o(",'faces/ill.png'); $em->add("+O(",'faces/ill.png'); $em->add(":S",'faces/confused.png'); $em->add(":-S",'faces/confused.png'); $em->add(":-s",'faces/confused.png'); $em->add(":s",'faces/confused.png'); $em->add("",'faces/tongue.png'); $em->add("",'faces/tongue.png'); $em->add("",'faces/wink.png'); $em->add(":^",'faces/embarras.png'); $em->add(":|",'faces/bored.png'); $em->add(";o",'faces/shocked.png'); $em->add(";O",'faces/shocked.png'); $em->add("",'faces/shocked.png'); $em->add("",'faces/shocked.png'); $em->add("(h)",'faces/cool.gif'); $em->add("(H)",'faces/cool.gif'); ?> <head> <link REL="STYLESHEET" TYPE="text/css" HREF="css.css"> </head> <body> <? $comm = str_replace( "", "<img src='faces/bigsmile.png'>", $comm ); $user = $_GET["user"]; $comment = $_GET["comment"]; $add = $_GET["add"]; $friend = $_GET["friend"]; $edit = $_GET["edit"]; $usernamem = $_SESSION['session_username']; $query = mysql_query("SELECT * FROM `members`"); while($result = mysql_fetch_array($query)) { $id = $result["id"]; $name = $result["name"]; $email = $result["Email"]; $age = $result["age"]; $location = $result["location"]; $aboutme = $result["aboutme"]; $music = $result["music"]; $films = $result["films"]; $books = $result["books"]; $buddy = $result["bestbuddy"]; $photo = $result["photo"]; $IDF = "$id f"; $IDC = "$id C"; if($user == "$name") { echo "<center>"; include "nav.php"; echo " <div class='box'> <div class='image'> <img src='$image' width='200px' border='0'> <div class='friends' align='left'> "; if($_SESSION['session_username'] == "$name") { echo ""; } else { echo "<div style='float:right;'> - <a href='profile.php?user=$name&add=addfriend'>Add As Friend</a> - </div>";}; echo "<h2>Friends</h2>"; if($add == "addfriend") { $friend = mysql_query("SELECT * FROM `members` WHERE `name` = '$usernamem'"); while($friendd = mysql_fetch_array($friend)) { $fid = $friendd["id"]; $IDFF = "$fid f"; $addfriend = mysql_query("INSERT INTO `$IDFF` (`maten`, `matep`) VALUES ('$user', '$photo');"); echo "Friend Added..."; echo "<meta http-equiv=\"refresh\" content=\"2;url=profile.php?user=$name\">"; }; }; $queryy = mysql_query("SELECT * FROM `$IDF`"); while($resultt = mysql_fetch_array($queryy)) { $maten = $resultt["maten"]; $matep = $resultt["matep"]; $iddd = $resultt["ID"]; echo " <div style='padding-left: 5px;'> - <a href='profile.php?user=$maten'>$maten</a>"; if($_SESSION['session_username'] == "$name") { echo " <a href='profile.php?user=$name&friend=del$maten$iddd'>[X]</a>";}; echo "</div>"; if($friend == "del$maten$iddd") { $del = mysql_query("DELETE FROM `$IDF` WHERE ID='$iddd' AND maten='$maten'"); echo "<meta http-equiv=\"refresh\" content=\"2;url=profile.php?user=$name\">"; echo "<div style='padding-left: 5px;'>$maten Deleted...</div>"; }; }; echo " </div> </div> <div class='content' align='left'>"; if($_SESSION['session_username'] == "$name") { echo " <a href='profile.php?user=$name&edit=$name$id' class='edit'>[Edit]</a>"; }; if($edit == "$name$id") { if($_SESSION['session_username'] == "$name") { include "profileedit.php"; } else { echo "BAD PERSON! Your not logged in with this username!"; echo "<meta http-equiv=\"refresh\" content=\"3;url=profile.php?user=$name\">"; }; } else { echo " <h2><a href='profile.php?user=$name'>$name</a></h2> <div class='info'> <b>Location</b>:<br> - $location<br> <b>Age</b>:<br> - $age<br> <b>About Me</b>:<br> - $aboutme<br> <b>Music</b>:<br> - $music<br> <b>Films</b>:<br> - $films<br> <b>Books</b>:<br> - $books<br> <b>Best Buddy</b>:<br> - $buddy<br> </div> ";}; echo " <div class='contentt' align='left'> <h2>Comment - <a href='profile.php?user=$name&comment=add'>Add Comment</a></h2>"; if($_POST['subsend']) { $comnn = $_SESSION['session_username']; $ccomm = $_POST["ccom"]; $sub = mysql_query("INSERT INTO `$IDC` (`comn`, `comm`) VALUES ('$comnn', '$ccomm');"); echo "Comment Posted..."; echo "<meta http-equiv=\"refresh\" content=\"2;url=profile.php?user=$name\">"; } else if($comment == "add") { echo $em->apply(" <div style='padding: 10px;'><form method='POST' action='profile.php?user=$name&comment=sub'> <textarea style='width: 100%;' id='ccom' name='ccom'>Add comment here...</textarea><br> <div align='right' style='padding-bottom: 10px; border-bottom: #41A317 2px solid;'> <input type='submit' name='subsend' value='Post'></div></form>"); } else { $queryyy = mysql_query("SELECT * FROM `$IDC` WHERE `ID` <> 1 ORDER BY `ID` DESC"); while($resulttt = mysql_fetch_array($queryyy)) { $comn = $resulttt["comn"]; $comm = $resulttt["comm"]; $idd = $resulttt["ID"]; if($_SESSION['session_username'] == "$name") { echo $em->apply("<div style='margin-top: 4px; background-color:#52D017'> <a class='deletec' href='profile.php?user=$name&comment=del$idd'>[Delete]</a> <div style='padding-left: 5px;'> - <a href='profile.php?user=$comn'>$comn</a> <div style='padding-left: 15px;'> $comm</a></div></div></div>");} else { echo $em->apply("<div style='margin-top: 4px; background-color:#52D017'> <div style='padding-left: 5px;'> - <a href='profile.php?user=$comn'>$comn</a> <div style='padding-left: 15px;'> $comm</a></div></div></div>");}; if($comment == "del$idd") { echo "Comment Deleted..."; $del = mysql_query("DELETE FROM `$IDC` WHERE ID='$idd'"); echo "<meta http-equiv=\"refresh\" content=\"2;url=profile.php?user=$name\">"; }; }; }; echo " </div> </div> </div> </div> "; include "footer.php"; echo "</center>"; }; }; mysql_close($ms); ?> </body>
-
This just causes a 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 '`SELECT` * `FROM` `users` WHERE `user_id`='1' at line 1 error
-
So basically instead of having a table for every user its just using the same ID's as the other tables?
-
Oh and plus, that change didn't work either
-
but i only want you to be able to add the friend when it isn't on your page, if its the same as $name then its only going to show on your own page?
-
It brings up the webaddress as &add=addfriend but nothing else happens, it doesn't add anything to the database or echo anything.
-
This still causes it to happen twice????
-
Right well, the $_POST['subsend'] worked, i don't quite see why but none the less it worked, so now i've got another problem which is the same it just uses a link instead? if($_SESSION['session_username'] == "$name") { echo ""; } else { echo "<div style='float:right;'> - <a href='profile.php?user=$name&add=addfriend'>Add As Friend</a> - </div>";}; echo "<h2>Friends</h2>"; if($add == "addfriend") { $friend = mysql_query("SELECT * FROM `members` WHERE `name` = '$usernamem'"); while($friendd = mysql_fetch_array($friend)) { $fid = $friendd["id"]; $IDFF = "$fid f"; $addfriend = mysql_query("INSERT INTO `$IDFF` (`maten`, `matep`) VALUES ('$user', '$photo');"); echo "Friend Added..."; The $_POST['addfriend'] doesn't work for this problem...
-
I'm building a webpage where you can leave comments which go into a database, however when you submit the form the query runs twice and i can't find the problem. I've looked online but that hasn't helped me any. if($comment == "sub") { $comnn = $_SESSION['session_username']; $ccomm = $_POST["ccom"]; $sub = mysql_query("INSERT INTO `$IDC` (`comn`, `comm`) VALUES ('$comnn', '$ccomm');"); echo "Comment Posted..."; echo "<meta http-equiv=\"refresh\" content=\"2;url=profile.php?user=$name\">"; } else if($comment == "add") { echo " <div style='padding: 10px;'><form method='POST' action='profile.php?user=$name&comment=sub'> <textarea style='width: 100%;' id='ccom' name='ccom'>Add comment here...</textarea><br> <div align='right' style='padding-bottom: 10px; border-bottom: #41A317 2px solid;'> <input type='submit' name='submit' value='Post'></div></form>"; } else { etc...etc...
-
Thanks
-
That just causes a parse error and solving the parse error then gives either the same problem or the textbox dissappears..
-
The form on this page wont submit, its found just under the if submit statement and no matter what i try, the action wont happen after i press the post button. Whats the problem??? <? session_start(); include "config.php"; ?> <head> <link REL="STYLESHEET" TYPE="text/css" HREF="css.css"> </head> <body> <? $user = $_GET["user"]; $comment = $_GET["comment"]; $query = mysql_query("SELECT * FROM `members`"); while($result = mysql_fetch_array($query)) { $id = $result["id"]; $name = $result["name"]; $age = $result["age"]; $location = $result["location"]; $aboutme = $result["aboutme"]; $music = $result["music"]; $films = $result["films"]; $books = $result["books"]; $buddy = $result["bestbuddy"]; $photo = $result["photo"]; $IDF = "$id f"; $IDC = "$id C"; if($user == "$name") { echo "<center>"; include "nav.php"; echo " <div class='box'> <div class='image'> <img src='$image' width='200px' border='0'> <div class='friends' align='left'> <h2>Friends</h2> "; $queryy = mysql_query("SELECT * FROM `$IDF`"); while($resultt = mysql_fetch_array($queryy)) { $maten = $resultt["maten"]; $matep = $resultt["matep"]; $matec = $resultt["matec"]; echo " <div style='padding-left: 5px;'> - <a href='profile.php?user=$maten'>$maten</a></div>"; }; echo " </div> </div> <div class='content' align='left'> <h2>$name</h2> <div class='info'> <b>Location</b>:<br> - $location<br> <b>Age</b>:<br> - $age<br> <b>About Me</b>:<br> - $aboutme<br> <b>Music</b>:<br> - $music<br> <b>Films</b>:<br> - $films<br> <b>Books</b>:<br> - $books<br> <b>Best Buddy</b>:<br> - $buddy<br> </div> <div class='contentt' align='left'> <h2>Comment - <a href='profile.php?user=$name&comment=add'>Add Comment</a></h2>"; $queryyy = mysql_query("SELECT * FROM `$IDC` WHERE `ID` <> 1 ORDER BY `ID` DESC"); while($resulttt = mysql_fetch_array($queryyy)) { $comn = $resulttt["comn"]; $comm = $resulttt["comm"]; if($comment == "sub") { $comnn = "Username Failed"; $ccomm = $_POST["ccom"]; $add = mysql_query("INSERT INTO `$IDC` ( `comn`, `comm`) VALUES ('$comnn', '$ccomm')"); } if($comment == "add") { echo " <div style='padding: 10px;><form method='POST' action='profile.php?user=$name&comment=sub'> <textarea style='width: 100%;' id='ccom'>Add comment here...</textarea><br> <div align='right' style='padding-bottom: 10px; border-bottom: #41A317 2px solid;'> <input type='submit' name='submit' value='Post'></div></form>"; }; echo "<div style='margin-top: 2px; background-color:#52D017'> <div style='padding-left: 5px;'> - <a href='profile.php?user=$comn'>$comn</a></div> <div style='padding-left: 15px;'> $comm</a></div></div>"; }; echo " </div> </div> </div> </div> "; include "footer.php"; echo "</center>"; }; }; mysql_close($ms); ?> </body>
-
Awesome, thanks. Told ya it was simple