mySQL - Database connection

0 votes
218 views
added Sep 13, 2019 in mySQL by LC Marshal Captain (25,790 points)
<?php
  //Step1 db connection
   $db = mysqli_connect('localhost','root','','lazacode') or die('Error connecting to MySQL server.');
   
  //Step2 - get query and table
  $query = "SELECT * FROM lcNewTable ORDER BY RAND() LIMIT 10 ";
  mysqli_query($db, $query) or die('Error querying database.');
   
  $result = mysqli_query($db, $query);
  $row = mysqli_fetch_array($result);
  //variable from column
  $vpeximg  = 'https://lazacode.org/myimgFolder/';
  $vpexThumbImg = 'https://lazacode.org/myimgFolder/thumb/';
?>

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...