db query not working as expected

From: Date: Wed, 07 Mar 2007 14:36:10 +0000
Subject: db query not working as expected
Groups: php.general 
Request: Send a blank email to php-general+get-249980@lists.php.net to get a copy of this message
I have this code: mysql_connect ($local_host, $local_user, $local_pass); mysql_select_db ($local_db); mysql_query ("DELETE FROM tmphitsmag"); $result = mysql_query ("SELECT DISTINCT company FROM view_log WHERE company != ''"); if ($row = mysql_fetch_array($result)) {
        do {
                $magazine_path = $row['company'];
                $magazine_path = explode("/", $magazine_path);
                echo str_replace("_", " ", $magazine_path[2]) . "<br>";
                mysql_query ("INSERT INTO tmphitsmag (magazine) VALUES 		                ('$magazine_path[2]')");
        } while($row = mysql_fetch_array($result));
} mysql_close(); The code dumps the first table fine, selects, manipulates, and echoes the string the way I expect, but fails to input the string into the tmphitsmag table. Any ideas? Thanks, Ed

« previous php.general (#249980) next »