What i want to do is to insert a data in my column "Score" but not from a row cuz not included in my phpmyadmin table.
Actually this data is an addtion of 5 previous column, and i make the addition whit a query mysql.
Here is my table :
Here is my code :
<?php
// Include config file
require_once 'configgate.php';
$bdd=new PDO('mysql:host=localhost;dbname=cmadatabase','root','@Rugby3390');
$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$reponse= $bdd->query('SELECT `ID`,`Level`,`Typ`,`Occurrence`,`Supplier`,`Consequences`,
SUM((/*0.5**/`Level`)+/*0.5**/`Typ`+/*0.5**/`Occurrence`+/*0.5**/`Supplier`+/*0.5**/`Consequences`) AS sommeLTOSC
FROM `andgate`
GROUP BY `ID`,`Level`,`Typ`,`Occurrence`,`Supplier`,`Consequences`
ORDER BY sommeLTOSC DESC');
while ($donnees = $reponse->fetch()){
//echo $donnees['sommeLTOSC'].'<p>';
}
// Attempt select query execution
$sql = "SELECT * FROM andgate";
if($result = $mysqli->query($sql)){
if($result->num_rows > 0){
echo "<table class='table table-bordered table-striped'>";
echo "<thead>";
echo "<tr>";
echo "<th>ID</th>";
echo "<th>IR</th>";
echo "<th>Level</th>";
echo "<th>Type</th>";
echo "<th>Occurrence</th>";
echo "<th>Supplier</th>";
echo "<th>Consequences</th>";
echo "<th>Candidate TBA</th>";
echo "<th>Engineer Judgment</th>";
echo "<th>Remarks</th>";
echo "<th>Score</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while($row = $result->fetch_array()){
echo "<tr>";
echo "<td>" . $row['ID'] . "</td>";
echo "<td>" . $row['IR'] . "</td>";
echo "<td>" . $row['Level'] . "</td>";
echo "<td>" . $row['Typ'] . "</td>";
echo "<td>" . $row['Occurrence'] . "</td>";
echo "<td>" . $row['Supplier'] . "</td>";
echo "<td>" . $row['Consequences'] . "</td>";
echo "<td>" . $row['Candidate'] . "</td>";
echo "<td>" . $row['Engineer'] . "</td>";
echo "<td>" . $row['Remarks'] . "</td>";
echo "<td>" . $donnees['sommeLTOSC'] . "</td>";
My problem is whit the echo at the end, i can t access the data, could you help me ? Thanks a lot
Here is my code revised :
<?php
// Include config file
require_once 'configgate.php';
$reponse= $mysqli->query("SELECT `ID`,`Level`,`Typ`,`Occurrence`,`Supplier`,`Consequences`,
SUM((/*0.5**/`Level`)+/*0.5**/`Typ`+/*0.5**/`Occurrence`+/*0.5**/`Supplier`+/*0.5**/`Consequences`) AS sommeLTOSC
FROM `andgate`
GROUP BY `ID`,`Level`,`Typ`,`Occurrence`,`Supplier`,`Consequences`
ORDER BY sommeLTOSC DESC");
while ($row = $reponse->fetch())
// Attempt select query execution
$sql = "SELECT * FROM andgate";
if($result = $mysqli->query($sql)){
if($result->num_rows > 0){
echo "<table class='table table-bordered table-striped'>";
echo "<thead>";
echo "<tr>";
echo "<th>ID</th>";
echo "<th>IR</th>";
echo "<th>Level</th>";
echo "<th>Type</th>";
echo "<th>Occurrence</th>";
echo "<th>Supplier</th>";
echo "<th>Consequences</th>";
echo "<th>Candidate TBA</th>";
echo "<th>Engineer Judgment</th>";
echo "<th>Remarks</th>";
echo "<th>Score</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while($row = $result->fetch_array()){
echo "<tr>";
echo "<td>" . $row['ID'] . "</td>";
echo "<td>" . $row['IR'] . "</td>";
echo "<td>" . $row['Level'] . "</td>";
echo "<td>" . $row['Typ'] . "</td>";
echo "<td>" . $row['Occurrence'] . "</td>";
echo "<td>" . $row['Supplier'] . "</td>";
echo "<td>" . $row['Consequences'] . "</td>";
echo "<td>" . $row['Candidate'] . "</td>";
echo "<td>" . $row['Engineer'] . "</td>";
echo "<td>" . $row['Remarks'] . "</td>";
echo "<td>" . $row['sommeLTOSC'] . "</td>";
Here is my error : Fatal error: Call to undefined method mysqli_result::fetch() in C:\wamp64\www\&Gate\indexgate.php on line 49
Thx