PDA

View Full Version : MySQL access denied



daos
08-12-2006, 10:57 AM
I uploaded my MySQL databases onto the website and uploaded the pages that displayed the data. Unfortunately I got a lot of errors: http://animegraphx.com/avatars/index.php

I moved here from a different host and my username there was animegr, but here it's animergra. Could that have somehting to do with it?


<?php

$hostname="localhost";
$user="user";
$pass="password";
$dbase="dbase";
$connection = mysql_connect("$hostname" , "$user" , "$pass");
$db = mysql_select_db($dbase , $connection);

$query = "SELECT DISTINCT series FROM avatars order by series asc ";
$result=mysql_query($query);

$numcols = 2; // how many avatars per row
$numcolsprinted = 0; // no of columns so far

$rows_per_page=100; // how many avatars on the page
$total_records=mysql_num_rows($result); // all avatars
$pages = ceil($total_records / $rows_per_page); // all avatars divided by number per page
mysql_free_result($result);
if (!isset($screen))
$screen=0;
$start = $screen * $rows_per_page;
$query .= " LIMIT $start, $rows_per_page"; // remainder part of the query - the limit part
$result2 = mysql_query($query);

$query = "SELECT DISTINCT series FROM avatars order by series asc ";
$result= mysql_query($query, $connection) or die
("Could not execute query : $q." . mysql_error());

while ($row=mysql_fetch_array($result)) {
$series=$row["series"];

$q = "SELECT COUNT(*) FROM avatars WHERE series='$series'";
mysql_select_db($dbase);
$count = mysql_fetch_array(mysql_query($q));

if ($numcolsprinted == $numcols) { // if the no of columns so far is the number you set for avatars per row (end of the table row)
print "</tr>\n<tr>\n"; // end the existing row and start a new row
$numcolsprinted = 0; // number of columns so far returns back to 0
}

// display each avatar
echo " <td class=\"temp\" width=\"150\">
[<b>$count[0]</b>] <a href=\"series.php?series=$series\">$series</a>

</td>\n";

$numcolsprinted++; // current number of columns + 1
}
$colstobalance = $numcols - $numcolsprinted; // remaining avatars of the last row
for ($i=1; $i<=$colstobalance; $i++) { // if the no remaining avatars is bigger than 1
}
print "<td></td>\n"; // display a blank table cell

echo"</tr><br>"; // close up the table

?>

dvessel
08-12-2006, 11:49 AM
A simple question.. Did you assign the user to the database? When you look at the mysql setup page (not phpmyadmin) there are options in there to create users & databases. They are independent so you must assign a user to the database so it has permission to interact.

The other errors are most likely due "function.main" file pointing at the wrong places. Double check your paths and try again.

And becareful about what you reveal on these open forums.

daos
08-13-2006, 09:39 AM
Where would I be able to find the function.main?