hi
I'm having trouble with php and mysql
I'm getting this error
[Sun Jan 30 17:43:40 2011] [error] [client 127.0.0.1] PHP Warning: mysql_query(): Access denied for user 'root'@'localhost' (using password: NO) in /var/www/t/view_tg.php on line 29, referer: http://localhost/t/
[Sun Jan 30 17:43:40 2011] [error] [client 127.0.0.1] PHP Warning: mysql_query(): A link to the server could not be established in /var/www/t/view_tg.php on line 29, referer: http://localhost/t/
[Sun Jan 30 17:43:40 2011] [error] [client 127.0.0.1] PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /var/www/t/view_tg.php on line 30, referer: http://localhost/t/
here is my php code
<?
include("db.inc.php");
session_start();
if ($_SESSION['adminid']=='') { header("Location: index.php");exit; }
?>
<html>
<head>
<? include('head.inc.php'); ?>
</head>
<body>
<? include('menu.php'); ?>
<table class='normal_table width_1000' cellspacing="1">
<tr class="table_head">
<td>TG ID</td>
<td>TG Name</td>
<td>First billing increment</td>
<td>TG Actions</td>
<td>Trunks available / all</td>
<td>Trunk Actions</td>
<td>Prefix Actions</td>
</tr>
<?php
$query = "SELECT * FROM `trunk_groups` WHERE 1=1";
$result = mysql_query($query) ;//or die ("Query failed with error: ".mysql_error());
while ($tmp = mysql_fetch_array($result)){
$id = $tmp['trunk_group_id'];
$name = $tmp['name'];
$auto_refill = $tmp['auto_refill'];
$min_seconds = $tmp['min_seconds'];
$refill_threshold = $tmp['refill_threshold'];
$dialstring = $tmp['dialstring'];
echo "<tr align='center' class='normal_table'>";
echo "<td>$id</td>";
echo "<td>$name</td>";
echo "<td>$min_seconds $_SEC</td>";
echo "<td><a href='edit_tg.php?id=$id'>Edit TG</a><br><a href='delete_tg.php?id=$id' onclick='return confirmDelete();'>Delete TG</a></td>";
$query = "SELECT * FROM `sip_buddies` WHERE trunk_group_id='$id'";
$result2 = mysql_query($query);
$query = "SELECT * FROM `sip_buddies` WHERE trunk_group_id='$id' AND used_seconds<daily_max_usage";
$result3 = mysql_query($query);
echo "<td>".mysql_num_rows($result3)."/".mysql_num_rows($result2)."</td>";
echo "<td><a href='add_trunk.php?trunk_group_id=$id'>Add new trunk</a></td>";
echo "<td><a href='view_prefixes.php?trunk_group_id=$id'>Manage prefixes</a><br><a href='add_prefix.php?trunk_group_id=$id'>Add prefix</a></td>";
echo "</tr>";
}
?>
</table>
</body>
</html>
and bd.inc.php
<?php
$db_host = "localhost";
$db_user = "asterisk";
$db_password = "joco15";
$db_name = "asterisk";
$mysql_link = mysql_connect($db_host,$db_user,$db_password) or die (mysql_error());
mysql_select_db($db_name);
?>
thx a lot inadvance.