Creating wpDataTables from serialized PHP array
-
I followed all step for “Creating wpDataTables from serialized PHP arrayp”
when I run my below listed code I do see serialized data on browser and I then pasted the same link to the plugin configuration page. save it. but I see 0 data on preview after save on wpdatatable plug-in page. why am I not getting any data populated?
what am I doing wrong? Please help me so I can validate my proof of concept and then buy the full version.
<?php $sqlForManuScript = new mysqli ( 'localhost', 'databaseroot', 'password', 'test' ); if (! $sqlForManuScript) { echo "Error: Unable to connect to MySQL." . PHP_EOL; echo "Debugging errno: " . mysqli_connect_errno () . PHP_EOL; echo "Debugging error: " . mysqli_connect_error () . PHP_EOL; exit (); } else { echo "Success: A proper connection to MySQL was made! The my_db database is great." . PHP_EOL; echo "Host information: " . mysqli_get_host_info ( $sqlForManuScript ) . PHP_EOL; } $result = $sqlForManuScript->query ( "SELECT Sr_No, bookname, category, Total_Pages FROM catalog LIMIT 200" ); $new_array [] = array (); // Initializing the array that will be used for the table while ( $row = $result->fetch_assoc () ) { // Filling in the new array entry $new_array[]= ['Sr_No' => $row['Sr_No'], 'bookname' => $row ['bookname'], 'category' => $row ['category'], 'Total_Pages' => $row ['Total_Pages']]; } $sqlForManuScript->close (); $serializedArray = serialize ( $new_array ); echo $serializedArray; ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Creating wpDataTables from serialized PHP array’ is closed to new replies.