Creating a Database
Posted by: greeneel (69.57.247.---)
Date: February 27, 2006 11:05AM

Hello all,

I am trying to create a database and these few lines in teh begining of my code seems to have problems , my parsing stops at line 5 theirs more to this code but found it fit to just put where the parsing stops:

<?php
$connect = mysql_connect("localhost", "root", ""winking smiley or
die ("Check your server connection."winking smiley;

mysql_create_db("Moviedata"winking smiley
or die(mysql_error());

And keep getting this error:


Fatal error: Call to undefined function mysql_create_db() in c:\wamp\www\createmovie.php on line 5

I am lost as to what im doing wrong, been over the entire code 7 times.
mysql is running according to the wamp panel.

Options: ReplyQuote
Re: Creating a Database
Posted by: Matt (---.try.wideopenwest.com)
Date: February 27, 2006 01:59PM

You could create a database with phpmyadmin. But if you're looking to do it with PHP, try this:



<?php
$connect = mysql_connect("localhost", "root", ""winking smiley or
die ("Check your server connection."winking smiley;

query = "CREATE DATABASE Moviedata";
$result = mysql_query($query);
?>

Options: ReplyQuote
Re: Creating a Database
Posted by: CyberSpatium (---.hsd1.or.comcast.net)
Date: February 28, 2006 02:03PM

use phpmyadmin to create the new database, then use this to access the database.

<?php
$connect = mysql_connect("localhost", "root", ""winking smiley or
die ("Check your server connection."winking smiley;

query = "CREATE DATABASE Moviedata";
$result = mysql_query($query);
?>

Options: ReplyQuote
Re: Creating a Database
Posted by: greeneel (209.59.88.---)
Date: March 01, 2006 09:37AM

Hey guys,


I used phpMyAdmin and created the database moviedata came back to the script and copied and pasted everything CyberSparium wrote, except i put in the password for the root login.
Ran the script and got back this error:
Parse error: syntax error, unexpected '=' in c:\wamp\www\query.php on line 5

I haven`t been playing with php and mysql for a week yet and i can see that this should be working, could it be that im missing something in my conf or php.ini file? forgot to uncomment something?


thanks for all the help

Options: ReplyQuote


Sorry, only registered users may post in this forum.