Jump to content

dennell

Members
  • Posts

    8
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

dennell's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi thanks for the response, but no. That tutorial will show you how to create a login system not an update user profile system.
  2. Hi everyone, So after searching for hours and hours trying to find a php tutorial that will guide me through how to create a page where once a user is logged in can actually update their details, i have been unsuccessful. Could anyone please point me in the direction of a tutorial of how to do this please, I am a basic beginner and would like to know how to do this step by step. Thanks
  3. hmm since i'm new and trying to undertand php and mysql I fail what i should be using instead of "register_globals". I just wanted to try and get it to work.. but regardless of whether it's bad it's not doing what i thought it would do and just simply update data in my database. Finding a tutorial thats more recent using mysqli or PDO(??) seems to be hard to come by as i would have no idea if i had found it?
  4. Hi, The code is in the linked tutorial which i included in my post. here is my code(which is the same code as the tutorial by the way). Theres 3 files but i think the file that is causing the aggro is the following: <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="root"; // Mysql password $db_name="ryandb"; // Database name $tbl_name="test_mysql"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // update data in mysql database $sql="UPDATE $tbl_name SET name='$name', lastname='$lastname', email='$email' WHERE id='$id'"; $result=mysql_query($sql); // if successfully updated. if($result){ echo "Successful"; echo "<BR>"; echo "<a href='list_records.php'>View result</a>"; } else { echo "ERROR"; } ?> Basically the code echos success but when i check my database the update hasn't happened.
  5. Hi Everyone I have followed a tutorial online : http://www.phpeasystep.com/mysql/9.html However running from localhost it doesn't seem to UPDATE the values in my database and table. I have tried this twice now and cannot get it to work. anyone have any ideas?
  6. Ok i have assigned the values to my sessions. However when i run the code and it passes to the membersonly.php it is still not working. As in displaying the "username". I am also looking to have the code changed so that a user can update their details once they are logged in?? any ideas? thanks
  7. Hi php freaks, I am looking for some help to customise my code so that a user can update their user login details. This is my poor attempt at creating a session so that a user can login and get a customised message. I have created a very basic login system which is just for a small project of mine. I have created a mysql database and a table to which i can add users. The first thing that I have created is my register new user code which looks like this: register_code.php <?php $con = mysql_connect("localhost","root","root"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("testdb", $con); $sql="INSERT INTO customer (firstname, surname, email, username, password) VALUES ('$_POST[firstname]','$_POST[surname]','$_POST[email]','$_POST[username]','$_POST[password]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } header('Location: register_success.html'); mysql_close($con); ?> The code above with insert a new user into my customer table and register the new user. The next code file is my checklogin.php file which when a user logs in the details are checked and then the user either successfully logs in or doesn't depending on whether their details match the information in my database: checklogin.php <?php ob_start(); $host="localhost"; // Host name $username="root"; // Mysql username $password="root"; // Mysql password $db_name="testdb"; // Database name $tbl_name="customer"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Define $myusername and $mypassword $myusername=$_POST['myusername']; $mypassword=$_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']; $_SESSION['mypassword']; header("location:membersonly.php"); } else { echo "Wrong Username or Password"; echo '</br><a href="main_login.php">Try Again</a>'; } ob_end_flush(); ?> When the checklogin.php is successful then the user is redirected to the membersonly.php page where I would like to just simply display a welcome message like "welcome bob to your members page" membersonly.php <?php session_start(); ?> <html> <body> Welcome <?=$_SESSION['myusername'];?> Login Successful </body> </html> if anyone could help by helping me to adapt my code you will be helping an absolute beginner understand sessions. Thanks Ryan
  8. Hi there i was just wondering whether someone could point me in the direction of an extensive blogging system tutorial. I know php and mySQL and would be looking to use both, and was looking for tutorials on the net, but there doesnt seem to be anything about thats is extensive... just loads of 'simple blog tutorials' The kind of thing i am looking to do is to have a user based driven blogging system. whereby annoymous users can post replies to blogs, but cannot create a blog themselves. I am also looking to implement a catagorie feature where a user can create a catagorie and edit exsisting catagories etc etc So if anyone can point me in a direction of a tutorial (an extensive one) that can come somewhere close to my needs, i would be most grateful. thanks
×
×
  • 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.