login session data

login session data

rm65453rm65453 Posts: 7Questions: 1Answers: 0

Hi everyone,

I was trying to accomplish the following them someone on stackoverflow suggested using datatables. The product looks great but I have been having some trouble.

my requirements:
1. Have users login to the website. This have been done using php and a sql table. the logged in user id is stored in a table and stored as $login_session variable.
2. I would like the data to be stored where the $login_session is stored under the User column of my database.
3. I also would like to show the data where the User column matches the current $login_session

I have gone through the documentation but so far I have only been able to run the examples with my database. The simple example is connect to my table and displays the data. not sure how to proceed to accomplish 2 and 3. Everytime I try to insert a query the example stops working.

Hopefully am able to get this working within the trial period.

Thanks

This question has an accepted answers - jump to answer

Answers

  • rm65453rm65453 Posts: 7Questions: 1Answers: 0

    apparently I was approaching the whole problem incorrectly, read the manual a few more times and was able to accomplish my goals.

    the only trouble now is that the login page send the sessions login id as a variable to the staff.php page to run the query, if I am logged out and manually enter the database page i get a jason error. anyway to turn it off?

  • rm65453rm65453 Posts: 7Questions: 1Answers: 0

    Trial period us about to end and I still have not figured this out. Can someone help?

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    You're not explaining your problem(s) very clearly. It would be more useful if you would provide a link to a page showing the issue.

  • rm65453rm65453 Posts: 7Questions: 1Answers: 0

    http://urlgone.com/fb3a39/

    if a user is not logged in, i get an error. I do not understand what this error means and secondly if possible i would like to change the error message.

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    The console error is:

    datepicker is not a function.
    $( "#datepicker" ).datepicker();

    What datepicker did you intend using? Did you reference its js anywhere?

    Use your own browser's console for further debugging.

  • rm65453rm65453 Posts: 7Questions: 1Answers: 0

    I actually get a pop up "DataTables warning: table id=example - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1"

    i am using the datepicker function in one of the fields.

  • rm65453rm65453 Posts: 7Questions: 1Answers: 0

    could you tell me which file is returning this error?

  • allanallan Posts: 64,844Questions: 1Answers: 10,733 Site admin
    Answer ✓

    Hi,

    There are two separate issues:

    1. The JSON error - the page is Ajax loading index.php. That is not valid JSON and therefore DataTables shows an error message. I would suggest adding some logic into simple.php to detect if the user is logged in or not. If they are not, redirect them.
    2. The Date picker error, as tangerine notes is because there is no date picker library loaded. There isn't actually a #datepicker element on the page, so I don't understand why you would have that code there. Unless you plan to add a date picker, then just remove that code.

    Allan

  • rm65453rm65453 Posts: 7Questions: 1Answers: 0

    Thanks Allan,

    I removed the datepicker, it was placed on this page in error.

    I have been working on including the logged in logic to the simple.php page.

    thanks again. you can close this thread.

This discussion has been closed.