Welcome Guest, Not a member yet? Register   Sign In
Mysql insert not working properly
#4

[eluser]vitoco[/eluser]
Adding quotes to an array when imploding

Code:
$sql  = "INSERT INTO `product_category` (`prduct_id`, `category_id`) VALUES " ;

foreach( $array as $row )
{
    $sql .= "('".implode("','" , $row )."')," ;
}

// REMOVE LAST ","

$sql = trim( $sql , ',' ) ;

Saludos


Messages In This Thread
Mysql insert not working properly - by El Forum - 08-08-2012, 11:46 AM
Mysql insert not working properly - by El Forum - 08-08-2012, 12:24 PM
Mysql insert not working properly - by El Forum - 08-09-2012, 05:10 AM
Mysql insert not working properly - by El Forum - 08-09-2012, 06:27 AM
Mysql insert not working properly - by El Forum - 08-09-2012, 07:18 AM
Mysql insert not working properly - by El Forum - 08-09-2012, 08:24 AM
Mysql insert not working properly - by El Forum - 08-09-2012, 08:45 AM
Mysql insert not working properly - by El Forum - 08-09-2012, 08:48 AM
Mysql insert not working properly - by El Forum - 08-09-2012, 08:52 AM
Mysql insert not working properly - by El Forum - 08-09-2012, 08:54 AM
Mysql insert not working properly - by El Forum - 08-09-2012, 09:14 AM
Mysql insert not working properly - by El Forum - 08-09-2012, 09:22 AM
Mysql insert not working properly - by El Forum - 08-09-2012, 09:23 AM
Mysql insert not working properly - by El Forum - 08-09-2012, 09:26 AM
Mysql insert not working properly - by El Forum - 08-09-2012, 09:30 AM
Mysql insert not working properly - by El Forum - 08-09-2012, 09:31 AM
Mysql insert not working properly - by El Forum - 08-09-2012, 09:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB