?
Solved

MySQL connection problem

Posted on 2009-07-08
4
Medium Priority
?
315 Views
Last Modified: 2013-12-13
For some reason I can't establish a mysql connection using this code.
I'm getting the error load -Incorrect table name ''  in my browser.

What could be the reason?
<?PHP
$DATABASE_SERVER = ':/tmp/mysql.sock';
 
$client_flags = 128; 
 
$dblink = mysql_connect($DATABASE_SERVER, 'username', 'password', FALSE, $client_flags); 
mysql_select_db('usall', $dblink); 
 
$sql = "LOAD DATA LOCAL INFILE 'data/$file' INTO TABLE `$table` FIELDS TERMINATED BY ',' ENCLOSED BY '\"' ESCAPED BY '\\\\' LINES TERMINATED BY '\r\n'(id,company,address,city,state,zip,route,altaddress,altcity,altstate,altzip,altroute,county,telephone,fax,web,lname,fname,title,gender,employees,employeerange,sales,salesrange,sic,category,alphascore,numericscore,squarefootage,pc,area)"; 
 
$result = mysql_query($sql, $dblink) or die("load -" . mysql_error()); 
echo "<h3>Import Completed!</h3><br>	\n"; 
?>

Open in new window

0
Comment
Question by:seopti
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 

Author Comment

by:seopti
ID: 24806105
In my server error.log I'm seeing:

PHP Warning:  mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/htdocs/users/picksoft/picksoft/localheavyconstruction.com/import/importus.php on line 7
0
 
LVL 27

Expert Comment

by:Cornelia Yoder
ID: 24806232
Probably because you need to replace 'username' and 'password' with the REAL username and password to your database.

0
 

Author Comment

by:seopti
ID: 24806309
This is just an example, of course I have replaced them on the server.
0
 

Accepted Solution

by:
seopti earned 0 total points
ID: 24806629
Solved.
0

Featured Post

WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question