SHARE
TWEET

Untitled

a guest Jun 19th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $db_host = '127.0.0.1';
  4. $db_user = 'root';
  5. $db_password = 'root';
  6. $db_port = '3306';
  7.  
  8. $db_conn = mysql_connect($db_host.':'.$db_port, $db_user, $db_password);
  9.  
  10. $db_result = mysql_query('select version() as version;', $db_conn);
  11.  
  12. $row = mysql_fetch_array($db_result, MYSQL_ASSOC); // this does NOT work
  13. // $row = mysql_fetch_assoc($db_result); // this works
  14.  
  15. printf("mysql version: %s\n", $row['version']);
  16.  
  17. mysql_free_result($db_result);
  18.  
  19. mysql_close($db_conn);
  20.  
  21. ?>
RAW Paste Data
Top