
conan318
Members-
Posts
195 -
Joined
-
Last visited
Never
Everything posted by conan318
-
is it WHERE username = '".$username."' or WHERE username = '"$_SESSION.$username."'
-
<?php session_start(); $myusername=$_SESSION['myusername']; require "database.php"; if (!isset($_GET['myusername'])) { $data = mysql_query("SELECT * FROM users LEFT JOIN status ON status.username=users.username WHERE username = '".$_SESSION['myusername']."' ORDER BY id DESC LIMIT 1;") or die(mysql_error()); } else { $getuname = mysql_real_escape_string($_GET['username']); $data = mysql_query("SELECT * FROM users LEFT JOIN status ON status.username=users.username WHERE username = '".$myusername."' ORDER BY id DESC LIMIT 1;") or die(mysql_error()); error Column 'username' in where clause is ambiguous ??
-
thanks mate just tested it further but it seems to load the same profile ill check out the tutorial
-
thanks that worked can u explain in english for this newbie why it worked or post a link to somewhere on this so i can learn more about this thanks again
-
i have 2 tables one is called users which holds all the users profile details and another table called status when a users updates there status and posts there status to the page inside the status table statusid, status, and username. now what iam trying to do is when some clicks on someone status to bring up there profile from the users table. my code which doesnt work $data = mysql_query("SELECT * FROM users, Where status.username=users.username ORDER BY id DESC LIMIT 1;") or die(mysql_error()); //Puts it into an array while($info = mysql_fetch_array( $data )) { thanks in advance
-
just tested it, and it works the first time a users enters the room and writes to database but after page refreshers the list disappears if i logged out and in nothing. deleted entrys from the database and re logged in worked intill the page refreshes..
-
thanks mate will give that a go and let you know how it went
-
do you mean something like this mysql_query("IF NOT EXISTS(SELECT * FROM logedin WHERE username=$myusername) THEN INSERT INTO logedin (username) VALUES ('$myusername')"); pretty much im using if(!$_SESSION['myusername']){ //if usernames don't match redirect to login page header("location: main_login.php"); } $myusername=$_SESSION['myusername']; then inserting my $myusername into the logedin table. the page refreshs every 60 seconds and is adding the username into the table again. but i need to somehow check if all users are still there when then page refreshers and remove the ones who arent there. thats the goal thanks
-
im trying to insert $myusername into a table only if $myusername does not exist is best to call the insert ignore or is there better way of doing this? also trying to make a list of logged in users which is allways updating when the page is auto refreshed whats the best to go about checking if the users is still there.
-
dont mind just relised uploading the file to wrong place lol
-
$myusername = $_POST['myusername']; mysql_query("INSERT INTO logedin ( username ) VALUES ('$myusername')") OR die("Could not send the message: <br>".mysql_error()); wont insert anything no error's given even just trying to insert username into the the loged in table yes i know i spelt loged in wrong but i did that on the db lol
-
cheers mate silly mistake but it is 4am here in Australia
-
im trying to make a private message system now when i send a message it works fine but when i open the message at the other end i get a blank message. now i think the problem is with $messageid = $_GET['messages'] when i echo $messageid i get nothing, if i use the print_r($_GET) it returns Array ( [messageid] => 12 ). thanks <?php session_start(); $myusername=$_SESSION['myusername']; require "database.php"; $messageid = $_GET['messages']; $message = mysql_query("SELECT * FROM messages WHERE message_id = '$messageid' AND to_user = '$myusername'"); $message=mysql_fetch_assoc($message); echo "$message"; echo "<h1>Title: ".$message['message_title']."</h1><br><br>"; echo "<h3>From: ".$message['from_user']."<br><br></h3>"; echo "<h3>Message: <br>".$message['message_contents']."<br></h3>"; echo '<form name="backfrm" method="post" action="inbox.php">'; echo '<input type="submit" value="Back to Inbox">'; echo '</form>'; ?>
-
roger that i am currently studying web design and development on a 3 week break atm but wear going to start programing when we get back im trying to learn a few things b4 we start.
-
i have read many different tutorials from all over the place trying to make sense of it all, trying all different things till something works where is good place to for tutorials? I just discovered if i refresh the page it logs me out how can i keep the user logged if they refresh the page?
-
<? session_start(); if(!$_SESSION['myusername'] ){ //if usernames don't match (is this what you wanted??) header("location: main_login.php"); } Echo "welcome " . $_SESSION['myusername']; ?> Problem solved thanks for your help been a big help.
-
i just removed this line from the login_success.php ("location: main_login.php"); is this line needed?? this is my frist my time working with php.
-
i have tried Echo "welcome " . $_SESSION['$myusername']; returns nothing also tried Echo "welcome " . $_SESSION['myusername']; also returns nothing i really don't understand why
-
hi thanks for your help... i just tried copied and pasted your code and tried it but it it just Echoed Welcome and nothing else. there is a sign up page which creates the username and password and small profile and picture for the user. now what I am wanting to is after the user logs in it will bring up there profile they created and saved to database. but if i cant access the user name from the SESSION i wont be able to work out which user has logged in. i did write the code in the dreamweaver cs4 editor and it was Charset utf 8 which i was reading could cause a problem but i have since remove the charset utf 8 and still cant get the username to display thru the SESSION. hope that makes sense thanks again
-
Hi i have made a login in system for a website iam trying to make. after you log in im trying to display the members username via the $_session created in the check_login.php. but when i Echo or print_r the $_session all is get is "welcome array" its like its not passing any information via the $_session from page to page. here is my code thanks in advance. Check_login.php session_start(); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=md5($_POST["mypassword"]); // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION["myusername"]==$myusername; $_SESSION["mypassword"]; header("location:login_success.php"); } else { echo "Wrong Username or Password"; } ?> login_success.php <? session_start(); if($_SESSION['myusername']="$myusername"){ header("location:main_login.php"); } Echo "welcome" . $_SESSION['$myusername']; ?> thanks