deeej Posted July 23, 2007 Share Posted July 23, 2007 Hi people, not a clue how I would do this if someone could help that would be great, I tried putting all the information in a table but if there is no value some of the data is displayed randomly! if ($1[pool]=="y") { $ShowInfo .= "<tr><img src='images/icons/pool.gif'><B> Pool</B></tr>"; } if ($1[valet]=="y") { $ShowInfo .= "<tr><img src='images/icons/valet.gif'><B> Valet</B></tr>"; } if ($1[gym]=="y") { $ShowInfo .= "<tr><img src='images/icons/gym.gif'><B> Gym</B></tr>"; } $ShowInfo .= "<tr><img src='images/icons/beds.gif'><B> $a1[beds] Beds</B></tr>"; $ShowInfo .= "<tr><img src='images/icons/checkin.gif'><B> Check-In Time:</B> $1[checkintime]</tr>"; $ShowInfo .= "<tr><img src='images/icons/checkout.gif'><B> Check-Out Time:</B> $1[checkouttime]</tr>"; if ($1[parking]=="y") { $ShowInfo .= "<tr><img src='images/icons/parking.gif'><B> Parking</B></tr>"; } if ($1[wireless]=="y") { $ShowInfo .= "<tr><img src='images/icons/wireless.gif'><B> Wireless</B></tr>"; } basically I have a database full off businesses and each business has a list of extra facilities. What I am trying to do is to display the facilities they do have, and not the ones they do not have. like so: Extra facility 1, extra facility 2 extra facility 3, extra facility 4 extra facility 5, extra facility 6 2 Facilities on each row then go to a new line I tried a table but if they do not have 'for example facility 3' then there is a gap where it should be in the table and data looks odd. This is mysql and PHP. Thanks Quote Link to comment Share on other sites More sharing options...
deeej Posted July 23, 2007 Author Share Posted July 23, 2007 Please help I have no idea what to do^^ Quote Link to comment Share on other sites More sharing options...
Barand Posted July 23, 2007 Share Posted July 23, 2007 1 ) variable names beginning with a number ($1) are not allowed. 2 ) string keys ([valet]) should be quoted (['valet']) 3 ) Does the number of beds come from different source ($a1['beds']) 4 ) How are you getting the $1[xxx] data in the first place? Quote Link to comment Share on other sites More sharing options...
deeej Posted July 23, 2007 Author Share Posted July 23, 2007 Sorry the php code works fine I just changed it a bit, it is all a1.. (it's getting it to display how I want I am having trouble with I was showing the code I want to change to display correct) Try reading it again (I am a bit of a n00b sorry lol) I showed an example of how I want it to display but I only want data shown if they have that facility, the values are enum ('y','n') and some are numbers (like amount of rooms a hotel has), obviously if they do not have the facility I do not want it to display This bit I can get working fine. It's just to display the data in a table with 2 columns with out the data having random spaces if they do not have that facility. Example 1, Example 2 , Example 3 Example 4, Example 5 Thanks, Hope you can understand now!!! Sorry Quote Link to comment Share on other sites More sharing options...
Barand Posted July 23, 2007 Share Posted July 23, 2007 I know what you want. There was a possibility that there may have been a more efficient way of getting from your original data to your required output. But if you don't want to help me to help you, that's fine. Quote Link to comment Share on other sites More sharing options...
deeej Posted July 24, 2007 Author Share Posted July 24, 2007 !!!!!!! I do want help Why wouldn't I?!?!?! Please Help!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.