| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Aug 2005 Location: Leeds, UK
Posts: 263
![]() | 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!
__________________ Michael McIntyre - Fan site for the super funny UK comedian Michael McIntyre
Last edited by noswad; 05-17-2006 at 07:17 PM.
|
| |
| | #2 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Something like this? PHP Code: |
| |
| | THREAD STARTER #4 (permalink) |
| NamePros Regular Join Date: Aug 2005 Location: Leeds, UK
Posts: 263
![]() | 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
__________________ Michael McIntyre - Fan site for the super funny UK comedian Michael McIntyre |
| |
| | #5 (permalink) |
| NamePros Regular Join Date: Aug 2005 Location: NY, USA
Posts: 610
![]() ![]() ![]() ![]() ![]() ![]() | PHP Code:
__________________ ask me about the internet |
| |
| | THREAD STARTER #6 (permalink) |
| NamePros Regular Join Date: Aug 2005 Location: Leeds, UK
Posts: 263
![]() | Thanks v much!
__________________ Michael McIntyre - Fan site for the super funny UK comedian Michael McIntyre
Last edited by noswad; 05-17-2006 at 09:26 PM.
|
| |