Hi Everyone, Im new to php and only been using it for a couple of months now. Im having some trouble with a db query? I have 3 tables questions, answers & selections Im trying to get an output like this [b]Question 1[/b] option1 - answer option2 - answer option3 - answer [b]Question 2[/b] option1 - answer option2 - answer option3 - answer I do get the question and the option to display but not the answer?? im not sure what i am doing wrong. There is an error being thrown.. Warning: mysql_query(): A link to the server could not be established in /index.php on line 84 Access denied for user: 'root@localhost' (Using password: NO) I have highlighted the line like this ############ heres the code [code] <?php include("include/dbConnect.php"); mysql_connect($fasthit,$user,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "SELECT * FROM $dbQs WHERE year = $yr"; $result = mysql_query($query) or die("unable to get data"); $num = mysql_num_rows($result); mysql_close(); $i=0; while ($i < $num) { $Qid=mysql_result($result,$i,"Qid"); $question=trim(mysql_result($result,$i,"question")); $type=trim(mysql_result($result,$i,"type")); // WRITE QUESTION echo "<p><b>".$question."</b></p>"; // GET OPTION mysql_connect($fasthit,$user,$password); @mysql_select_db($database) or die( "Unable to select database"); $Squery = "SELECT * FROM $dbS WHERE parent_id = $Qid"; $Sresult = mysql_query($Squery) or die(mysql_error()); $Snum = mysql_num_rows($Sresult); mysql_close(); $S=0; while ($S < $Snum) { $option=mysql_result($Sresult,$S,"option"); echo $option." "; // GET SELECT BOX ANSWER include_once ("include/dbConnect.php"); ############ error here???? ############ mysql_connect($fasthit,$user,$password); @mysql_select_db($database) or die( "Unable to select database"); $SSquery = "SELECT COUNT(*) AS itIS FROM $dbAs WHERE Qid = $Qid"; $SSresult = mysql_query($SSquery) or die(mysql_error()); mysql_close(); echo $itIS."<br>"; $S++; } } [/code] I hope thats not too confusing?? sorry i usually use Coldfusion. Thanks in advance for your help