fireice87 Posted January 18, 2007 Share Posted January 18, 2007 Hey im just starting to learn php and mysql im using xampp as my server iv established a connection between php and mysql im trying to create a dataasbe by using php. but i keep getting this errorFile not foundFirefox can't find the file at /C:/xampp/htdocs/<?php echo( $_SERVER['PHP_SELF'] ); ?>.iv taken the code with only the slightest alterations (taken out the username and password) from a tutriol book the problem is the book has plenty of code samples but very little explanation. The code is below:<?php$conn = @mysql_connect("localhost", "root", "") or die( "Sorry - could not connect to MYSQL" );$rsl = @mysql_create_db( $_REQUEST['db'] );$rs2 = @mysql_list_dbs( $conn );for ( $row = o; $row < mysql_num_rows( $rs2 ); $row++ ){ $list .= mysql_tablename( $rs2, $row) . " | "; ?><html><head><title>Create a database</title></head><body><form action = "<?php echo( $_SERVER['PHP_SELF'] ); ?>"method="post">Current database: <?php echo( $list ); ?><hr>Name: <input type = "text" name = "db"><input type = "submit" value = "Create Database"></form></body></html>I know very little about php and cant see whats wrong with this as the book does not explain any help or links to tutorials would be greatthanks Quote Link to comment https://forums.phpfreaks.com/topic/34762-creating-a-mysql-database-with-php-problem/ Share on other sites More sharing options...
bibby Posted January 21, 2007 Share Posted January 21, 2007 are you using that in an [b].html[/b] file, or [b].php[/b] ? It's got nothing to do with your DB. It's a file not found error.Am I reading this right , "[b]/[/b]C:/xampp/htdocs/" ? Whappup with the slash? Quote Link to comment https://forums.phpfreaks.com/topic/34762-creating-a-mysql-database-with-php-problem/#findComment-165511 Share on other sites More sharing options...
dream25 Posted January 22, 2007 Share Posted January 22, 2007 better u follow this code.. this will help u...<?phpinclude 'config.php';include 'opendb.php';$queryFile = 'myquery.txt';$fp = fopen($queryFile, 'r');$query = fread($fp, filesize($queryFile));fclose($fp); $result = mysql_query($query);include 'closedb.php';?> Quote Link to comment https://forums.phpfreaks.com/topic/34762-creating-a-mysql-database-with-php-problem/#findComment-166185 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.