Jump to content

walshybiker

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

walshybiker's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Don't have error reporting - Its a college server (work is for an Assignment) :-\
  2. <?php //This checks that the user is registered and has entered the correct details session_start(); // check if logged in or not? if (!isset($_SESSION['username']) ||$_SESSION['username']==$username) { // not logged in, move to login page header('Location: login.php'); } else { $con=mysql_connect("localhost", "20154162", "lynne"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db ("two0154162") or die (mysql_error()); $_POST[$_SESSION['username']=true; //insert fields into databse $query = "INSERT INTO event(eventa) VALUES ('"$_SESSION ["username"]"')"; mysql_query($query) or die('Error, insert query failed'.mysql_error()); //after login it returns to events page // header('location:events.html'); // exit; mysql_close ($con); } echo ("got here"); ?> Edit: We have tags for posting code within.
  3. Code attached :'( [attachment deleted by admin]
  4. Still struggling - I have checked all other coding in linked pages. Last night I was getting a 0 in the field. Now I get a HTTP500 internal server error! I seem to keep going round in circles. Any more suggestions???
  5. Hi I'm new to this and am struggling with an assignment. I want to populate a database (in phymyadmin) called event. When a link is clicked it then moves to this page where I want it to populate a field called eventa with the username. It just sends a 0 to all fields. The php code is below: <?php //This checks that the user is registered and has entered the correct details session_start(); // check if logged in or not? if (!isset($_SESSION['username']) ||$_SESSION['username']=$username) { // not logged in, move to login page header('Location: login.php'); } else { $con=mysql_connect("localhost", "20154162", "lynne"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db ("two0154162") or die (mysql_error()); $_POST[$_SESSION['username']=$username; //insert fields into databse $query = "INSERT INTO event(eventa) VALUES ('"$_SESSION ["username"]'")"; mysql_query($query) or die('Error, insert query failed'.mysql_error()); //after login it returns to events page // header('location:events.html'); // exit; mysql_close ($con); } //echo ("got here"); ?> Thanks Walshybiker
×
×
  • 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.