Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $DB_SERVER = "mysql.dunglaxx.com";
- $DB_USER = "dungla";
- $DB_PASS = "password";
- $DB_NAME = "dakdata";
- try {
- $pdo = new PDO("mysql:host=$DB_SERVER;dbname=$DB_NAME", $DB_USER, $DB_PASS);
- $sql = '
- SELECT word, notes
- FROM md_words
- ORDER BY RAND()
- LIMIT 1 ';
- $q = $pdo->query($sql);
- $q->setFetchMode(PDO::FETCH_ASSOC);
- }
- catch (PDOException $e)
- {
- die("Could not connect to the database $dbname :" . $e->getMessage());
- }
- while ($row = $q->fetch())
- {
- // we print the quote ($row[0]) and the author ($row[0])
- $quote = $row['word'];
- $meaning = $row['notes'];
- }
Add Comment
Please, Sign In to add comment