|
|
How To Execute sql file to create table | ||
Discussion by portalku with 18 Replies.
Last Update: January 15, 2010, 4:55 pm ( View Rated (1) ) | |||
![]() |
|
|
Please help me :roll:
How to execute sql file ( e.g nuke.sql ) to create table in mysql data base
I don't have cpanel/PHPmyAdmin.
Whats the comand to execute sql file at my server :?:
my server suport mysql database
Thanks
2. make sure you create a database and remember
a. User name
b. User password
c. Database name you will need these later
**make sure you remeber these because you will need them later**
3. ok , now go to phpadmin and select the database in the blue colomum to the left that you created. select that file .
4. it will bring you to a nav bar that says Structure< SQL< Export< Search <Query
5 click on the SQl tab
now at the bottom of that page you will see asearch bar that says location of text file, l** leave it on auto detect now press browse and then look for the file name nuke.sql in your computer
**You know where that is**
5 then upload and now you have your tables
6. the last step is configuring your php-nuke with your database real easy. go to your directory and look in the php-nuke file config.php and look for this code.
$dbhost='localhost';
$dbuname='database username here';
$dbpass='database password here ';
$dbname='database name';
$prefix = "nuke";
$user_prefix = "nuke";
$dbtype = "MySQL";
if you entered all of those correctly, u should be ok and make sure to redirect your you home file to the php-nuke file
if ll else fails use script libary and install php-nuke from there. thats what i did its real easier.
Have you made sure MySQL is available?
Give more details
the first poster
portalku
CODE
<?php$handle = mysql_connect("host_name", "username", "password");
$db = mysql_select_db("db_name", $handle);
$query = "CREATE TABLE table_name(var1_type var1, var2_type var2, var3_type, var3...)";
$result = mysql_query($query);
?>
That's a simple one. You'll have to modify it.
EDIT: Oh, and that's using PHP. If you don't have PHP, you can use the mysql console, by running "mysql".
my server is using internal control panel, and has no command or tools to manage the database.No PhpAdmin, No Cpanel, No Plesk
and it's make me confused how to create table in MySQL
Is there any command to run SQL file if I wish to create table without using cpanel or phpmyadmin?
Thx Buddy..!
I think your code is work
I make php file with your code, then I upload it, and I run in my browser... Is it correct?
QUOTE
I make php file with your code, then I upload it, and I run in my browser... Is it correct?
Well, you'll have to put all the statements in your SQL file into the query, but yeah, that's right.
I'm incorporating this into a broswer based upload/backup script without using cpanel.... in php
Can i just put
$query = "
all of the sql info - for multiple tables and insertion and updation
";
$result = mysql_query($query);
in one file.
Will $result process all the queries if they are only defined as one big query? - or do i need to set it for each command
Your Code Is Work
Spesial Thanks For CODEFX
QUOTE
In php/mysql i want to create 10 tables and add data to each one, but the file size is still small enough...I'm incorporating this into a broswer based upload/backup script without using cpanel.... in php
Can i just put
$query = "
all of the sql info - for multiple tables and insertion and updation
";
$result = mysql_query($query);
in one file.
Will $result process all the queries if they are only defined as one big query? - or do i need to set it for each command
Oooo-that's a tough one!
It turns out that you cannot execute more than one MySQL query in one mysql_query() function call. However, browsing the notes for the mysql_query function on their website reveals that someone made a function for running multiple queries:
CODE
//$q is the query string ($thesql returned string)//$link is the link to the database connection
//returns true or false depending on whether a single query is executed allows you to check to see if any queries were ran
function multiple_query($q,$link) {
$tok = strtok($q, ";n");
while ($tok) {
$results=mysql_query("$tok",$link);
$tok = strtok(";n");
}
return $results;
}
Okay. I'm going to have to explain a couple of things. First, The variables. As it says in the comments, $q is the query (containing multiple queries) you want to run. $link is the link returned by the mysql_connect function.
You're going to have to change your big query. After each individual query, you need to add a ';'. This is because the function tokenizes (separates) the query using these.
If this doesn't work, or if you have more questions, just post again.
hello every one
I need a php code that can read the data from my localhost data base on phpMyAdmin and make connect to the online data base and write the data there .. Any one can help please
thank every one
-reply by ahmed
This is the first time I have tried to get a website up and running and unfortunately I have people counting on me to make it happen (unlikely) lol...Ok so when I try to login as an admin it doesn't do anything...Just stays there...Also do I need to create a database? I don't understand coding or what to do...Basically I would just really like access to my php admin panel? can you please help I have been killing myself with non stop computer time and getting nowhere.
-reply by khris
Similar Topics:
How To Create Pdf Files Using Free ...
Php Script Like Mysql Ajax Table Ed...
Jtable And Jtextfield Sql Problem...
Where is The Free Tempalate ?? (3)
|
(7) help with my phpBB forum
|
Loading...
HOME 






