Page 1 of 1

Noob thinks mysql isnt working properly

PostPosted: 21. December 2009 22:17
by evtherev
Hi, I am a complete noob. A while ago I paid a guy to make a little program that used mysql and he installed it on my machine - more recently I decided to give php/mysql a go and bought kevin yanks book. Following one of the earliest tutorials in there I have hit a problem. I have installed XAMPP and via the phpmyadmin I can see databases I have created, but when i try and access them with the following code it gives me the error specified.

<?php

$link = mysqli_connect('localhost', 'root', '50364321');

if (!$link)
{
$output = 'Unable to connect';
include 'output.html.php';
exit();
}

if (!mysqli_set_charset($link, 'UTF8'))
{
$output = 'Unable to set Encoding';
include 'output.html.php';
exit();
}

if (!mysqli_select_db($link, 'covers'));
{
$output = 'Unable to select Database';
include 'output.html.php';
exit();
}

$output = 'Database Connection Established.';
include 'output.html.php';

?>


It gets to the 3rd query mysqli_select_db and fails, printing the 'unable to select database' error, i can see it is there, I have triple checked the spelling and even tried it on another database and it still doesnt work.

Im sure this is simple to solve and im just stupid but i appreciate any attempts to help greatly as this is annoying me now.

cliffs
Databases are there, apache and mysql are running in xampp, database name is spelt correctly - still cant find db.

It seems like a problem with the way msql has installed (i did previously have mysql installed in order to run a program which i had a programmer design for me)

Thanks

Evan

Re: Noob thinks mysql isnt working properly

PostPosted: 21. December 2009 22:17
by evtherev
I am on vista btw