Am replacing straight sql with wpdb functions. Code works up to the global $wpdb; then nothing.`
$sql = “SELECT ID, Title, FirstName,LastName, Address1, City, State, Zip, HomePhone, CellPhone, Email, “;
$sql .= ” College1, College2, College3, Birth_Day, Birth_Day, Birth_Month, Mem_Type, Honorary, Joined_Local, “;
$sql .= “Joined_Natl, Mailings “;
$sql .= “FROM AAUW_Archived WHERE ID = ‘$ID’ “;
echo $sql, ‘<br>’;
$retrieve_data = mysqli_query($link, $sql);
if (mysqli_num_rows($retrieve_data) > 0)
{ while($row = mysqli_fetch_array($retrieve_data)) {
echo “ID: ” . $row[“ID”]. “<br>”;
echo “Title: ” . $row[“Title”] . “<br>”;
echo “FirstName: ” . $row[“FirstName”] . “<br>”;
echo “LastName: ” . $row[“LastName”] . “<br>”;
echo “Address1: ” . $row[“Address1”] . “<br>”;
echo “City: ” . $row[“City”] . “<br>”;
echo “State: ” . $row[“State”] . “<br>”;
echo “Zip: ” . $row[“Zip”] . “<br>”;
echo “HomePhone: ” . $row[“HomePhone”] . “<br>”;
echo “CellPhone: ” . $row[“CellPhone”] . “<br>”;
echo “Email: ” . $row[“Email”] . “<br>”;
echo “College1: ” . $row[“College1”] . “<br>”;
echo “College2: ” . $row[“College2”] . “<br>”;
echo “College3: ” . $row[“College3”] . “<br>”;
echo “Birth_Day: ” . $row[“Birth_Day”] . “<br>”;
echo “Birth_Month: ” . $row[“Birth_Month”] . “<br>”;
echo “Mem_Type: ” . $row[“Mem_Type”] . “<br>”;
echo “Honorary: ” . $row[“Honorary”] . “<br>”;
echo “Joined_Local: ” . $row[“Joined_Local”] . “<br>”;
echo “Joined_Natl: ” . $row[“Joined_Natl”] . “<br>”;
echo “Mailings: ” . $row[“Mailings”] . “<br>”;
$ID = $row[‘ID’];
$Title = $row[‘Title’];
$FirstName = $row[‘FirstName’];
$LastName = $row[‘LastName’];
$Address1 = $row[‘Address1’];
$City = $row[‘City’];
$State = $row[‘State’];
$Zip = $row[‘Zip’];
$HomePhone = $row[‘HomePhone’];
$CellPhone = $row[‘CellPhone’];
$Email = $row[‘Email’];
$College1 = $row[‘College1’];
$College2 = $row[‘College2’];
$College3 = $row[‘College3’];
$Birth_Day = $row[‘Birth_Day’];
$Birth_Month = $row[‘Birth_Month’];
$Mem_Type = $row[‘Mem_Type’];
$Honorary = $row[‘Honorary’];
$Joined_Local = $row[‘Joined_Local’];
$Joined_Natl = $row[‘Joined_Natl’];
$Mailings = $row[‘Mailings’];
echo “Variables”;
} // while mysqli_fetch…retrieve_data
} else { // else of retrieve_data > 0
echo “0 results”;
}
} // else of while mysqli_fetch…query
// Sql to Insert into AAUW_Members using wpdb
echo $ID;
echo $Title;
echo $FirstName;
global $wpdb;
$wpdb->show_errors(true);
$query2 = “INSERT INTO AAUW_Members ( ID, Title, FirstName, LastName, Address1, City, State, Zip, HomePhone, CellPhone, Email,
College1, College2, College3, Birth_Day, Birth_Month, Mem_Type, Honorary, Joined_Local,Joined_Natl, Mailings)
Values (%d, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)” ;
$prepare_query = $wpdb->prepare($query2, $ID, $Title, $FirstName, $LastName, $Address1, $City, $State, $Zip, $HomePhone, $CellPhone, $Email,
$College1, $College2, $College3, $Birth_Day, $Birth_Month, $Mem_Type, $Honorary, $Joined_Local, $Joined_Natl, $Mailings);
$result = $wpdb->query($prepare_query);
echo print_r($wpdb);
} // else of count == 0
} //Close isset search
`