Hello, i am new to php so be prepared for a idiots
question,Hello, Do i need to run this on my localhost or can i run
it on my virtual server as this allready has php mysql etc
installed.
i am new to php so be prepared for a idiots question, i have
been trying to copy a youtube tutorial to create a navbar using php
mysql and dreamweaver "
http://www.youtube.com/watch?v=habZHcnShfs"
to do this i need to create a mysql tabel in dreamweaver, to do
this i have been useing the following code;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$user="james1892";
$password="14011991";
$database="naviagation";
mysql_connect("localhost",$user,$password);
@MySQL_select_db($database) or die("unable to select
database");
$query = 'CREATE TABLE 'menu' (
'mid' TINYINT( 3 ) UNSIGNED NOT NULL AUTO_INCREMENT,
'name' varchar(20) NOT NULL
'link' varchar(100) NOT NULL,
PRIMARY KEY ( 'mid' )
)';
mysql_query($query);
mysql_close();
?>
</body>
</html>
this then returns the following message "Parse error: syntax
error, unexpected T_STRING in
/var/www/vhosts/sickstudentgames.com/httpdocs/php attempt 1/first
database midnamelink.php on line 15"
i then gave up on thsi as i couldnt work out what was the
problem and started a new code to create a database using this code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$con = mysql_connect("localhost","com1892","14011991");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}if (mysql_query("CREATE DATABASE my_db",$con))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
}mysql_close($con);
?>
</body>
</html>
this then showed the folling message "Warning:
mysql_connect(): Access denied for user 'com1892'@'localhost'
(using password: YES) in
/var/www/vhosts/sickstudentgames.com/httpdocs/php attempt
1/tableattempt2.php on line 10
Could not connect: Access denied for user
'com1892'@'localhost' (using password: YES)"
i have been uploading these to my website server as this has
php and mysql installed could this be the problem do i need to run
it on the coputers localhost>?
any help greatly appriciated
thanks you
i have been trying to copy a youtube tutorial to create a
navbar using php mysql and dreamweaver "
http://www.youtube.com/watch?v=habZHcnShfs"
to do this i need to create a mysql tabel in dreamweaver, to do
this i have been useing the following code;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$user="james1892";
$password="14011991";
$database="naviagation";
mysql_connect("localhost",$user,$password);
@MySQL_select_db($database) or die("unable to select
database");
$query = 'CREATE TABLE 'menu' (
'mid' TINYINT( 3 ) UNSIGNED NOT NULL AUTO_INCREMENT,
'name' varchar(20) NOT NULL
'link' varchar(100) NOT NULL,
PRIMARY KEY ( 'mid' )
)';
mysql_query($query);
mysql_close();
?>
</body>
</html>
this then returns the following message "Parse error: syntax
error, unexpected T_STRING in
/var/www/vhosts/sickstudentgames.com/httpdocs/php attempt 1/first
database midnamelink.php on line 15"
i then gave up on thsi as i couldnt work out what was the
problem and started a new code to create a database using this code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$con = mysql_connect("localhost","com1892","14011991");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}if (mysql_query("CREATE DATABASE my_db",$con))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
}mysql_close($con);
?>
</body>
</html>
this then showed the folling message "Warning:
mysql_connect(): Access denied for user 'com1892'@'localhost'
(using password: YES) in
/var/www/vhosts/sickstudentgames.com/httpdocs/php attempt
1/tableattempt2.php on line 10
Could not connect: Access denied for user
'com1892'@'localhost' (using password: YES)"
any help greatly appriciated
thanks you