newb problem

newb problem

am 20.07.2010 18:28:27 von Dennis Skinner

--_1d095eac-9d3f-49f8-a2f9-8f3b7db7cb01_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



=20


Hello I am a new mysql user. Can anyone tell me why this does not create=
a table?
=20
< ?php (the spaces before the question mark are not in the cod=
e)
$dbuser=3D"smeduser"=3B
$dbpassword=3D"xxxxx"=3B
$dbname=3D"smed"=3B
mysql_connect(localhost=2C $dbuser=2C $dbpassword)=3B
mysql_select_db($dbname) or die("unable to select database")=3B
$query=3D"create table patnotes(patid int(9) not null unsigned=2C patnote i=
nt(6) not null unsigned auto_increment=2C
parentid int not null unsigned=2C appuserid varchar(40) not null=2C subject=
varchar(100) not null=2C
body longtext not null)=2C
primary key(patnote)=2C
unique id(patnote)"=3B
mysql_query($query)=3B
mysql_close()=3B
then the closing question mark and carat on this line this doe=
s not build a file and I am wondering what syntax I am missing here =
thanks dennis=20
=20


Hotmail. Get busy. =20
____________________________________________________________ _____
The New Busy is not the old busy. Search=2C chat and e-mail from your inbox=
..
http://www.windowslive.com/campaign/thenewbusy?ocid=3DPID283 26::T:WLMTAGL:O=
N:WL:en-US:WM_HMP:042010_3=

--_1d095eac-9d3f-49f8-a2f9-8f3b7db7cb01_--

Re: newb problem

am 20.07.2010 18:41:27 von mussatto

On Tue, July 20, 2010 09:28, dennis skinner wrote:
>
>
>
>
>
> Hello I am a new mysql user. Can anyone tell me why this does not
> create a table?
>
> < ?php (the spaces before the question mark are not in the
> code)
> $dbuser="smeduser";
> $dbpassword="xxxxx";
> $dbname="smed";
> mysql_connect(localhost, $dbuser, $dbpassword);
> mysql_select_db($dbname) or die("unable to select database");
> $query="create table patnotes(patid int(9) not null unsigned, patnote
> int(6) not null unsigned auto_increment,
> parentid int not null unsigned, appuserid varchar(40) not null, subject
> varchar(100) not null,
> body longtext not null),
> primary key(patnote),
> unique id(patnote)";
> mysql_query($query);
> mysql_close();
> then the closing question mark and carat on this line this
> does not build a file and I am wondering what syntax I am missing here
> thanks dennis
First question:
Does smeduser have table creation privilages in this database?
------
William R. Mussatto
Systems Engineer
http://www.csz.com
909-920-9154


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: newb problem

am 20.07.2010 19:39:57 von Chris W

'unsigned' is part of your data type which must be before the 'not
null' Your closing ) needs to be at the very end. There is no reason t
have the unique id since the primary key is unique.

First you need the column name 'patid' then the data type 'INT UNSIGNED'
then the other column options 'NOT NULL'

You should really use the back tick quotes around your column and table
names. The (9) after int is of no use in a php application since you
will have to do all your output formating in your php code. I have
changed the query to use upper case letters as that is the standard way
queries are written.


CREATE TABLE `patnotes` (
`patid` INT UNSIGNED NOT NULL,
`patnote` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`parentid` INT UNSIGNED NOT NULL ,
`appuserid` VARCHAR(40) NOT NULL,
`subject` VARCHAR(100) NOT NULL,
`body` LONGTEXT NOT NULL,
PRIMARY KEY(`patnote`))


Chris W

dennis skinner wrote:
>
>
>
> Hello I am a new mysql user. Can anyone tell me why this does not create a table?
>
> < ?php (the spaces before the question mark are not in the code)
> $dbuser="smeduser";
> $dbpassword="xxxxx";
> $dbname="smed";
> mysql_connect(localhost, $dbuser, $dbpassword);
> mysql_select_db($dbname) or die("unable to select database");
> $query="create table patnotes(patid int(9) not null unsigned, patnote int(6) not null unsigned auto_increment,
> parentid int not null unsigned, appuserid varchar(40) not null, subject varchar(100) not null,
> body longtext not null),
> primary key(patnote),
> unique id(patnote)";
> mysql_query($query);
> mysql_close();
> then the closing question mark and carat on this line this does not build a file and I am wondering what syntax I am missing here thanks dennis
>
>
>
> Hotmail. Get busy.
> ____________________________________________________________ _____
> The New Busy is not the old busy. Search, chat and e-mail from your inbox.
> http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326 ::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3
>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: newb problem

am 21.07.2010 16:44:24 von jayabharath

--000e0cd59184afa3f7048be6d6be
Content-Type: text/plain; charset=ISO-8859-1

On Tue, Jul 20, 2010 at 9:58 PM, dennis skinner wrote:
>
>
> Hello I am a new mysql user. Can anyone tell me why this does not create
> a table?
>
> < ?php (the spaces before the question mark are not in the
> code)
> $dbuser="smeduser";
> $dbpassword="xxxxx";
> $dbname="smed";
> mysql_connect(localhost, $dbuser, $dbpassword);
> mysql_select_db($dbname) or die("unable to select database");
> $query="create table patnotes(patid int(9) not null unsigned, patnote
> int(6) not null unsigned auto_increment,
> parentid int not null unsigned, appuserid varchar(40) not null, subject
> varchar(100) not null,
> * body longtext not null),*
> primary key(patnote),
> unique id(patnote)";
> mysql_query($query);
> mysql_close();
> then the closing question mark and carat on this line this
> does not build a file and I am wondering what syntax I am missing here
> thanks dennis
>

In the above at the field "body" you have a close paranthesis, but I
couldn't find a open paranthesis anywhere. I had highlighted the field
above, pls check.

Regards,
Jay
MySQL DBA,
Datavail Corp.

--000e0cd59184afa3f7048be6d6be--