473,396 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

creating a table via mysql

I have this:
$mysql_link = mysql_connect($hostname, $username, $password);
mysql_select_db($databasename);
$create = "CREATE TABLE 'photosgigs' ('id' INT(4) NOT NULL AUTO_INCREMENT,
'table_gal' VARCHAR(100) NOT NULL, 'gallery' VARCHAR(100) NOT NULL, PRIMARY
KEY ('id'))";
mysql_query($create,$mysql_link) or die(failed);

with $hostname, $username & $password set.

This won't create a table, can you give me any ideas y?
Thanks

--
Kathryn (Fire Juggler)
http://www.firejugglers.34sp.com
http://www.cornwalljugglers.co.uk
Jul 17 '05 #1
2 1215
>$mysql_link = mysql_connect($hostname, $username, $password);
mysql_select_db($databasename);
$create = "CREATE TABLE 'photosgigs' ('id' INT(4) NOT NULL AUTO_INCREMENT,
'table_gal' VARCHAR(100) NOT NULL, 'gallery' VARCHAR(100) NOT NULL, PRIMARY
KEY ('id'))";
mysql_query($create,$mysql_link) or die(failed);

with $hostname, $username & $password set.

This won't create a table, can you give me any ideas y?


Use print mysql_error() to find out why.

My guess is that the quotes should be backquotes. Look at the error
message to be sure. You also might not have sufficient privileges
to create tables.

Gordon L. Burditt
Jul 17 '05 #2
Fire Juggler wrote:
I have this:
$mysql_link = mysql_connect($hostname, $username, $password);
mysql_select_db($databasename);
$create = "CREATE TABLE 'photosgigs' ('id' INT(4) NOT NULL AUTO_INCREMENT,
'table_gal' VARCHAR(100) NOT NULL, 'gallery' VARCHAR(100) NOT NULL, PRIMARY
KEY ('id'))";
mysql_query($create,$mysql_link) or die(failed);


Giving you have sufficient privileges to create the table, I'd
completely remove the single quotes.

I think you also need to provide default values for both table_gal
and gallery since you are declaring them "not null".

/Marcin

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Joshua Beall | last post by:
Hi All, I am working on a registration system, and one of the things I am going to need to be able to do it setup the database tables for each event that I have registration for. Normally I...
0
by: Michael Iatauro | last post by:
I've been having a little trouble creating users cross-platform. I have a little script that works just fine on Solaris 8 using this command: eval "/path/to/mysql --user=root --password=*****...
0
by: azamka | last post by:
Hi everyone, I am trying to create tables with type innodb. I created a database and all the tables of type ISAM. Now I am at the point of making relations and establish refrential integrity....
2
by: David Heller | last post by:
I have this schema I exported from a database running mysql version 4.01 I'm trying to create this table on a server running mysql 3.23 I keep getting a syntax error near line 11 (I added the line...
2
by: Ian Davies | last post by:
I have created a database with about 17 tables. I have been creating foreign keys some of which have worked but when creating others I get the message below ************************* 1005...
17
Motoma
by: Motoma | last post by:
This article is cross posted from my personal blog. You can find the original article, in all its splendor, at http://motomastyle.com/creating-a-mysql-data-abstraction-layer-in-php/. Introduction:...
2
by: Thufir | last post by:
I'm working from <http://www.oracle.com/technology/pub/articles/haefel- oracle-ruby.html>, would like to adapt the SQL for MySQL, please. Yes, I know, that's oracle wheras I'm using MySQL. This...
4
by: mramsay | last post by:
Hi, I'm having a real problem creating a dynamic hyperlink for my website. I want to pull the field name from mysql table. Field name is description. I would like this to be a hyperlink on my...
9
by: AmiMitra | last post by:
i am using mysql 5.1. i have one table named as resv_record. the format is create table resv_record ( book enum('h','c','r','f','t') , resv_id int(8) auto_increment not null , user_id varchar(12)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.