vendredi 11 mars 2016

WordPress Plugin with SQL

I have two separate pieces of code here which I am trying to combine.

//$servername = "****";
//$username = "****";
//$password = "****";
//$dbname = "****";



// Create connection
//$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
//if ($conn->connect_error) {
    //die("Connection failed: " . $conn->connect_error);
//} 

//$sql = "SELECT sid, age, address, postcode FROM bTable";
//$result = $conn->query($sql);

//if ($result->num_rows > 0) {
// output data of each row
//while($row = $result->fetch_assoc()) {
    //echo " - Name: " . $row["age"]. " " . $row["sid"]."" .                   $row["address"]."" . $row["postcode"]. "<br>";
 //}
//} else {
//echo "No results to show";
//}
//$conn->close();

Now this works fine and returns information from my database but I need it in this form.

What I need is the information I receive from the database to be printed into a form on my wordpress plugin, you would search sid as the primary key which brings forward the rest of the information (address etc) of each individual to which you can edit and send the information back to the database using the same form. I did try to put more code that I tried but it wouldn't show up properly, any help would be appreciated!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire