Loading...


bookmark - How To Execute sql file to create table

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) )
 
bookmark - How To Execute sql file to create table  
Quickly Post to How To Execute sql file to create table  w/o signup Share Info about How To Execute sql file to create table  using Facebook, Twitter etc. email your friend about How To Execute sql file to create table Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Hi..
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
:D










   Mon Dec 20, 2004    Reply         

1. go to cpanel
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 :D :D :D

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. :D :D

   Mon Dec 20, 2004    Reply         

but auto installation really screws up yr theme if you decide to change the forums theme.....

   Wed Dec 29, 2004    Reply         


hello.....he said he didnt have cpanel.....

   Thu Dec 30, 2004    Reply         

What type of Control Panel have you got on your server then? How do you manage your site?

Have you made sure MySQL is available?

Give more details

   Thu Dec 30, 2004    Reply         

not me
the first poster
portalku

   Thu Dec 30, 2004    Reply         


I wasn't saying ut to you l33

   Thu Dec 30, 2004    Reply         

oh i see...

   Fri Dec 31, 2004    Reply         

Sure Mysql available

   Mon Jan 10, 2005    Reply         

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".

   Mon Jan 10, 2005    Reply         

How.. man ?
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..!

   Mon Jan 10, 2005    Reply         

Thanks CODEFX
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? :D

   Mon Jan 10, 2005    Reply         

Tell you one thing? Why are you hosting your site where you do not have CPanel or PHPMyAdmin? Better host it with some host that offers CPanel. For e.g. - FNH.

   Mon Jan 10, 2005    Reply         

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.

   Tue Jan 11, 2005    Reply         

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

   Sun Jan 16, 2005    Reply         

Thank's For All Of You
Your Code Is Work
:)
Spesial Thanks For CODEFX

   Wed Jan 26, 2005    Reply         

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! :) For that, we go to the PHP manual and their wonderful function reference!

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.

   Wed Jan 26, 2005    Reply         

i need to syncronise between my local host and online data base How To Execute sql file to create table

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

   Thu Jul 30, 2009    Reply         

please help me php nukeHow To Execute sql file to create table

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

 

   Fri Jan 15, 2010    Reply         

Quickly Post to How To Execute sql file to create table  w/o signup Share Info about How To Execute sql file to create table  using Facebook, Twitter etc. email your friend about How To Execute sql file to create table Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Similar Topics:

How To Create Pdf Files Using Free ...

Now, that you don't need to have expensive software like Acrobat to create PDF. All you need is Microsoft Office and a software name doPDF. You can download the freeware from http://www.dopdf.com/download.php After downloading dopdf.exe, ...more

   02-Sep-2008    Reply         

Php Script Like Mysql Ajax Table Ed...

Any recommendation for PHP script like Mysql Ajax Table Editor or MySQL Editor? I prefer a completed free one. ...more

   02-Dec-2010    Reply         

Jtable And Jtextfield Sql Problem...

i have a JTable which data is called form a SQL database when a button is pressed i take some variable from a combobox and a textfield for the SQL query. it works the first time and loads up what i want correctly then when i click a record it should fill some textfields with information this also wo ...more

   20-Oct-2011    Reply         

Where is The Free Tempalate ??    Where is The Free Tempalate ?? (3) (7) help with my phpBB forum   help with my phpBB forum