Hello all,

I am very new to php, in fact, this is my first attempt at a script.  I have
just been following a tutorial online.  Currently, I have a page where the
user types in a username and password, I then pass those parameters to this
page.  This page connects to a main db, looks up their username and password
and then attempts to switch them to their own db but that doesn't seem to
work.  When the page loads, I get errors because of my last select.  It
tells me that the database users does not have a table grades which is true
but I wanted it to change to the grades db.  How can I fix this?

Also-is there a way in php to display the results of a query into an
editable grid?


  <title>PHP Test</title>
<body bgcolor="white">

// connect to db
 if (!$dbcnx) {echo ("<p>Unable to connect to the database server at this

  // use the users db
 mysql_select_db("users", $dbcnx);
  if (! @mysql_select_db("users"))
      { echo ("Unable to connect to the main db at this");

  $result=@mysql_query("Select dbname from users where pword='$password' and
   // if (!$result) {
   //                echo("<p>Error performing query: " . mysql_error() .
   //                     "</p>");
   //                exit();
   //               }


 $result=@mysql_query("Select subject, grade from grades");
    if (!$result) {
                   echo("<p>Error performing query: " . mysql_error() .
while ( $row = mysql_fetch_array($result) ) {
echo("<p>" . $row["Grades"] . "</p>");


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to