mrbitsinfo Posted August 9, 2011 Share Posted August 9, 2011 good day to all if have a code like this <ul> <li><a href="downloads/<?php echo $row_detail['des1']; ?>"><?php echo $row_detailis['download1']; ?></a></li> <li><a href="downloads/<?php echo $row_detail['des2']; ?>"><?php echo $row_details['download2']; ?></a></li> </ul></td> <td><div align="center"> as u can see i have a database feld DES1 have a name for a file to download and DOWNLOAD1 the file to download my probelm is IF des1 = ".." dont put the link in href i put something like this but not work if(des1==".."){ <li><a><?php echo $row_detailis['download1']; ?></a></li> }else{ <li><a href="downloads/<?php echo $row_detail['des1']; ?>"><?php echo $row_detailis['download1']; ?></a></li> } what can be wrong?? TNX in advance Quote Link to comment https://forums.phpfreaks.com/topic/244336-link-or-not-link/ Share on other sites More sharing options...
WebStyles Posted August 9, 2011 Share Posted August 9, 2011 if($row_detail['des1']==".."){ ..... you're using 3 different variables names, I assume it's a typo ? but you actually have them all over the place. $row_detail, $row_detailis, $row_details (which one is correct ?) Quote Link to comment https://forums.phpfreaks.com/topic/244336-link-or-not-link/#findComment-1255057 Share on other sites More sharing options...
mrbitsinfo Posted August 9, 2011 Author Share Posted August 9, 2011 sorry was a misstype <?php echo $row_detail['des1']; ?>"><?php echo $row_detail['download1']; ?></a></li> detail is the name of the recordset, desx=the name of the download, downloadx is the file to download.. i have 4 fields for files to sownload but not allways are 4 files to choose so i want to put an if statement before each line so if the field "des1" was equal to ".." theres no file to download so the href tag must not display.... let say if des1= ".." echo .. else name & link to the file for download endif Quote Link to comment https://forums.phpfreaks.com/topic/244336-link-or-not-link/#findComment-1255075 Share on other sites More sharing options...
WebStyles Posted August 9, 2011 Share Posted August 9, 2011 I answered that in my previous post. check out the code I posted. Quote Link to comment https://forums.phpfreaks.com/topic/244336-link-or-not-link/#findComment-1255077 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.