nofishing Posted June 25, 2010 Share Posted June 25, 2010 I want to load some options in my menu from an other php file. Now i have $general=" <li><a href=\"index.php?a=player/news\">Home</a></li> "; But now i want to add this in the $general part <? if($data->login == $admin || $data->admin == 1) { ?> <div class="menu-item-left"><img src="images/arrow.jpg"><a href="index.php?a=admin/admin"><font color="#000000"><b>Administrator <img src="images/icons/accept.png" border="0"></b></font></a><img src="../seperator.jpg" class="sep"></div> <?php } else { ?> <?php } ?> Some one know how i can do this? And also i have the same problem at this part (but this isnt working) [code]$moderncrimes=" <li><a href=\"index.php?a=player/modernnews\">Home</a></li> <li><a href=\"index.php?a=crimes/training\">Trainingen</a></li> print <<<ENDHTML // estimate the number of rows in a table | Select random player to attack $lekerdezes = mysql_query("select * from `users`"); $max = mysql_num_rows($lekerdezes); // pick one $rand = rand(1,$max); $lekerdezes2 = mysql_query("select * from `users` WHERE id='".$rand."'"); while($rand == $data->id){ $rand = rand(1,$max); } ENDHTML; <li><a href=\"index.php?a=crimes/attack&x=<?echo$rand;?>\">Random attack</a></li> "; [/code] Quote Link to comment https://forums.phpfreaks.com/topic/205843-php-load-from-other-file/ Share on other sites More sharing options...
phpology Posted June 25, 2010 Share Posted June 25, 2010 for your first question, you can concatenate your $general variable i.e. $gallery = "lorem"; if($next_word == "ipsum") { $gallery .= " ipsum<br />"; $gallery .= "<a href=\"http://www.domain.com\">lorem ipsum</a>" } echo $gallery; fopr your second question, rather then run 2 queries why dont you run something like this select * from users order by rand() limit 1 Quote Link to comment https://forums.phpfreaks.com/topic/205843-php-load-from-other-file/#findComment-1077133 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.