#!/usr/bin/php stakes_guide[0]->racedate1) ){ echo( "NULL!" ); } if( $mysql_connection ) { foreach( $stakesXML->stakes_guide as $currentStake ){ // 1. Get NID / VID $state_nidvid = $mysql_connection->prepare( $SQL_FindIDs ); if( $mysql_connection->error ){ echo( $mysql_connection->error ); exit(); } $state_nidvid->execute(); $state_nidvid->bind_result( $name, $id ); $state_nidvid->fetch(); $nid = $id + 1; $state_nidvid->fetch(); $vid = $id + 1; $state_nidvid->close(); if( !$nid && !$vid ){ echo( "Could not fetch ids\n" ); exit; } // 2. Insert into NODE $state_createNode = $mysql_connection->prepare( $SQL_InsertNode ); if( $mysql_connection->error ){ echo( $mysql_connection->error ); exit(); } $state_createNode->bind_param( "iis", $nid, $vid, $currentStake->stake_event ); $state_createNode->execute(); if( $state_createNode->affected_rows != 1 ){ echo( "Could not add NODE\n" ); exit; } $state_createNode->close(); // 3. Insert into NODE_REVISIONS $state_createRevision = $mysql_connection->prepare( $SQL_InsertNodeRevision ); if( $mysql_connection->error ){ echo( $mysql_connection->error ); exit(); } $state_createRevision->bind_param( "iisss", $nid, $vid, $currentStake->stake_event, $currentStake->conditions, $currentStake->stake_event ); $state_createRevision->execute(); if( $state_createRevision->affected_rows != 1 ){ echo( "Could not add NODE_REVISION\n" ); exit; } $state_createRevision->close(); // 4. Insert into NODE_COMMENT_STATISTICS $state_createStats = $mysql_connection->prepare( $SQL_InsertNodeStatistics ); if( $mysql_connection->error ){ echo( $mysql_connection->error ); exit(); } $state_createStats->bind_param( "i", $nid ); $state_createStats->execute(); if( $state_createStats->affected_rows != 1 ){ echo( "Could not add NODE_STATISTICS" ); exit; } $state_createStats->close(); // 5. Insert into content_type_stakes_race $state_createCCKNode = $mysql_connection->prepare( $SQL_InsertCCKTableData ); if( $mysql_connection->error ){ echo( $mysql_connection->error ); exit(); } /* DURRRRRR I SWITCH NID/VID. I R SMRT. This is fixed now. */ $state_createCCKNode->bind_param( "ssssssssssssssssssssssssssssssssssssssssssssssss", $vid, $nid, $currentStake->sponsor, $currentStake->eligibility, $currentStake->age_sex_gait, $currentStake->track, $currentStake->added_money, $currentStake->racedate1, $currentStake->raceevent1, $currentStake->racepurse1, $currentStake->racedate2, $currentStake->raceevent2, $currentStake->racepurse2, $currentStake->racedate3, $currentStake->raceevent3, $currentStake->racepurse3, $currentStake->racedate4, $currentStake->raceevent4, $currentStake->racepurse4, $currentStake->racedate5, $currentStake->raceevent5, $currentStake->racepurse5, $currentStake->racedate6, $currentStake->raceevent6, $currentStake->racepurse6, $currentStake->racedate7, $currentStake->raceevent7, $currentStake->racepurse7, $currentStake->racedate8, $currentStake->raceevent8, $currentStake->racepurse8, $currentStake->aged_payments, $currentStake->three_year_old_payments, $currentStake->two_year_old_payments, $currentStake->yearling_payments, $currentStake->weanling_payment, $currentStake->nomination_fee, $currentStake->late_nomination_fee, $currentStake->sustaining_fee_1, $currentStake->sustaining_fee_2, $currentStake->sustaining_fee_3, $currentStake->sustaining_fee_4, $currentStake->supplemental_fee, $currentStake->starting_fee, $currentStake->fee_notes, $currentStake->purse, $currentStake->contact, $currentStake->administration ); $state_createCCKNode->execute(); if( $state_createCCKNode->affected_rows != 1 ){ echo( "Epic Fail Creating CCK Node" ); exit; } $state_createCCKNode->close(); // 6. Update NID / VID in sequences $state_updateSequenceNID = $mysql_connection->prepare( $SQL_UpdateSequenceNID ); if( $mysql_connection->error ){ echo( $mysql_connection->error ); exit(); } $state_updateSequenceNID->bind_param( "i", $nid ); $state_updateSequenceNID->execute(); if( $state_updateSequenceNID->affected_rows != 1 ){ echo( "Sorry boss, cannot update NID in sequences" ); exit; } $state_updateSequenceNID->close(); $state_updateSequenceVID = $mysql_connection->prepare( $SQL_UpdateSequenceVID ); if( $mysql_connection->error ){ echo( $mysql_connection->error ); exit(); } $state_updateSequenceVID->bind_param( "i", $vid ); $state_updateSequenceVID->execute(); if( $state_updateSequenceVID->affected_rows != 1 ){ echo( "Sorry boss, cannot update VID in sequences" ); exit; } $state_updateSequenceVID->close(); } } else { echo( "No database connection." ); }