Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to Create table in mysql5

Posted on 2008-10-17
3
Medium Priority
?
552 Views
Last Modified: 2013-12-13
i m developing a login page with the combination of php and mysql, how i can create a table which stores usernames and password and other informations ?
0
Comment
Question by:cbpandya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 13

Accepted Solution

by:
marchent earned 1000 total points
ID: 22740851
http://sql-info.de/mysql/examples/CREATE-TABLE-examples.html
http://www.tizag.com/mysqlTutorial/mysqltables.php
create table info(
    username varchar(255) not null,
    password varchar(255) not null,
    firstname varchar(2255) not null,
    primary key(username)
);

Open in new window

0
 
LVL 8

Expert Comment

by:MatthiasVance
ID: 22740863
I hope this helps you.

Kind regards,

Matthias Vance
<?php
	// Connect to DB server
	$connection = mysql_connect(DB_HOST, DB_USER, DB_PASS);
	// Select database
	mysql_select_db("ee_test");
	// Initialize query
	$query = "CREATE TABLE `ee_test`.`users` ("
	$query .= "  `username` VARCHAR(255) NOT NULL,"
	$query .= "  `password` VARCHAR(32) NOT NULL,"
	$query .= "  `fullname` VARCHAR(255) NOT NULL,"
	$query .= "  `country` VARCHAR(255) NOT NULL,"
	$query .= "  PRIMARY KEY (`username`)"
	$query .= ")"
	$query .= "ENGINE = InnoDB;"
	// Execute query
	mysql_query($query, $connection);
	// Insert something to our newly created table
	$query = "INSERT INTO `ee_test`.`users` VALUES('mvance', MD5(test), 'Matthias Vance', 'N/A');"
	mysql_query($query, $connection);
?>

Open in new window

0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
The viewer will learn how to count occurrences of each item in an array.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question