Jump to content

Recommended Posts

look at this example i made yesterday.

 

<?php

$connect_database=mysql_connect("localhost","username","password")
or die("Databse connection problam".mysql_error());

$sql="CREATE DATABASE website_links";
$res=mysql_query($sql)or die(mysql_error());

$sql2="USE website_links";
$res2=mysql_query($sql2)or die(mysql_error());

$sql3="CREATE TABLE link_stats(
stat_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, 
car_stats INT DEFAULT '0' NOT NULL,
van_stats INT DEFAULT '0' NOT NULL,
truck_stats INT DEFAULT '0' NOT NULL
)";

$res3=mysql_query($sql3)or die(mysql_error());


$sql4="INSERT INTO link_stats(car_stats,van_stats,truck_stats) VALUES('1','1','1')";

$res5=mysql_query($sql4)or die(mysql_error());


if($res5){
   
   echo" DATABASE CREATED THANK YOU!";
}

?>

 

 

Maq,

 

      i want to store a new table from local system into phpmyadmin through php code?

 

Sure just do a mysqldump (you can specify a single table).

 

Then, if you have ssh access, you can run this in the command prompt:

 

mysql 

 

If you don't have ssh access let me know, there's another solution.

will help.

 

If you know how to do it with a commandline what's wrong with

exec("mysql < test.sql"); ?

 

http://www.ozerov.de/bigdump.php

 

http://drupal.org/node/43024

 

<?php
// Database configuration

$db_server        = "localhost";
$db_name         = "your_DB_name";
$db_username  = "your_DB_user_name";
$db_password   = "your_DB_password";


// Other Settings

// Specify the dump filename to suppress the file selection dialog
$filename             = "the_file_you_wish_to_execute";    

// Lines to be executed per one import session
$linespersession  = 3000;

// You can specify a sleep time in milliseconds after each session
// Works only if JavaScript is activated. Use to reduce server overrun
$delaypersession = 0;     
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.