Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <?php
- $db_server="localhost";
- $db_user="root";
- $db_password="Root123.";
- $db_name="users";
- $connection=mysqli_connect($db_server,$db_user, $db_password);
- $mysql_query="select*from users";
- if(!$connection){
- die("nuk lidhemi me db ".mysqli_error($connection));
- }
- else{
- echo"lidhjs me db ishte e sukseshme";
- }
- //2. zgjedhim db
- $db_select=mysqli_select_db( $connection,$db_name);
- if(!$db_select){
- die("nuk u zgjodh db":.mysql_error());
- }
- else{
- echo "u realizua lidhja me db".$db_name;
- }
- ?>
- <html>
- <head>
- <title>mysql ne php</title>
- </head>
- <body>
- <?php
- $users_set=mysqli_query($connection, $mysql_query);
- if(!$users_set){
- die("query nuk u exekutua:".mysql_error($connection));
- }
- while($users=mysqli_fetch_array($users_set)){
- echo $users["username"]. ",".$users["email"];
- echo "<br/>";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement