I want to use this (from here):
$sql = “SELECT * FROM blogroll ORDER BY rand(” . time() . ” * ” . time() . “) LIMIT 1”;
In order to pull bits of random code into my sidebar.php file (I will need to use lots of these random entries, so this method looks best, ATM).
Do I use this by creating a table in my WP database and replacing “blogroll” in the above line with the name of the table(say: randomphp)?
I will try this as soon as I figure out how to fill in the fields in the new table.
If I am correct about what I need to do please help me out with the fields on the table creation screen in phpMYadmin:
The code I want to put in place of the SQL string in my sidebar.php, right?
primary, index, unique, or —?
- The topic ‘Setting up a SQL table for random select’ is closed to new replies.