0

Can anyone tell me how i can get the value for project_title, project_id, level_of_want, and selection_id. When i submit this i get No database selected error.

$query_Name = "SELECT u.Student_Surname, u.Student_Forename, p2.Project_Title,     
p2.Project_id, s.level_of_want, s.selection_id
FROM users u
INNER JOIN projects p2 ON u.id = p2.Project_Lecturer
INNER JOIN selection s ON p2.Project_id = s.id_project
INNER JOIN users u2 ON s.student_id = u2.id
WHERE u2.Username = ".$_SESSION['MM_Username']." ORDER BY selection_id ASC" ;
$Name = mysql_query($query_Name, $projectsite) or die(mysql_error());
$row_Name = mysql_fetch_assoc($Name);
$totalRows_Name = mysql_num_rows($Name);
1
  • did you open a db connection with mysql_select_db and mysql_connect previously? Commented May 30, 2012 at 12:35

2 Answers 2

1

after connecting to mysql server base you should explicitly select database using mysql_select_db function

Sign up to request clarification or add additional context in comments.

3 Comments

Sorry i rushed to enter. I meant i cant get the values as when i submit i get the No database selected error.
@NathanLinkAbiola mysql_select_db('db_name') must be missing in connection.
Thanks lads, seemed i had the mysql_select_db in the wrong location
1
mysql_select_db($bd);

we need to see how do you connect

2 Comments

mysql_select_db($database_projectsite, $projectsite);
and how do you set the $projectsite

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.