UBB.Dev
Posted By: Tech-Ni-Kal PHP Help - 06/19/2003 4:56 AM
I want to have a quick links bar on the top of my webpage. I would also like to store it in my MySQL database, but since I am still a newb when it comes to PHP, I wasn't sure exactly how I might go about doing this.

I was thinking I might use an array. But I wasn't sure if that would work.

Basically it should look like this on output:

[ Link1 | Link2 | Link3 ]
Posted By: Ron M Re: PHP Help - 06/19/2003 5:14 AM
I would have a table with sortid, url and description.

Query the records, then use HTML and say

Code
[/code]Then just echo your [ and | between with some logic.

I use the mysql_fetch_row, then I send the $row[#] to variables, then use the variables in my HTML that I echo.

Some snippets that I use:

[code]
I took out some of my control breaks like where I check to see if it is a different block or the admin flag check on my mainnav.

There is probably a more efficient way to handle this, but this works for what I need it to.
Posted By: Tech-Ni-Kal Re: PHP Help - 06/19/2003 5:23 AM
Heh. You just shot all my hopes of understanding PHP with that snippet. I think mainly cause I don't understand what $detflag is and such. :-D

So basically, I could just have a a few rows, like linktitle, linkurl, and than call it via row? Then have it out put the link with | and then cut the | on the last one?
Posted By: Brett Re: PHP Help - 06/19/2003 11:37 AM
another example?, being that you have a pre defined table with linktitle, linkurl and sortorder columns.
[code][/code]Then your $buttons variable would be your links. I dunno...
Posted By: Ron M Re: PHP Help - 06/19/2003 3:02 PM
Quote
quote:
Originally posted by Tech-Ni-Kal:
Heh. You just shot all my hopes of understanding PHP with that snippet. I think mainly cause I don't understand what $detflag is and such. :-D

So basically, I could just have a a few rows, like linktitle, linkurl, and than call it via row? Then have it out put the link with | and then cut the | on the last one?
$detflag was a variable I used to determine permissions on whether to display a certain line or not. If you look on my main page, you don't see some of the links based off of permissions. I have a secion of links just for my admins that show up for the Admin Tools, Forum CP, and the Moderator's forum. The $detflag variable is checked before I display an item, and if permissions are NOT met, then the item is not displayed.

I just snipped out all of my UBB Authentication checking before I posted that snippet, even though a couple of the pages are checked for permissions before being displayed.
Posted By: Tech-Ni-Kal Re: PHP Help - 06/20/2003 6:04 PM
Well this is simple as I needed it to be: laugh

[code][/code]
© UBB.Developers