Re: db query not working

From: Date: Wed, 07 Mar 2007 14:31:24 +0000
Subject: Re: db query not working
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-249979@lists.php.net to get a copy of this message
On 3/7/07, Ed Curtis <e_curtis@homes2see.com> wrote:
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]'");
Look how many ( you have, and how many ) you have that's the problem... try mysql_query ("INSERT INTO tmphitsmag (magazine) VALUES('$magazine_path[2]')"); that should solve the problem Tijnema
       } while($row = mysql_fetch_array($result));
} mysql_close(); It dumps the table fine, works the explode, outputs the string in the echo command the way I expect, but doesn't place the value in tmphitsmag table. Anyone have a clue? Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#249979) next »