simple problem :|
Posted: Thu Jun 28, 2007 4:20 am
i've done this before but now it doesn't work, so i'm puzzled why..
i'm using:
-mysql server 5.0.41 on localhost:3306
-php 5.2.3
-apache 2.2 on localhost:12380
i've tried debugged PHP code, but i do not know how ;o
and mysqld-debug gives me nothing - so i presume i'm getting no connection to mysqld?
it seems to stop at "
$con = mysql_connect('localhost','root','passwd') or die(mysql_error()); "
but i get NO error whatsoever, so i don't know where to begin :S
i'm using:
-mysql server 5.0.41 on localhost:3306
-php 5.2.3
-apache 2.2 on localhost:12380
Code: Select all
<?php
error_reporting(E_ALL);
$con = mysql_connect('localhost','root','passwd') or die(mysql_error());
mysql_select_db('twvr') or die(mysql_error());
$lines = gzfile('file.txt.gz');
if(!is_array($lines)) die("File could not be opened");
foreach($lines as $line) {
list($id, $name,$stuff) = explode(',', $line);
$name = urldecode($name);
$name = addslashes($name);
mysql_query("INSERT INTO village(ID,name,stuff) VALUES('$id','$name','$stuff')",$con);
}
mysql_close($con);
?>and mysqld-debug gives me nothing - so i presume i'm getting no connection to mysqld?
it seems to stop at "
$con = mysql_connect('localhost','root','passwd') or die(mysql_error()); "
but i get NO error whatsoever, so i don't know where to begin :S