affordit Posted January 12, 2008 Share Posted January 12, 2008 Can someone tell me whats wrong with this it inserts into brands and products but not in categories. Heres the code <? include("k_falls_dbinfo2.inc.php"); mysql_connect(mysql,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "INSERT INTO products VALUES ('','$bname','$sphone','$category','$upc','$brand','$model','$description','$extra','$price','$website')"; mysql_query($query); # if the user submitted a CATEGORY if( isset($category) ) { # get the user id $id = mysql_insert_id( ); # and insert the CATEGORY details $query = "INSERT INTO categories VALUES ('','$category')"; } if( isset($brand) ) { # get the user id $id = mysql_insert_id( ); $query = "INSERT INTO brands VALUES ('','$brand')"; $result = mysql_query( $query ); } mysql_free_result( $result ); mysql_close(); // ----------------------------- ?> Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 12, 2008 Share Posted January 12, 2008 Are you getting an error? Quote Link to comment Share on other sites More sharing options...
affordit Posted January 12, 2008 Author Share Posted January 12, 2008 No error just not getting any insert into categories Quote Link to comment Share on other sites More sharing options...
revraz Posted January 12, 2008 Share Posted January 12, 2008 Thats because you don't run the mysql_query command after this line $query = "INSERT INTO categories VALUES ('','$category')"; mysql_query($query); //missing this line Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.