Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySql Execute problem!

Status
Not open for further replies.

youthman

Programmer
Apr 28, 2004
49
US
Ok, I have another one . . .

I am trying to work with MySQL for the first time in my life. I have a large database that is all set up, and has data in it. (over 17,000 rows). I can access the database with the select statements, and such, but now I am trying to write an update script. I am starting small with just plugging in values that are generic, and will make the program more complex later, but I can't even get the basic values insterted!!!
The script connects to the database, prepares the statement, but no matter what I do, it stops at the execute command! I have checked it's syntax over and over again, and I just can't figure it out! My primary key is column 'MlsNum'. Here is my code:


Code:
<html>
  <head>
    <title>Page</title>
  </head>
  <body>
use CGI;
use DBI;
$foo = new CGI;

print $foo->header;
print "starting<BR><BR>";

$dbh = DBI->connect('dbi:mysql:redatabase;host=localhost', 'MyUsername', 'MyPassword', {RaiseError => 1, PrintError =>1}) || die "Database connection not made: $DBI::errstr\n";


$sth = $dbh->prepare("INSERT INTO hometest (Acres, AcresDesc, AgentCoList, AgentList, AgentSell, Amenities, Appliances, Architecture, Area, Areas, AuctionDate, AuctionLicense, AuctionManager, AuctionMgrLicense, AuctionTime, AuctionType, BaseDesc, BasementYN, BathsArea, BathsFull, BathsFullBasement, BathsFullMain, BathsFullUpper, BathsHalf, BathsHalfBasement, BathsHalfMain, BathsHalfUpper, BathsTotal, Bed2Dim, Bed2Floors, Bed2Level, Bed2Windows, Bed3Dim, Bed3Floors, Bed3Level, Bed3Windows, Bed4Dim, Bed4Floors, Bed4Level, Bed4Windows, Bed5Dim, Bed5Floors, Bed5Level, Bed5Windows, Beds, BldgNum , BoardLoad, BuildersName, CapRate, City, ClosedDate, ClosingCosts, CoListOtherPhone1, CoListOtherPhone1Type, CoListOtherPhone2, CoListOtherPhone2Type, CoListOtherPhone3, CoListOtherPhone3Type, CommissionDisc, CompBuy, CompletionDate, CompSell, CompVariable, ConstructionStatus, ContactName, ContactName2, ContactPhone, ContactPhone2, ContactType, ContactType2, Contingency, CoolSystem, County, CountyTax, DaysOnMarket, Directions, Disclosures, Documents, DupFlag, EconomicOccupancy, Editor, Equipment, ExpenseActual, ExpenseActualCap, ExpenseCAM, ExpenseCAMSF, ExpenseInsurance, ExpenseInsuranceSF, ExpenseMisc, ExpenseMiscSF, ExpenseStop, ExpireDate, FireplaceDesc, Fireplaces, Foundation, Garage, GarageCap, GarageDesc, geoCodeDate, geoResult, GrossRentMultiplier, HeatSrc, HeatSystem, ImprovementsAllowed, IncomeGrossPotential, IncomeNetOperating, Inspection, Interior, InternetAddress, InternetList, InternetRemarks, Interstate, Investment, Latitude, LeaseAmountSF, LeaseExisting, LeasePriceSF, LeaseProposed, LeaseProposedTerm, LeaseRemainTerm, LeaseTerms, LeaseType, LeaseTypeSold, Legal, LegalTax, Levels, Lifestyles, ListDate, ListOtherPhone1, ListOtherPhone1Type, ListOtherPhone2, ListOtherPhone2Type, ListOtherPhone3, ListOtherPhone3Type, ListPrice, ListPriceChange, ListPriceOrig, ListStatus, ListType, LoanInterestRate, LoanMandatoryFee, LoanMortgageAmount, LoanYears, Location, Longitude, LotInfo, LotNum, LotSize, LotSizeTax, MandFeeInclude, MandFeePaid, MapE, MapN, MapNumEW, MapNumNS, MlsNum, Modified, NewConstruction, NewConstructionDesc, OfficeExtension, OfficeList, OfficeSell, OpenHouseDate, OpenHouseRemarks, OpenHouseTime, OwnershipInterest, PendingDate, PhotoCount, PhotoDate, PhotoInstr, PhysicalOccupancy, PointsBuyer, PointsSeller, Porch, Possession, PossessionCom, PossibleFinance, PresentUse, ProposedUse, PropStatus, PropType, Remarks, RemarksAgent, RemarksCommission, Renovated, Repairs, ReportDetails, ResCondo, RoadAccess, RoadFrontageCom, RoadSurface, RoomBreakfastDim, RoomBreakfastFloors, RoomBreakfastLevel, RoomBreakfastWindows, RoomDiningDesc, RoomDiningDim, RoomDiningFloors, RoomDiningLevel, RoomDiningWindows, RoomFamilyDim, RoomFamilyFloors, RoomFamilyLevel, RoomFamilyWindows, RoomGreatDim, RoomGreatFloors, RoomGreatLevel, RoomGreatWindows, RoomKitchenDim, RoomKitchenFloors, RoomKitchenLevel, RoomKitchenWindows, RoomLivingDim, RoomLivingFloors, RoomLivingLevel, RoomLivingWindows, RoomMasterBedDesc, RoomMasterBedDim, RoomMasterBedFloors, RoomMasterBedLevel, RoomMasterBedWindow, RoomOther1, RoomOther1Dim, RoomOther1Floors, RoomOther1Level, RoomOther1Windows, RoomOther2, RoomOther2Dim, RoomOther2Floors, RoomOther2Level, RoomOther2Windows, RoomOther3, RoomOther3Dim, RoomOther3Floors, RoomOther3Level, RoomOther3Windows, Rooms, SalesPrice, SaleTerms, SchoolDistrict, Section, SellerMotivation, Sewage, Siding, SoldTerms, SolidWaste, SolidWasteTax, Special, SqFtBasement, SqFtBasementLabel, SqFtBasementTax, SqFtMain, SqFtMainUpper, SqFtOptions, SqFtOptionsAmt, SqFtPercent, SqFtPriceMin, SqFtSource, SqFtTotal, SqFtTotalBase, SqFtTotalCalc, SqFtTotalTax, SqFtUpper, State, StreetDir, StreetDirTax, StreetName, StreetNameTax, StreetNum, StreetNumDisplay, StreetNumTax, StreetType, StreetTypeTax, TaxAmount, TaxAmountSemi, TaxAmountSemiTax, TaxAmountTax, TaxExemption, TaxExemptionTax, TaxID, TaxIDMultiple, TaxSqFt, TaxYear, TaxYearPaid, Township, TownshipTax, TownTax, TransType, TransTypeSold, UID, UIDPrp, UtilityOptions, VacancyLoss, WaterHeater, WaterSrc, WithdrawnDate, YearBuilt, YearBuiltTax, Zip4, Zip4Tax, ZipCode, ZipCodeTax, ZoningCom) 
VALUES (
12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 'test5', 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 
)");

print "prepared<BR>";

$sth->execute() || die $foo->header, "EXECUTE ERROR: $DBI::errstr\n\n$!\n";
 print "execute done<BR>";
$sth->finish();
print "finished<BR>";
$dbh->disconnect();


print"<BR><BR><BR>all done!!!!<BR><BR><BR><BR>";

  </body>
</html>


Any help?

The Youthman
 
i am confused by lack of "print"s at beginning & end of script?

did you try the insert from a command line or whatever interactive interface is available?

that looks like the mother of all insert statements. Is there really nothing simpler to test?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top