I've setup a new iis server to develop php/mysql apps and I'm having nothing but problems with it. I've been coding php for years and now I'm getting errors all over the place and I'm assuming it's configurations SOMEWHERE. Can anyone help me sort this out
I use this function
function copyRow($rowID,$frTblName, $toTblName="",$chngArr=""){
if(!$toTblName) $toTblName = $frTblName; #copy to the same table
$tblColArr = actualColumns($frTblName);
$i=1;
foreach($tblColArr as $colName){
if($colName!="id"){
$copyVal = data($frTblName,$rowID,$colName);
if($chngArr["$colName"]){
$copyVal = $chngArr["$colName"]["value"];
}
if($i!=1){
$sql1 = $sql1.",";
$sql2 = $sql2.",";
}
$sql1 = $sql1."`$colName`";
$sql2 = $sql2."'".addslashes($copyVal)."'";
$i++;
}
}
$sql = "insert into `".TABLE_PREFIX."$toTblName` ($sql1) VALUES ($sql2)<BR>";
return $sql;
}
to create this insert query:
insert into sb_field_controls (id,tblID,fieldName,fieldType,sortOrder,req,question,answer) VALUES ('NULL','9','name','1','1','0','Project Name','40')
$qry = copyRow( etc );
mysql_query($qry)
but then fails to insert the row and gives me a mysql syntax error. When I copied the query in to phpMyAdmin it adds the row, no problem. What's the deal here? Is this a mysql config issue? Should I be on mysqlbuilder.com ????
also, in the past when I would add a row with a missing value it would just insert the default value for that column. Here's what I mean
insert into sb_tbl_controls (name,date,status) values ('new project','1148948222','');
but now it won't accept it. I get a syntax error from mysql_error().
It's php 5 & mysql server 5.0
Is there an easy installer for both mysql & php that I should try instead of the manual install I did. Any help is appreciated....thanx