Jump to content

Recommended Posts

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 error

File not found
Firefox 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 great
thanks
better u follow this code.. this will help u...
<?php
include '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';
?>
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.