![]() |
| ||
| show club presidents info hide everyone else's HI All, I've been trying to make a membership management type script. This script would have a database with the members contact info and which office they hold, if any. The problem I am having is I would like the script to show the president's and vice president's Contact info all the time, but hide the contact info for everyone else when viewed by the general public, then if the user logs in all contact information is displayed. Below is the part of the script that I have so far, The if logged in / out part works like I want, but I can't get it to show the President's info but hide the other members info. if (($sub_office =="President")||($sub_office =="Vice President")||($sub_office =="Secretery")){I Have also seen the if ($sub_office =="President") done like this if ($sub_office !="President") I can't seem to get it to work either way. If there is a better way of doing any of this, let me know. I would appreciate any help. |
| ||
| Re: show club presidents info hide everyone else's Well, I don't know all your database, but here's a sample script I would use: if (!logged_in) |
| ||
| Re: show club presidents info hide everyone else's This would work ok, but I forgot to mention that I still want to show everyone's name. I only want to show the contact info for the president, VP, and Secretary. Only the name and 'office' would be shown for the other members. |
| ||
| Re: show club presidents info hide everyone else's In which case, you could change the query. Under the if(!logged_in) part, after the first query: $names = mysql_query("SELECT name FROM members WHERE id != 'president'");That should do the trick. |
| ||
| Re: show club presidents info hide everyone else's I would prefer not to change the sql query. This would create a plroblem in the list and also would make it difficult to do the logged in view. I'm not sure why the if() statements aren't working. I think they should. Thanks for the help anyway. |
| ||
| Re: show club presidents info hide everyone else's What problem exactly would you have by adding the sql query? |
| ||
| Re: show club presidents info hide everyone else's I wasn't sure how to get it to sort my my ordered list. I want the results sorted by office list. How could this be done with two seperate sql queries. NOTE: not all offices from one query are in a row. eg. President, Vice President, Other Offices..., Secretary, ect... I did post this quetion in another forum and they were able to offer a simpler version of the page I wrote. (they eliminated some if statements, ect.) I still don't have the page working so I would still appreciate help. Here is the PHP page that they suggested: <?phpOf coarse I added a few things to try to make it work for me (eg. sql connect info ect.). |
| ||
| Re: show club presidents info hide everyone else's I only found one type of thing wrong on this page, all of your $zip = (isset($row['zip']) ? $row['zip'] : " "); lines have an unmatched bracket ) on the end of them. So I changed them to this $zip = ( isset($row['zip'] ) ? $row['zip'] : " ";And played around with the rest of the code some too ... but no promises <?php |
| ||
| Re: show club presidents info hide everyone else's This is still a no go. also if you look at $zip = (isset($row['zip']) ? $row['zip'] : " "); They are not mis matched. Oh well, I'll keep fooling with it until I get it figured out. |
| ||
| Re: show club presidents info hide everyone else's You're right about the not-mismatched ... guess I had already fooled with it some before noticing that I had un-matched the brackets :-\ So, what's not working...are you getting errors, is the html not formatting correctly, are you not getting data from the database ... ? Just trying to help. |
| ||
| Re: show club presidents info hide everyone else's The names and offices show up properly, but none of the contact info shows up, wether logged in or not. I would assume that the sql query's are working fine, just the if logged in and if officer aren't working. I do appreciate the help! |
| ||
| Re: show club presidents info hide everyone else's Okay, I came in after-the-fact on this post and now I'm going to back up and take it from the start ... wish me luck. First of all you need to test and make certain you have a 'true' value for session status when a member is logged in. That could be your only problem right now. Please check my code to make sure all of your database login and table field names are correct -- change my code values if they are not And check that the SESSION names-values are correct, and working <?php Okay, my eyes are so blurry I can't read...hope I didn't make too many type-os Ciao |
| ||
| Re: show club presidents info hide everyone else's Hi, yours seems to be really close except: There is a bunch of < r> before the table (I can't find where they are coming from), I also would like to insert into a cell if the sql row is empty for that column (to make the table look better) I did have to make a couple of changes to make things work, but this is the closest I've gotten yet. <?php I added the SELECT CASE so I could order the offices in a set order. I do have the 'sub_name' sent from a form currently, but I don't want to switch it to the POST method. I want to keep it so I can make a link and have it go directly to a certain one, therefore I believe it should stay as GET. Thanks for all your help so far. |
| ||
| Re: show club presidents info hide everyone else's I was laying there in bed trying to go to sleep and realized I had not added the contingency for empty values or empty table cells ... Try this $html = '';Hope this works for you. Out of curiosity, what are you doing with these lines in the SELECT statement? (SELECT ... |
| ||
| Re: show club presidents info hide everyone else's Ok, First off the table looks better, but for some reason I'm getting < r> tags at the end of each row. These are place before the table. I don't understand where they are coming from. The (SELECT lines are to sort the results by a list I set. I don't want the rows sorted alphabetically. I want them according to office, eg the most important office (president) office to the lesser important (the committees). Thanks Again for you wonderful help. |
| ||
| Re: show club presidents info hide everyone else's Quote:
Could they be coming from one of the include files? Could they be coming from some copy-paste-replacement you made and left a telltale < r> (say from <tr> or <br>)? Just guessing And you're welcome about the help :-) |
| ||
| Re: show club presidents info hide everyone else's Hi again. I just found where they were coming from. you had typed <\tr> when it should have been </tr>. Once I changed that it made everything show, if I dare say, perfectly. By the way I knew the include files were fine. Thanks Alot! |
| ||
| Re: show club presidents info hide everyone else's I knew I was pretty tired when I wrote that stuff...glad you found the source of the problem. Take care |
| All times are GMT -4. The time now is 9:03 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC