Here’s the code I have so far. I can get a list of user names from my database and I can replace the user name in the first follow button.
I’m stuck on how to iterate the list so each user has a follow button that links to their twitter account?
Any help or ideas would be greatly appreciated!
<?php
// Connect to database server
mysql_connect("localhost", "root", "") or die (mysql_error ());
// Select database
mysql_select_db("tewxadb") or die(mysql_error());
// SQL query
$strSQL = "SELECT * FROM users";
// Execute the query (the recordset $rs contains the result)
$rs = mysql_query($strSQL);
// Loop the recordset $rs
// Each row will be made into an array ($row) using mysql_fetch_array
while($row = mysql_fetch_array($rs)) {
// Write the value of the column FirstName (which is now in the array $row)
echo $row['username'] . "<br />";
}
// Close the database connection
mysql_close();
?>
<a href="https://twitter.com/" +$row(text) class="twitter-follow-button" data-show-count="true" data-lang="en">Follow </a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>