| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| NamePros Regular | Help with $_session[points] Hi. I have a page using sessions to obtain data from my database. For example - session_start(); echo("Your balance is $_SESSION[points] "); So if a user has 10 points, it will display 'Your balance is 10'. If the session picks up nothing in the database (I mean an empty field, not 0 points) is there a script I can implement so that the page doesnt display an empty line. Thanks for reading and I will donate all my NP$ to any one who finds a solution!
__________________ C905 - Sony Ericsson mobile phone with an 8 megapixel camera! Last edited by noswad; 05-17-2006 at 06:17 PM. |
| |
| | #4 (permalink) |
| NamePros Regular | Thanks for the replies. I think I may need to adapt on what I originally posted. Basically, in the example below, if the field in the database for the session 'used' is empty I want 'Points Left:' to move up one line on the web page. session_start(); echo("Points: $_SESSION[points] "); session_start(); echo("Used: $_SESSION[used] "); session_start(); echo("Points Left: $_SESSION[left] "); At the moment, because the session 'used' is empty my page is displaying like this: Points: 3 Points Left: 3 Where as I want it to display like this: Points: 3 Points Left:3 And then when the user finally uses 1 point, I will update the databse so that the page auto displays like this: Points: 3 Points Used: 1 Points Left: 2 Thanks again and sorry for not been clear initially
__________________ C905 - Sony Ericsson mobile phone with an 8 megapixel camera! |
| |
| | #5 (permalink) |
| NamePros Regular | PHP Code:
__________________ ask me about the internet |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |