Jump to content

Creating a MySQL Table problem


phemi

Recommended Posts

Hi everyone,

please am a newbie in PHP and am trying to create a table in MySQL Database, but everytime i try creating this table i have this Error code :

 

Sorry, Table could not be createdYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARCHA(30), Surname VARCHA(30), ' at line 4

 

andd here is the code itself.

<?php

                          mysql_connect("localhost","","") or die("<strong> Hello, there is an error connecting to database

                          </strong><br />" . mysql_error());

                                   

                          mysql_query("CREATE DATABASE igs_results")

                                      or die("<strong>Sorry, Error connecting to Database</strong>". mysql_error());

                                                    mysql_select_db("igs_results");

                              mysql_query("CREATE TABLE grade2_result(

 

                                    result_id INT NOT NULL AUTO_INCREMENT,

                                          PRIMARY KEY(result_id),

                                          Firstname VARCHA(30),

                                          Surname VARCHA(30),

                                          Age INT

                                          )");

                            die

                            ("Sorry, Table could not be created" . mysql_error());

                                                        ?>

 

Please can anyone tell me where am wrong.

 

Thanks so much.

Link to comment
https://forums.phpfreaks.com/topic/138900-creating-a-mysql-table-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.