Wednesday, December 03, 2008

So:
extract( $_POST );

// build SELECT query
//NOTE: This is where we're throwing an error, somehow. I think.
$query = ("SELECT `firstName`, `lastName` FROM `users` ORDER BY `lastName` DESC");

// Connect to MySQL
if ( !( $database = mysql_connect("localhost", "root") ) )
die( "Could not connect to database " );

// open Products database
if ( !mysql_select_db( "lab6", $database) )
die( "Could not open 'users' database " );

// query Products database
if ( !( $result = mysql_query( $query, $database ) ) )
{
print( "Could not execute query!
" );
die( mysql_error() . "" );
} // end if

mysql_close( $database );
?>

Now, to many of you, this looks like jibberish. Well, my friends, you are not alone. I can interpret it, but it's quite foreign to me as well. My previous error was at the opening of the users database. I was trying to open `users` when in fact I needed lab6; basically the container of the `users` table. Now, I have an error where commented (sent to my prof, because he humors my idiocy). I'll update if/when I figure it out.

No comments: