Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5531

pmarks906d on "Accessing MySql database from page function"

$
0
0

Hi, Thankyou for your post. I've taken your advice and installed phpmyadmin as described. In the process I also put my code in a php theme file, which interprets PHP code correctly; then i chose that theme for my page. Again, however, everything still works great except when I try to access my MySql database. I have the following code in that theme file. The problem is the function never gets beyond the $wpdb part.

<script>
function registerFunction()
{
elEmailOut = document.getElementById("emailReadId");

// this text box displays the right stuff if $wpdb commented out
elEmailOut.value = "got to here1";

// execution gets here if i comment out the $wpdb stuff

<?php
global $wpdb;
$wpdb->insert('myCustomers',
array( 'FirstName' => 'Fred', 'SecondName' => 'Marks'));
?>

// execution never reaches here.
elEmailOut.value = "got to here2";
/**
// more code here but commented out
*/
}
</script>


Viewing all articles
Browse latest Browse all 5531

Trending Articles