justlukeyou Posted April 2, 2013 Share Posted April 2, 2013 Hi, I have a social networking button which is an image. However when someone clicks the button to follow someone I want to replace the follow button with a standard image. <input name="followbutton" CLASS="submitbutton" type="submit" /> $query = mysql_query("SELECT * FROM follow WHERE user_id = '". $profileid ."' AND follow_user_id= '". $followerid ."'"); $duplicatefollow = null; if (mysql_num_rows($query) > 0) { echo ' <input name="followbutton" CLASS="submitbutton" type="submit" />'; } else { echo '<img src="/images/successfulfollow.png" /> } Any suggestions please? Quote Link to comment Share on other sites More sharing options...
justlukeyou Posted April 2, 2013 Author Share Posted April 2, 2013 Bloody hell, this code actually works!!! I wrote it here, didn't think it would work. I just had to swap the two sets of images. See Jessica, I am learning! <?php $query = mysql_query("SELECT * FROM follow WHERE user_id = '". $profileid ."' AND follow_user_id= '". $followerid ."'"); $duplicatefollow = null; if (mysql_num_rows($query) > 0) { echo '<img src="/images/successfulfollow.png.png" />'; } else { echo '<input name="followbutton" CLASS="submitbutton" type="submit" />'; } ?> Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 2, 2013 Share Posted April 2, 2013 No, it kind of just proves that you feel the need to post every single thing you do and ask questions about it. You didn't even test your own code before asking how to do it? Come on. Quote Link to comment Share on other sites More sharing options...
justlukeyou Posted April 2, 2013 Author Share Posted April 2, 2013 I thought you would be pleased that I was learning code. Nearly fell off my chair when it worked. 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.