refiking Posted June 7, 2007 Author Share Posted June 7, 2007 Here is the other insert code: $store = "INSERT INTO Records(analyst_id , record_id , b_first_name , b_last_name , c_first_name , c_last_name , address, city , state , zip , loan_amount , rate , cap , mo_pay , new_rate , new_mopay , pay_change , change_date , ltv , lender , telephone , ipaddy , timestamp) VALUES('$analyst_id','$record_id','$bfn','$name','$cfn','$cln','$add','$city','$state','$zip','$la','$iir', '$adjc','$mpay','$nr','$nmpay','$change','$cpdate','$ltv','$lender','$tel','$ipaddy','$dun')"; Link to comment https://forums.phpfreaks.com/topic/54515-solved-trouble-calling-from-database/page/2/#findComment-269715 Share on other sites More sharing options...
Yesideez Posted June 7, 2007 Share Posted June 7, 2007 You've got a lot of fields there! Can you check in the `Records` table and check if the records ma123, ma124, and ma125 aren't already there? That could be one reason why the INSERT query is failing. I've had problems with inserting before where I've not been specifying enough fields but I think it depends on how the table is set up but I really am not sure. Link to comment https://forums.phpfreaks.com/topic/54515-solved-trouble-calling-from-database/page/2/#findComment-269718 Share on other sites More sharing options...
refiking Posted June 7, 2007 Author Share Posted June 7, 2007 I only have 2 set up so far. ma1 and ma2. Link to comment https://forums.phpfreaks.com/topic/54515-solved-trouble-calling-from-database/page/2/#findComment-269721 Share on other sites More sharing options...
Yesideez Posted June 7, 2007 Share Posted June 7, 2007 I'm thinking you may have to add more data into that record and not just the analyst_id. From what I can see `analyst_id` is the main index and you're basically adding another record with no data! Link to comment https://forums.phpfreaks.com/topic/54515-solved-trouble-calling-from-database/page/2/#findComment-269724 Share on other sites More sharing options...
refiking Posted June 7, 2007 Author Share Posted June 7, 2007 There are more fields than analyst_id. I think there are 5 in all. Link to comment https://forums.phpfreaks.com/topic/54515-solved-trouble-calling-from-database/page/2/#findComment-269736 Share on other sites More sharing options...
refiking Posted June 7, 2007 Author Share Posted June 7, 2007 bump Link to comment https://forums.phpfreaks.com/topic/54515-solved-trouble-calling-from-database/page/2/#findComment-269972 Share on other sites More sharing options...
refiking Posted June 7, 2007 Author Share Posted June 7, 2007 Got it working now! Here's what I did: $que = mysql_query("SELECT `analyst_id` FROM `Analysts` WHERE username = '$username'"); while($row = mysql_fetch_assoc($que)){ $analyst_id = $row['analyst_id']; echo $analyst_id; } Then, I did this: $store = "INSERT INTO Records(analyst_id , record_id , b_first_name , b_last_name , c_first_name , c_last_name , address, city , state , zip , loan_amount , rate , cap , mo_pay , new_rate , new_mopay , pay_change , change_date , ltv , lender , telephone , ipaddy , timestamp) VALUES('$analyst_id','$record_id','$bfn','$name','$cfn','$cln','$add','$city','$state','$zip','$la','$iir', '$adjc','$mpay','$nr','$nmpay','$change','$cpdate','$ltv','$lender','$tel','$ipaddy','$dun')"; Link to comment https://forums.phpfreaks.com/topic/54515-solved-trouble-calling-from-database/page/2/#findComment-270043 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.