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(); // ----------------------------- ?> Link to comment https://forums.phpfreaks.com/topic/85677-solved-syntex-error-help/ Share on other sites More sharing options...
kenrbnsn Posted January 12, 2008 Share Posted January 12, 2008 Are you getting an error? Link to comment https://forums.phpfreaks.com/topic/85677-solved-syntex-error-help/#findComment-437258 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 Link to comment https://forums.phpfreaks.com/topic/85677-solved-syntex-error-help/#findComment-437261 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 Link to comment https://forums.phpfreaks.com/topic/85677-solved-syntex-error-help/#findComment-437281 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.