Connecting Tech Pros Worldwide Forums | Help | Site Map

Need help with implode function

Newbie
 
Join Date: May 2007
Posts: 3
#1: May 30 '07
I have a set of values that were put into a form and am now using this to put into a database. this is my error:

"Warning: implode() [function.implode]: Bad arguments. in /home/xxxxxx/public_html/login.php on line 177
Couldn't execute insert query."

[PHP]
$today = date("Y-m-d");
$fields_str = implode(",",$fields);
$values_str = implode('","',$values); <=line 177
$fields_str .=",createdate";
$values_str .='"'.",".'"'.$today;
$fields_str .=",password";
$values_str .= '"'.","."md5"."('".$password."')";
$sql = "INSERT INTO member ";
$sql .= "(".$fields_str.")";
$sql .= " VALUES ";
$sql .= "(".'"'.$values_str.")";
$result = mysql_query($sql,$con)
or die("Couldn't execute insert query.");
$_SESSION['auth']="yes";
$_SESSION['logname'] = $loginname;
[/PHP]

Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Posts: 3,752
#2: May 30 '07

re: Need help with implode function


Quote:

Originally Posted by scatfly

$values_str = implode('","',$values); <=line 177

Hi.

Try replacing the '","' with ','
Reply