Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MySQL connection problem

Posted on 2009-07-08
4
Medium Priority
?
317 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
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

610 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