|
INTERVIEW QUESTIONS
PROGRAMMING LANGUAGES
PHP
DETAILS
Question: How To Create a Table?
Answer: If you want to create a table, you can run the CREATE TABLE statement as shown in the following sample script:
<?php include "mysql_connection.php";
$sql = "CREATE TABLE fyi_links (" . " id INTEGER NOT NULL" . ", url VARCHAR(80) NOT NULL" . ", notes VARCHAR(1024)" . ", counts INTEGER" . ", time TIMESTAMP DEFAULT sysdate()" . ")"; if (mysql_query($sql, $con)) { print("Table fyi_links created.
"); } else { print("Table creation failed.
"); }
mysql_close($con); ?>
Remember that mysql_query() returns TRUE/FALSE on CREATE statements. If you run this script, you will get something like this: Table fyi_links created.
|
|
|
Category |
PHP Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 7938 users |
Added on |
10/28/2014 |
Views |
70076 |
Rate it! |
|
|
Question:
How To Create a Table?
Answer:
If you want to create a table, you can run the CREATE TABLE statement as shown in the following sample script:
<?php include "mysql_connection.php";
$sql = "CREATE TABLE fyi_links (" . " id INTEGER NOT NULL" . ", url VARCHAR(80) NOT NULL" . ", notes VARCHAR(1024)" . ", counts INTEGER" . ", time TIMESTAMP DEFAULT sysdate()" . ")"; if (mysql_query($sql, $con)) { print("Table fyi_links created.
"); } else { print("Table creation failed.
"); }
mysql_close($con); ?>
Remember that mysql_query() returns TRUE/FALSE on CREATE statements. If you run this script, you will get something like this: Table fyi_links created. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
What are the different tables present in MySQL? Which type of table is generated when we are creating a table in the following syntax: create table employee(eno int(2),ename varchar(10))?
|
View Answer
|
|
Would I use print "$a dollars" or "{$a} dollars" to print out the amount of dollars in this example?
|
View Answer
|
|
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?
|
View Answer
|
|
How can I execute a PHP script using command line?
|
View Answer
|
|
What is the difference between mysql_fetch_object and mysql_fetch_array?
|
View Answer
|
|
How To Get the Uploaded File Information in the Receiving Script?
|
View Answer
|
|
What is meant by urlencode and urldecode?
|
View Answer
|
|
What are the differences between require and include, include_once?
|
View Answer
|
|
How To Write the FORM Tag Correctly for Uploading Files?
|
View Answer
|
|
How do you define a constant?
|
View Answer
|
|
What does a special set of tags do in PHP?
|
View Answer
|
|
What Is a Persistent Cookie?
|
View Answer
|
|
What is the difference between $message and $$message?
|
View Answer
|
|
How can we repair a MySQL table?
|
View Answer
|
|
How can we know the number of days between two given dates using PHP?
|
View Answer
|
|
What is meant by PEAR in php?
|
View Answer
|
|
What Is a Session?
|
View Answer
|
|
What's PHP?
|
View Answer
|
|
What exactly is validating and sanitizing?
|
View Answer
|
|
What are the different filter functions used to filter a variable?
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All PHP Interview Questions & Answers - Exam Mode /
Learning Mode
|