0

i use wamp localhost on port 8080 it ope php pages good but now i want to connect mysql

<table width="200" border="1" dir="rtl">
  <tr>
    <td>Age</td>
    <td>City</td>
    <td>Lname</td>
    <td>Fname</td>
    <td>ID</td>
  </tr>
<?php
mysql_connect("localhost","root","");
mysql_select_db("learnfiles");
$query="select * from users";
$a=mysql_query($query);
while($b=mysql_fetch_assoc($a))
{


     echo "<tr>";
        echo "<td>".$b["age"]."</td>";
        echo "<td>".$b["city"]."</td>";
        echo "<td>".$b["lname"]."</td>";
        echo "<td>".$b["fname"]."</td>";
        echo "<td>".$b["id"]."</td>";
        echo "</tr>";

}
?>

but it has error Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp\www\pro\index.php on line 16 i change the port address of myadmin is [http://localhost:8080/phpmyadmin] how can i solve it?

aliyousefian
  • 449
  • 5
  • 14

1 Answers1

0

use mysqli instead because mysql_connect deprecated

$db = new mysqli('localhost', 'user', 'pass', 'DB');

if($db->connect_errno > 0){
    die('Unable to connect to database [' . $db->connect_error . ']');
}
Osama Jetawe
  • 2,697
  • 6
  • 24
  • 40
  • no it doesn't work, i use visual asp.net but now i want learn php i install wamp but doesn't work i change defualt port 80 to 8080 and it worked i dont know why i cant connect mysql – aliyousefian Apr 05 '15 at 06:49