• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 319
  • Last Modified:

MySQL connection problem

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?
$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

  • 3
1 Solution
seoptiAuthor Commented:
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
Cornelia YoderArtistCommented:
Probably because you need to replace 'username' and 'password' with the REAL username and password to your database.

seoptiAuthor Commented:
This is just an example, of course I have replaced them on the server.
seoptiAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now