General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Iron Speed
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old July 4th, 2002, 09:19 AM
JACOBKELL JACOBKELL is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 2 JACOBKELL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question

Someone know where i can download php4 script with functions connect to mysql database like CREATE DATABASE,CREATE TABLE,CREATE FIELD and
IMPORT DATAS.I have mysql manual and php manual with mysql commands,but there is just commands for dos,and i need php scripts.I was found something on net,but all that is for php3,and i need for php4.I have phpmyadmin,but he dont want import text files,he report some error type Errot in LOAD DATA LOCA INTO TABLE cannot found c:\apache\php\4324235rfs.tmp
Something like that type,and he always founding some other tmp file.Can someone show me an example importing text file into database?I need translate my database of arcticles to mysql,i have that in text file.
tnx

Reply With Quote
  #2  
Old July 4th, 2002, 07:45 PM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 589 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Hey Jacob,
Is the text file in the appropriate format? I.e. was it exported from MySQL straight to the text file? If it's in another format from another database, then you will need to make sure that the commands are MySQL specific.

With PHPMyAdmin, that error looks like your tmp_upload_dir in HTTPD.CONF is set incorrectly. Try changing it to another directory and make sure that directory has full access (CHMOD 777).

As for importing a text file into PHP, just read it in using fopen, and you can either do a batch process, passing the whole thing to MySQL_QUERY, or you can delimt the commands with explode(";", $fileContents) and run each one individually.

Message me back if you need PHP code samples.

Reply With Quote
  #3  
Old July 5th, 2002, 09:09 AM
JACOBKELL JACOBKELL is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 2 JACOBKELL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
aa

Well,i dont know in which format text file need to be.Please,show me script like this:
/*
<?php
# Copyright (C) 2000 - 2002 Ben Drushell
# FILE: example.mysql.php3

$TITLE = "PHP MySQL ACCESS"
?>
<HTML>
<HEAD>
<TITLE><?php echo $TITLE ?></TITLE>
</HEAD>
<BODY>
<CENTER><BIG><B>
<?php echo $TITLE ?>
<BR><BR>

<?php

# Open MySQL connection.
# Before you can walk through a doorway, you must first open the door...
if($myDB = mysql_connect("localhost","youruserid","yourpassword",))
{ echo "Connection to MySQL server 'localhost' successful!<br>\n"; }

# "localhost" can be replaced with an IP address or a domain name.
# If your MySQL server is not using the standard MySQL port,
# add a port (example localhost:7777).
# $myDB saves the present connection.

mysql_select_db("yourdatabasename",$myDB);
echo "Database selected<br>\n";

$query = "CREATE TABLE test (";
$query .= "id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,";
$query .= "date DATE);";
if(mysql_query($query,$myDB))
{ echo "Table 'test' created<br>\n"; }

# $query contains the SQL statements that will be executed by MySQL

$query = "INSERT INTO test (id,date) VALUES(NULL,\"";
$query .= date("Y-m-d");
$query .= "\");";
if(mysql_query($query,$myDB))
{ echo "Insert successful<br>\n"; }

# $query contains the SQL statements that will be executed by MySQL

$query = "INSERT INTO test (id,date) VALUES(NULL,\"";
$query .= date("Y-m-d");
$query .= "\");";
if(mysql_query($query,$myDB))
{ echo "Insert successful<br>\n"; }

# NULL is required for the id, because it will be inserted automatically.
# date command formats a date from current time.
# Y indicates a 4-digit year
# m indicates a 2-digit month
# d indicates a 2-digit day

$id = mysql_insert_id();
echo $id . " is the id number.<br>\n";

# mysql_insert_id retrieves the id value generated in the
# sql insert statement.
# For PHP4 compatibility, leave the contents of the mysql_insert_id
# function blank. Adding a database identifier will create an error
# in PHP4.

$query = "SELECT * FROM test;";
$result = mysql_query($query,$myDB);
while($row = mysql_fetch_array($result,1))
{ echo "id = " . $row['id'] . "; date = " . $row['date'] . ";<br>\n"; }

# This is a very basic search/find statement that loops through the
# contents of 'test' table.
# $result stores the query affected instance of the database.
# mysql_fetch_array retrieves a record.
# The "1" option returns an array with real name indexes.
# A "2" option will return an array with number indexes.
# A "3" option will return an array with both real name and number indexes.
# $row stores the array/record.

$query = "UPDATE FROM test SET date = \"1995-01-10\" WHERE id = 1;";
if(mysql_query($query,$myDB))
{ echo "Record updated;<br>\n"; }

$query = "SELECT * FROM test;";
$result = mysql_query($query,$myDB);
while($row = mysql_fetch_array($result,1))
{ echo "id = " . $row['id'] . "; date = " . $row['date'] . ";<br>\n"; }

$query = "DELETE FROM test WHERE id = 1;";
if(mysql_query($query,$myDB))
{ echo "Record deleted<br>\n"; }

$query = "SELECT * FROM test;";
$result = mysql_query($query,$myDB);
while($row = mysql_fetch_array($result,1))
{ echo "id = " . $row['id'] . "; date = " . $row['date'] . ";<br>\n"; }

$query = "DROP TABLE test;";
if(mysql_query($query,$myDB))
{ echo "Table 'test' deleted<br>\n"; }

mysql_close($myDB);
echo "The MySQL database connection is now closed<br>\n";

# After going through a doorway, you close the door after yourself...
# Technically PHP should automatically close the database connection at
# the end of the script, but I like to re-emphasize that the connection
# is being closed.

?>

</B></BIG></CENTER>
</BODY>
</HTML>

*/
That script is written in php3,thats whay is not working.I need that script in php4.Also,in which format is text file for importing?

And,this is example of my database:Table:Names
Number Name Lastname
1 Luke Smith
2 John Hawk
3 Rocky Junior
4 Mike Tyson
5 Jimi Stanic
So,i want import over text file informations.I have 3500 arcitles,so only way is import to database over text file.Manualy importing is impossible.
Tnx

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway