0

i am trying to set up this db and i am getting a parse error which it says it is on line 24 i cannot see the error. help need

$sql="CREATE TABLE IF NOT EXISTS `merc_users` (
			
			`****` int not null,
			`******` varchar (250) not null,
			`*****` varchar(250) not null,
			`******` varchar(250) not null,
			`*****` varchar(250) not null,
			`******` varchar (250) not null,
			`*******` varchar(250) not null,
			`****` varchar(250) not null,
			`****` varchar(250) not null,
			`******` varchar (250) not null,
			`********` varchar(250) not null,
			`******` int not null
		)";	
		mysql_query($sql) or die (mysql_error() mysql_errno()); (line 24)
2
Contributors
10
Replies
11
Views
9 Years
Discussion Span
Last Post by nav33n
Featured Replies
  • 1

    Yep. It will create a user called "naveen" with password "password1" and grant SELECT,INSERT,UPDATE,DELETE permissions for that user. Read More

0

mysql_query($sql) or die (mysql_error() mysql_errno());

Try this.

mysql_query($sql) or die (mysql_error(). mysql_errno());

Notice the concatenation operator .
Cheers,
Naveen

0

when i didint have the mysql_errno in and just the mysql_error it was saying that the error was on line 15 which was the fourth one down in the table create syntax. i got the tables set up in the end but i had to log on to the control panel to set it up.

0

There is nothing wrong with your create table query. The only thing that I found missing was the dot operator. Do you still have the error ? If yes, you need to post your complete code as I don't see any other errors!

0

i am just trying to replicate the error now i will get post my results back in a minute.

0

is it possible to create a new db on the server with a new user name and password without having to login to the phpmyadmin section on the control panel on the server?

i have had a look around but all the information i have found is already using a user name and passwrod to make the connection. I want to be able to create everything from the beginning. could you point me in the right direction of a good tutorial on this.

0

is it possible to create a new db on the server with a new user name and password without having to login to the phpmyadmin section on the control panel on the server?

You have to create a new user (and grant required permissions) using 'root' credentials.
Eg.

<?php
$con = mysql_connect("localhost","root");
mysql_select_db("test");

$query = "Create user 'naveen'@'localhost' IDENTIFIED BY 'password1'";
mysql_query($query);
$query2 = "GRANT SELECT,INSERT,UPDATE,DELETE ON *.* TO 'naveen'@'localhost'";
mysql_query($query2);

mysql_close($con);
echo mysql_connect("localhost","naveen","password1");
?>

I am sorry! I don't have a link to any good tutorial.

0

thanks for the reply. sorry i took so long to get back i am in the middle of creating a user guide for the email system. so if i run that code and where it says local host could i change that to the host name and it would run as intended.

1

Yep. It will create a user called "naveen" with password "password1" and grant SELECT,INSERT,UPDATE,DELETE permissions for that user.

Votes + Comments
one of the most helpfull people i have come across
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.