runnerjp Posted April 16, 2009 Share Posted April 16, 2009 i cant get my head round this lol <?php $sql = "SELECT * FROM events WHERE date='$d-$m-$y'"; echo $sql; $postsresult = mysql_query($sql); $row = mysql_fetch_array($postsresult); $num = mysql_num_rows($postsresult); if($row['event'] == 1) { echo "<td class='tcell'>"; echo "<a href=\"http://www.runningprofiles.com/test2.php?month=$d-$m-$y\" rel=\"facebox\" onClick=\"document.f.eventdate.value='$m-$d-$y';\">$d</a>"; echo "</td>\n"; } else {echo "<td class='tcell'>"; echo "<a href=\"1\" rel=\"facebox\" onClick=\"document.f.eventdate.value='$m-$d-$y';\">$d</a>"; echo "</td>\n";}?> baiscly if $row['event'] has a event under it during that date then i want to display i link.. but if not the just text $d.... i canty figure out this part though lol if($row['event'] == 1) how would i find number of results for that row? Link to comment https://forums.phpfreaks.com/topic/154417-showing-link-if-results-1/ Share on other sites More sharing options...
runnerjp Posted April 16, 2009 Author Share Posted April 16, 2009 should explain i have a calander with all the days 1 2 3 4 5 6 ect and i want it so say day 5 had an event it displays the link Link to comment https://forums.phpfreaks.com/topic/154417-showing-link-if-results-1/#findComment-811936 Share on other sites More sharing options...
soak Posted April 16, 2009 Share Posted April 16, 2009 The HTML code you're echoing includes a link so if all you want to do is display the $d in the table cell when no events occur then replace: echo "<a href=\"1\" rel=\"facebox\" onClick=\"document.f.eventdate.value='$m-$d-$y';\">$d</a>"; with: echo $d; I'm not sure what you mean by your second question. Can you be more specific and include example data if possible? Link to comment https://forums.phpfreaks.com/topic/154417-showing-link-if-results-1/#findComment-811946 Share on other sites More sharing options...
runnerjp Posted April 16, 2009 Author Share Posted April 16, 2009 sorry its more of a if( ??? i dont kjnow what the if stsatement should be Link to comment https://forums.phpfreaks.com/topic/154417-showing-link-if-results-1/#findComment-811947 Share on other sites More sharing options...
runnerjp Posted April 17, 2009 Author Share Posted April 17, 2009 ok ermm basicly i would like to know if($row['event'] = no results do this.... Link to comment https://forums.phpfreaks.com/topic/154417-showing-link-if-results-1/#findComment-812136 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.