Guest User

Untitled

a guest
Jul 11th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. DEFINE('DB_USER','root');
  2. DEFINE('DB_PSWRD','root');
  3. DEFINE('DB_HOST','localhost');
  4. DEFINE('DB_NAME','mydatabase');
  5.  
  6. $dbcon = mysqli_connect(DB_HOST,DB_USER,DB_PSWRD,DB_NAME);
  7.  
  8. if(!$dbcon){
  9. die('error connecting to database');
  10. }
  11.  
  12. echo 'connected to database'; // displays this message
  13.  
  14. $sql = mysql_query("SELECT * FROM users where id='1'");
  15. $sqla = mysql_fetch_array($sql);
  16. do {
  17. print $sqla['username']; // displays nothing
  18. }
  19. while($sqla = mysql_fetch_array($sql));
Add Comment
Please, Sign In to add comment