Hi ,
I have managed(after lots of trying) to install mysql and php and apache on a pc running windows xp
I can access mysql via phpmyadmin and have imported a db into it
everything is fine but i am unable to connect to the mysql db via php
I am using the same code(that works perfectly on a domain host(with host username and password changed of course))but I keep getting errors
I tried connecting with this code
<?
$dbh=mysql_connect ("localhost", "root", "admin") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("motorcro_moto");
$query="SELECT * FROM admin";
$result = mysql_query($query) or die("Could not run query.");
$numrows = mysql_num_rows($result);
echo "numrows=".$numrows;
?>
but when I run it it returns
Could not run query.
has anyone got any idea where the problem my be. i am happy to post the php.ini and the httpd.conf if that helps
I am tearing my hair out as I am so close(after taking 8 hours to get phpmyadmin working)
thanks in advance
I have managed(after lots of trying) to install mysql and php and apache on a pc running windows xp
I can access mysql via phpmyadmin and have imported a db into it
everything is fine but i am unable to connect to the mysql db via php
I am using the same code(that works perfectly on a domain host(with host username and password changed of course))but I keep getting errors
I tried connecting with this code
<?
$dbh=mysql_connect ("localhost", "root", "admin") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("motorcro_moto");
$query="SELECT * FROM admin";
$result = mysql_query($query) or die("Could not run query.");
$numrows = mysql_num_rows($result);
echo "numrows=".$numrows;
?>
but when I run it it returns
Could not run query.
has anyone got any idea where the problem my be. i am happy to post the php.ini and the httpd.conf if that helps
I am tearing my hair out as I am so close(after taking 8 hours to get phpmyadmin working)
thanks in advance