[FX.php List] How do I hide a set of links?
Alex Gates
alex at gandrpublishing.com
Sun Jul 15 12:30:09 MDT 2007
Hi Jon,
It is used to reference a certain index in an array.
[0], for example, is the 1st index in an array.
[1] is the second
etc.
http://www.onlamp.com/pub/a/php/2001/06/07/php_foundations.html
http://www.tizag.com/phpT/arrays.php
Jon Montgomery wrote:
> Thanks ggt!
>
> Something about looking at them on a different page other than web editor.
> I noticed this as I was writing the post.
>
> But what does that [0] do? What is it's purpose in PHP?
>
> Jon
>
> On 7/15/07 3:49 AM, "Gjermund Gusland Thorsen" <ggt667 at gmail.com> wrote:
>
>> $_SESSION['School_ID'] = $login_row['School_ID'][0];
>>
>> $_SESSION['password'] = $login_row['password'][0];
>>
>> $_SESSION['solo_site'] = $login_row['solo_site'][0];
>>
>> $_SESSION['org_site'] = $login_row['org_site'][0];
>>
>>
>> These lack [0] at the end:
>>
>> $_SESSION['Paid_Membership'] = $login_row['Paid_Membership'];
>>
>> $_SESSION['paid'] = $login_row['paid'];
>>
>> $_SESSION['username'] = $login_row['username'];
>>
>>
>> ggt667
>>
>>
>>
>> On 7/15/07, Jon Montgomery <igsmasupport at igsmasouth.org> wrote:
>>> In the login response page, at the start of the document I have:
>>>
>>> <?php if(!session_id()) session_start();?>
>>>
>>> Then the FX results
>>>
>>> Then right before the HTML info:
>>> $_SESSION['School_ID'] = $login_row['School_ID'][0];
>>>
>>> $_SESSION['password'] = $login_row['password'][0];
>>>
>>> $_SESSION['solo_site'] = $login_row['solo_site'][0];
>>>
>>> $_SESSION['org_site'] = $login_row['org_site'][0];
>>>
>>> $_SESSION['Paid_Membership'] = $login_row['Paid_Membership'];
>>>
>>> $_SESSION['paid'] = $login_row['paid'];
>>>
>>> $_SESSION['username'] = $login_row['username'];
>>>
>>>
>>> This was created using FMStudio. (It is great for me however does keep me
>>> from learning php like I should)
>>> And I just noted that some of the variables have the [0] and some do not. I
>>> suspect that I added those last three by hand and must have left them out.
>>>
>>> Jon Montgomery
>>>
>>> On 7/14/07 5:51 PM, "Alex Gates" <alex at gandrpublishing.com> wrote:
>>>
>>>> show us how you are setting your session variable.
>>>>
>>>> Jon Montgomery wrote:
>>>>> Let me explain more:
>>>>>
>>>>> Print_r shows: Array ( [0] => user
>>>>>
>>>>> So I am talking about the [0]
>>>>> When I added that to the code Alex and Bob gave me, all worked fine.
>>>>>
>>>>> Jon
>>>>>
>>>>>
>>>>> On 7/14/07 5:41 PM, "Jon Montgomery" <igsmasupport at igsmasouth.org> wrote:
>>>>>
>>>>>> Alex and Bob,
>>>>>> Thanks for the code. Both of you said what I had tried. So at least
>>>>>> I
>>>>>> was on the right track.
>>>>>> Now tell me about the [0] that is sometimes used after variables? I
>>>>>> was
>>>>>> using print_r($_SESSION) to make sure my username was set. It was but in
>>>>>> the print out on the web page, each array had the [0] listed. So I tried
>>>>>> it
>>>>>> with the code you guys gave me. And it works.
>>>>>> Now tell me how have I missed this before? When do I use it and when
>>>>>> do
>>>>>> I not use it?
>>>>>>
>>>>>> Anyway, thanks a bunch!
>>>>>>
>>>>>> Jon
>>>>>>
>>>>>>
>>>>>> On 7/14/07 5:25 PM, "Alex Gates" <alex at gandrpublishing.com> wrote:
>>>>>>
>>>>>>> Hi Jon -
>>>>>>>
>>>>>>> how about:
>>>>>>>
>>>>>>> <?php if($_SESSION['user'] == "manager"){?>
>>>>>>> <a href="http://www.....">Link for managers only</a>
>>>>>>> <?php } ?>
>>>>>>>
>>>>>>> be sure to start your session at the top of the page, too -
>>>>>>> session_start();
>>>>>>>
>>>>>>> Jon Montgomery wrote:
>>>>>>>> I am using session data at login. On my following pages, how do I
>>>>>>>> "hide"
>>>>>>>> certain page links from the "users" and show them to the "managers"?
>>>>>>>>
>>>>>>>> I have tried some code, but am unable to make it work. Also have
>>>>>>>> searched
>>>>>>>> php.net and get no where.
>>>>>>>>
>>>>>>>> Any help will be greatly appreciated.
>>>>>>>>
>>>>>>>> Jon Montgomery
>>>>>>> _______________________________________________
>>>>>>> FX.php_List mailing list
>>>>>>> FX.php_List at mail.iviking.org
>>>>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>>>>
>>>>>> _______________________________________________
>>>>>> FX.php_List mailing list
>>>>>> FX.php_List at mail.iviking.org
>>>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> FX.php_List mailing list
>>>>> FX.php_List at mail.iviking.org
>>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>>
>>>> _______________________________________________
>>>> FX.php_List mailing list
>>>> FX.php_List at mail.iviking.org
>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>
>>>
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
More information about the FX.php_List
mailing list