Call to a member function prepare() on null
-
Attempting to prepare a previously working insert statement. The error is on line 42 reporting a null on $query. The echo query and Values are not null, but print_r($link) fails, altho the link was successful initially.
<?php $link = mysqli_connect("localhost", "hsysgrpc_WPHZU", "xxxxxxxx, "xxxxxxxx"); print_r($Link); if(!$link) { die ("ERROR: Could not connect. " . mysqli_connect_error() ); } echo "Connected successfully"; $ID = $_POST['ID']; print_r($ID); $Title = $_POST['Title']; print_r($Title); $FirstName = $_POST['FirstName']; print_r($FirstName); $LastName = $_POST['LastName']; print_r($LastName); $Address1 = $_POST['Address1']; print_r($Address1); $City = $_POST['City']; print_r($City); $State = $_POST['State']; print_r($State); $Zip = $_POST['Zip']; print_r($Zip); $HomePhone = $_POST['HomePhone']; print_r($HomePhone); $CellPhone = $_POST['CellPhone']; print_r($CellPhone); $Email = $_POST['Email']; print_r($Email); $College1 = $_POST['College1']; print_r($College1); $College2 = $_POST['College2']; print_r($College2); $College3 = $_POST['College3']; print_r($College3); global $wpdb; //$wpdb->show_errors(true); $query = "INSERT INTO AAUW_Members (ID, FirstName, LastName, Address1, City, State, Zip) Values (%s, %s, %s, %s, %s, %s, %s )"; echo "$query"; print_r ($link); echo "$ID"; echo "$FirstName"; echo "$LastName"; echo "$Address1"; echo "$City"; echo "$State"; echo "$Zip"; $prepare_query = $wpdb->prepare($query, $ID, $FirstName, $LastName, $Address1, $City, $State, $Zip); $result=$wpdb->query($prepare_query); print_r($result); ?>
The page I need help with: [log in to see the link]
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Call to a member function prepare() on null’ is closed to new replies.