<html> <head> <title>Edit Data</title> </head> <?php // including the database connection file include "mysql.php"; $connection = new createCon(); $connection->connect(); session_start(); //getting id from url if (isset($_GET['nid'])) { $nid = $_GET['nid']; } else { echo "nid nicht gesetzt"; } $abfrage = "SELECT * FROM nahrung WHERE n_id='{$nid}'"; //selecting data associated with this particular id $result = mysqli_query($connection->myconn, $abfrage); while ($row = mysqli_fetch_array($result)) { $bez = $row['bez']; $menge = $row['menge']; $kalorien = $row['kalorien'] / $menge; $eiweiss = $row['eiweiss'] / $menge; $kohlenhydrate = $row['kohlenhydrate'] / $menge; $fett = $row['fett'] / $menge; }
<?php include 'connect.php'; // Database Connection //$host="ftp.imoucf.org"; //$uname="*****@*****.**"; //$pass="******"; //$database = "imoucfor_mrs"; $conn = new createCon(); //echo $conn->host; $conn->connect(); $link = $conn->conn; //mysql_connect($host,$uname,$pass); //echo mysql_error(); //or die("Database Connection Failed"); $selectdb = mysqli_select_db($link, $conn->db) or die("Database could not be selected"); $result = mysqli_select_db($link, $conn->db) or die("database cannot be selected <br>"); $output = ""; $table = "SUM15"; $sql = mysqli_query($link, "select * from {$table}"); $columns_total = mysqli_num_fields($sql); // Get fields for ($i = 0; $i < $columns_total; $i++) { $heading = mysqli_fetch_field_direct($sql, $i); $output .= '"' . $heading->name . '",'; } $output .= "\n"; // Get records while ($row = mysqli_fetch_array($sql)) { for ($i = 0; $i < $columns_total; $i++) { $output .= '"' . $row["{$i}"] . '",';