Jump to content

Help with Creating a MySQL table in PHP...


Drags111

Recommended Posts

Hello everyone, I am trying to make a table for my MySQL db. I have the info for creating the table here:

 

CREATE TABLE `members` (
  `user_id` mediumint( NOT NULL auto_increment,
  `username` varchar(25) NOT NULL default '',
  `user_password` varchar(32) NOT NULL default '',
  `user_email` varchar(255) NOT NULL default '',
    PRIMARY KEY  (`user_id`)
) TYPE=MyISAM AUTO_INCREMENT=60 ;

 

How would I go about doing this? Thanks for all suggestions.

Link to comment
https://forums.phpfreaks.com/topic/77066-help-with-creating-a-mysql-table-in-php/
Share on other sites

ok. heres what to do. start a php file.

here are the codes:

 

 

<?php

$database = "yourDB";

$username = "yourUN";

$password = "yourPASS";

 

 

mysql_connect(localhost,$username,$password);

@mysql_select_db($database) or die ( "unable to connect");

$query="CREATE TABLE `members` (

  `user_id` mediumint( 8 ) NOT NULL auto_increment ,

  `username` varchar(25) NOT NULL default ,

  `user_password` varchar(32) NOT NULL default ,

  `user_email` varchar(255) NOT NULL default ,

    PRIMARY KEY  (`user_id`)

) TYPE=MyISAM AUTO_INCREMENT=60 ";

 

?>

and that should do it.

 

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.