Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

Simple Login/Register/Main Script

align login registering

  • Please log in to reply
40 replies to this topic

#37 Whitey


    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 259 posts

Posted 11 January 2009 - 05:33 PM

Thank you very much Whitey!

I am new to php, and I had the following question:

I know that to see if the user is logged in I use the following code:

echo "Display to member";

What i want to do is say "Welcome, (and the user's name)"

How do I get php to actually print the person's name.

I tried using this code

$myusername = $_SESSION[myusername];

and then simply saying

echo "Welcome, " .$myusername;

but that doesnt work

I would really appreciate it if someone could help me.
Thank you in advance

$myusername = $_SESSION['myusername'];
echo("Welcome, ".ucfirst($myusername));

I use ucfirst becuase it will cap the first letter of the word. Makes it neater ;)
  • 0

#38 ssSuave


    CC Newcomer

  • Just Joined
  • PipPip
  • 12 posts

Posted 13 January 2009 - 08:35 AM

Thank you Very much Whitey.

  • 0

#39 jthom263


    CC Resident

  • Just Joined
  • PipPipPipPip
  • 72 posts

Posted 12 April 2010 - 02:41 AM

how do i configure the MySql DB???? They Are My main Down Bringing... ????
  • 0

#40 kentona


    CC Newcomer

  • Just Joined
  • PipPip
  • 18 posts

Posted 20 September 2010 - 06:23 AM

I need help with this. I have everything working except i get this error when one of my users registers to the site,

Parse error: syntax error, unexpected T_STRING in /***/***/***/***/config.php on line 9

The *** by the way is my personal information so i have it protected using that :D but i checked my config file and everything seems to be fine.

class MySQLDB
   var $connection;         //The MySQL database connection

   /* Class constructor */
   function MySQLDB(){
      /* Make connection to database */
      $this->connection = @mysql_connect(localhost, ***, ***) or die(mysql_error());
      @mysql_select_db(***, $this->connection) or die(mysql_error());
    * query - Performs the given query on the database and
    * returns the result, which may be false, true or a
    * resource identifier.
    //Use this function as query("Query line of code");
   function query($query){
      return mysql_query($query, $this->connection);

$config = new MySQLDB;

Thanks for any help given.
  • 0

#41 bbqroast


    Codecall Addict

  • Senior Member
  • PipPipPipPipPipPip
  • 564 posts
  • Location:/etc/passwd

Posted 26 September 2010 - 11:25 PM

Mayby on the page where it gives you the option to logout you could add some stuff like code to display their username- just to point readers in the right direction.
  • 0
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download