Solved

MySQL connection problem

Posted on 2009-07-08
4
303 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
  • 3
4 Comments
 

Author Comment

by:seopti
Comment Utility
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:yodercm
Comment Utility
Probably because you need to replace 'username' and 'password' with the REAL username and password to your database.

0
 

Author Comment

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

Accepted Solution

by:
seopti earned 0 total points
Comment Utility
Solved.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now