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)

Recommended Answers

All 10 Replies

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

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.

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!

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

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.

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.

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.

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

commented: one of the most helpfull people i have come across +1

thanks for the reply you are also a great help

You are welcome!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.