unemployment Posted April 4, 2011 Share Posted April 4, 2011 How can I add a link when my query result is >= 6 ? Do I have to use mysql_num_rows? Quote Link to comment https://forums.phpfreaks.com/topic/232646-if-result-6-add-link/ Share on other sites More sharing options...
spiderwell Posted April 4, 2011 Share Posted April 4, 2011 that will return the number of rows in your query, so yes, something like this perhaps if(mysql_num_rows($result) >= 6) echo "<a href='somelink'>link</a>"; Quote Link to comment https://forums.phpfreaks.com/topic/232646-if-result-6-add-link/#findComment-1196597 Share on other sites More sharing options...
unemployment Posted April 4, 2011 Author Share Posted April 4, 2011 ok but how do I do this for array values. [5] => Array if (array is >= 5) echo $link; Quote Link to comment https://forums.phpfreaks.com/topic/232646-if-result-6-add-link/#findComment-1196602 Share on other sites More sharing options...
dcro2 Posted April 4, 2011 Share Posted April 4, 2011 if (count(array) >= 5) echo $link; I think at least... your last post was very confusing. Quote Link to comment https://forums.phpfreaks.com/topic/232646-if-result-6-add-link/#findComment-1196631 Share on other sites More sharing options...
spiderwell Posted April 4, 2011 Share Posted April 4, 2011 do you mean something like this? foreach ($myarray as $k => $v) { if ($v >= 6) echo $link; } Quote Link to comment https://forums.phpfreaks.com/topic/232646-if-result-6-add-link/#findComment-1196632 Share on other sites More sharing options...
spiderwell Posted April 4, 2011 Share Posted April 4, 2011 I think at least... your last post was very confusing. yeah it confused me Quote Link to comment https://forums.phpfreaks.com/topic/232646-if-result-6-add-link/#findComment-1196633 Share on other sites More sharing options...
KevinM1 Posted April 4, 2011 Share Posted April 4, 2011 Why don't you post some relevant code and your database table structure? Telepathy isn't a forum feature (although I hear CV is working on it after the success of the Auto Solve button). Quote Link to comment https://forums.phpfreaks.com/topic/232646-if-result-6-add-link/#findComment-1196639 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.