User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 402,787 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,840 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 393 | Replies: 10 | Solved
Reply
Join Date: Feb 2008
Posts: 296
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz in Training

unexpect T_STRING

  #1  
Jul 17th, 2008
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)
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 239
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: unexpect T_STRING

  #2  
Jul 17th, 2008
mysql_query($sql) or die (mysql_error() mysql_errno());
Try this.
  1. mysql_query($sql) or die (mysql_error(). mysql_errno());
Notice the concatenation operator .
Cheers,
Naveen
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Feb 2008
Posts: 296
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz in Training

Re: unexpect T_STRING

  #3  
Jul 18th, 2008
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.
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 239
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: unexpect T_STRING

  #4  
Jul 18th, 2008
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!
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Feb 2008
Posts: 296
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz in Training

Re: unexpect T_STRING

  #5  
Jul 18th, 2008
i am just trying to replicate the error now i will get post my results back in a minute.
Reply With Quote  
Join Date: Feb 2008
Posts: 296
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz in Training

Re: unexpect T_STRING

  #6  
Jul 18th, 2008
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.
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 239
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: unexpect T_STRING

  #7  
Jul 18th, 2008
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.
  1. <?php
  2. $con = mysql_connect("localhost","root");
  3. mysql_select_db("test");
  4.  
  5. $query = "Create user 'naveen'@'localhost' IDENTIFIED BY 'password1'";
  6. mysql_query($query);
  7. $query2 = "GRANT SELECT,INSERT,UPDATE,DELETE ON *.* TO 'naveen'@'localhost'";
  8. mysql_query($query2);
  9.  
  10. mysql_close($con);
  11. echo mysql_connect("localhost","naveen","password1");
  12. ?>
I am sorry! I don't have a link to any good tutorial.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Feb 2008
Posts: 296
Reputation: kevin wood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz in Training

Re: unexpect T_STRING

  #8  
Jul 18th, 2008
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.
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 239
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: unexpect T_STRING

  #9  
Jul 18th, 2008
Yep. It will create a user called "naveen" with password "password1" and grant SELECT,INSERT,UPDATE,DELETE permissions for that user.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 239
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

Re: unexpect T_STRING

  #10  
Jul 18th, 2008
You are welcome!
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MySQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the MySQL Forum

All times are GMT -4. The time now is 10:07 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC