PHP table not displaying info from sql
up vote
0
down vote
favorite
I been working on a site to add, edit, delete, and see the data from a few different tables in mysql using php, so far I been able to add data to them with dropdown menus, but to update is causing me a bit of a problem. It worked before I added the dropdown, but decided to add it to limit the user to use data that exist and not input a Carnet that doesn't exist or does not follow the format, then I added the dropdown.
<form method="post" class="text-center">
<select name="alumno" class="form-control mx-auto" style="width:auto;" required>
<option value="" disabled selected>Seleccione un Alumno</option>
<?php
$cnn=mysqli_connect('localhost', 'root', 'CC2CRO','control_de_notas')
or die('No se pudo conectar');
$sqlcg = "SELECT Carnet, Nombres, Apellidos FROM datos";
$result = mysqli_query($cnn, $sqlcg);
while ($row = mysqli_fetch_array($result))
{
echo "<option value='".$row['Carnet']."'>".$row['Nombres']." ".$row['Apellidos']."</option>";
}
?>
</select>
<button type="submit" name="buscar">Actualizar</button><br>
</form>
This dropdown works for another form I have to add information from the table datos into another table that has the information of 3 different tables, for example the same information from the table datos, the Carnet is the value I take in another form to input into a bigger table that has codes from smaller tables to join them together. But what I can't seem to fix is that when I want to edit the table it doesn't show any data even if the Carnet exist in the table
<?php
if (isset($_POST["buscar"]))
{
$cnn=mysqli_connect('localhost', 'root', 'CC2CRO','control_de_notas')
or die('No se pudo conectar');
$cod=strtoupper($_POST["alumno"]);
$sql2 = "SELECT Carnet,Apellidos,Nombres,Direccion FROM datos WHERE Carnet='".$cod."'";
$contar=mysqli_num_rows(mysqli_query($cnn,$sql2));
if ($contar!=0)
{
$result2 = mysqli_query($cnn,$sql2);
echo "<form name='mostrar' method='post' class='text-center'>";
echo "<div align='center' class='table-responsive-sm'><table border='3' class='table table-sm table-hover' style='width:auto'>
<tr>
<td class='table-secondary text-center' style='font-size:110%;'><b>Codigo</b></td>
<td class='table-secondary text-center' style='font-size:110%;'><b>Nombre</b></td>
<td class='table-secondary text-center' style='font-size:110%;'><b>Direccion</b></td>
</tr>";
$row2 = mysqli_fetch_row($result2);
echo "<tr>
<td class='table-info><input type='text' name='mcodigo' value='".$row2[0]."' size='12' placeholder='Carnet' readonly/></td>
<td class='table-info><input type='text' name='mnombre' value='".$row2[2]." ".$row2[1]."' size='50' placeholder='Digitar Nombre' Maxlength='50' readonly></td>
<td class='table-info><input type='text' name='dir' value='".$row2[4]."' size='75' placeholder='Digitar Nombre' Maxlength='75' required/></td>
</tr></table>
<button type='submit' name='actualizar'>Actualizar</button>
</form></div>";
}
else
{
echo ("<SCRIPT LANGUAGE='JavaScript'>window.alert('Problema con el Sistema / Registro NO encontrado')</SCRIPT>");
}
}
if (isset($_POST["actualizar"]))
{
$cod=strtoupper($_POST["mcodigo"]);
$nom=trim(ucwords($_POST["dir"]));
$sql3="update datos set Direccion='$nom' where Codigo ='$cod'";
$mod = mysqli_query($cnn,$sql3);
if ($mod)
{
echo ("<SCRIPT LANGUAGE='JavaScript'>window.alert('Cambio Exitoso !!!!')</SCRIPT>");
}
else
{
echo ("<SCRIPT LANGUAGE='JavaScript'>window.alert('NO se pudo realizar la actualizacion')</SCRIPT>");
}
}
?>
If I select a entry that exist in the dropdown it doesn't show when I click
<button type='submit' name='actualizar'>Actualizar</button>
it did worked when I didn't have the dropdown and instead had an input
<input type="text" name="alumno" size="15" placeholder="Carnet a Modificar" Maxlength="8" required autofocus />
The same issue happens to my other tables when I try to update, my most concerning one is the table that I have 3 dropdown menus of the different tables, as I mentioned it worked when I had the input but I want to make it so you can select information that already exists, as for this table and the others I'm not editing the primary key or i the case of the big table I'm not editing the foreign keys.
For the big table to show data I use 2 dropdown to select 2 different cells of the table to get 1 result in common and run the query same as above
$sql2 = "SELECT Carnet,Materia,Docente,Laboratorio,Parcial,Promedio FROM datos WHERE Carnet='".$_POST['alumno']."' AND Materia='".$_POST['materia']."'";
This code is similar to the one above the only difference between this is that the first 2 code blocks are to update 1 table and this last code block is to update a table but I have to select data from 2 cells and I use 2 dropdown menus for it.
php mysql mysqli
add a comment |
up vote
0
down vote
favorite
I been working on a site to add, edit, delete, and see the data from a few different tables in mysql using php, so far I been able to add data to them with dropdown menus, but to update is causing me a bit of a problem. It worked before I added the dropdown, but decided to add it to limit the user to use data that exist and not input a Carnet that doesn't exist or does not follow the format, then I added the dropdown.
<form method="post" class="text-center">
<select name="alumno" class="form-control mx-auto" style="width:auto;" required>
<option value="" disabled selected>Seleccione un Alumno</option>
<?php
$cnn=mysqli_connect('localhost', 'root', 'CC2CRO','control_de_notas')
or die('No se pudo conectar');
$sqlcg = "SELECT Carnet, Nombres, Apellidos FROM datos";
$result = mysqli_query($cnn, $sqlcg);
while ($row = mysqli_fetch_array($result))
{
echo "<option value='".$row['Carnet']."'>".$row['Nombres']." ".$row['Apellidos']."</option>";
}
?>
</select>
<button type="submit" name="buscar">Actualizar</button><br>
</form>
This dropdown works for another form I have to add information from the table datos into another table that has the information of 3 different tables, for example the same information from the table datos, the Carnet is the value I take in another form to input into a bigger table that has codes from smaller tables to join them together. But what I can't seem to fix is that when I want to edit the table it doesn't show any data even if the Carnet exist in the table
<?php
if (isset($_POST["buscar"]))
{
$cnn=mysqli_connect('localhost', 'root', 'CC2CRO','control_de_notas')
or die('No se pudo conectar');
$cod=strtoupper($_POST["alumno"]);
$sql2 = "SELECT Carnet,Apellidos,Nombres,Direccion FROM datos WHERE Carnet='".$cod."'";
$contar=mysqli_num_rows(mysqli_query($cnn,$sql2));
if ($contar!=0)
{
$result2 = mysqli_query($cnn,$sql2);
echo "<form name='mostrar' method='post' class='text-center'>";
echo "<div align='center' class='table-responsive-sm'><table border='3' class='table table-sm table-hover' style='width:auto'>
<tr>
<td class='table-secondary text-center' style='font-size:110%;'><b>Codigo</b></td>
<td class='table-secondary text-center' style='font-size:110%;'><b>Nombre</b></td>
<td class='table-secondary text-center' style='font-size:110%;'><b>Direccion</b></td>
</tr>";
$row2 = mysqli_fetch_row($result2);
echo "<tr>
<td class='table-info><input type='text' name='mcodigo' value='".$row2[0]."' size='12' placeholder='Carnet' readonly/></td>
<td class='table-info><input type='text' name='mnombre' value='".$row2[2]." ".$row2[1]."' size='50' placeholder='Digitar Nombre' Maxlength='50' readonly></td>
<td class='table-info><input type='text' name='dir' value='".$row2[4]."' size='75' placeholder='Digitar Nombre' Maxlength='75' required/></td>
</tr></table>
<button type='submit' name='actualizar'>Actualizar</button>
</form></div>";
}
else
{
echo ("<SCRIPT LANGUAGE='JavaScript'>window.alert('Problema con el Sistema / Registro NO encontrado')</SCRIPT>");
}
}
if (isset($_POST["actualizar"]))
{
$cod=strtoupper($_POST["mcodigo"]);
$nom=trim(ucwords($_POST["dir"]));
$sql3="update datos set Direccion='$nom' where Codigo ='$cod'";
$mod = mysqli_query($cnn,$sql3);
if ($mod)
{
echo ("<SCRIPT LANGUAGE='JavaScript'>window.alert('Cambio Exitoso !!!!')</SCRIPT>");
}
else
{
echo ("<SCRIPT LANGUAGE='JavaScript'>window.alert('NO se pudo realizar la actualizacion')</SCRIPT>");
}
}
?>
If I select a entry that exist in the dropdown it doesn't show when I click
<button type='submit' name='actualizar'>Actualizar</button>
it did worked when I didn't have the dropdown and instead had an input
<input type="text" name="alumno" size="15" placeholder="Carnet a Modificar" Maxlength="8" required autofocus />
The same issue happens to my other tables when I try to update, my most concerning one is the table that I have 3 dropdown menus of the different tables, as I mentioned it worked when I had the input but I want to make it so you can select information that already exists, as for this table and the others I'm not editing the primary key or i the case of the big table I'm not editing the foreign keys.
For the big table to show data I use 2 dropdown to select 2 different cells of the table to get 1 result in common and run the query same as above
$sql2 = "SELECT Carnet,Materia,Docente,Laboratorio,Parcial,Promedio FROM datos WHERE Carnet='".$_POST['alumno']."' AND Materia='".$_POST['materia']."'";
This code is similar to the one above the only difference between this is that the first 2 code blocks are to update 1 table and this last code block is to update a table but I have to select data from 2 cells and I use 2 dropdown menus for it.
php mysql mysqli
gives me an error
? What error? Please update the question. You shouldn't execute the same query multiple times. You should parameterize your query.
– user3783243
Nov 10 at 5:43
doing the query multiple times times? the first one is to show me the data from the table in the dropdown and the second one is to show me the data of that row and allow me to edit that information,
– Anguis Nox
Nov 10 at 6:14
As I mentioned it hasn't given me a problem when I want to add something to the database, but only when I want to update something in said table the bottom table shows as empty
– Anguis Nox
Nov 10 at 6:16
You executemysqli_query($cnn,$sql2)
twice. You only need to do that once. What is the error you are getting?
– user3783243
Nov 10 at 7:00
any once, the last code block I mentioned was an example I have in another php file where I use 2 variables, I do havemysqli_query($cnn, $sqlcg);
for the dropdown,mysqli_query($cnn,$sql2
for the table to edit the data and $mod =mysqli_query($cnn,$sql3);
to send it to update that data, the problem is that even if the data exist it doesn't show anything in the 2nd table to edit
– Anguis Nox
Nov 10 at 7:40
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I been working on a site to add, edit, delete, and see the data from a few different tables in mysql using php, so far I been able to add data to them with dropdown menus, but to update is causing me a bit of a problem. It worked before I added the dropdown, but decided to add it to limit the user to use data that exist and not input a Carnet that doesn't exist or does not follow the format, then I added the dropdown.
<form method="post" class="text-center">
<select name="alumno" class="form-control mx-auto" style="width:auto;" required>
<option value="" disabled selected>Seleccione un Alumno</option>
<?php
$cnn=mysqli_connect('localhost', 'root', 'CC2CRO','control_de_notas')
or die('No se pudo conectar');
$sqlcg = "SELECT Carnet, Nombres, Apellidos FROM datos";
$result = mysqli_query($cnn, $sqlcg);
while ($row = mysqli_fetch_array($result))
{
echo "<option value='".$row['Carnet']."'>".$row['Nombres']." ".$row['Apellidos']."</option>";
}
?>
</select>
<button type="submit" name="buscar">Actualizar</button><br>
</form>
This dropdown works for another form I have to add information from the table datos into another table that has the information of 3 different tables, for example the same information from the table datos, the Carnet is the value I take in another form to input into a bigger table that has codes from smaller tables to join them together. But what I can't seem to fix is that when I want to edit the table it doesn't show any data even if the Carnet exist in the table
<?php
if (isset($_POST["buscar"]))
{
$cnn=mysqli_connect('localhost', 'root', 'CC2CRO','control_de_notas')
or die('No se pudo conectar');
$cod=strtoupper($_POST["alumno"]);
$sql2 = "SELECT Carnet,Apellidos,Nombres,Direccion FROM datos WHERE Carnet='".$cod."'";
$contar=mysqli_num_rows(mysqli_query($cnn,$sql2));
if ($contar!=0)
{
$result2 = mysqli_query($cnn,$sql2);
echo "<form name='mostrar' method='post' class='text-center'>";
echo "<div align='center' class='table-responsive-sm'><table border='3' class='table table-sm table-hover' style='width:auto'>
<tr>
<td class='table-secondary text-center' style='font-size:110%;'><b>Codigo</b></td>
<td class='table-secondary text-center' style='font-size:110%;'><b>Nombre</b></td>
<td class='table-secondary text-center' style='font-size:110%;'><b>Direccion</b></td>
</tr>";
$row2 = mysqli_fetch_row($result2);
echo "<tr>
<td class='table-info><input type='text' name='mcodigo' value='".$row2[0]."' size='12' placeholder='Carnet' readonly/></td>
<td class='table-info><input type='text' name='mnombre' value='".$row2[2]." ".$row2[1]."' size='50' placeholder='Digitar Nombre' Maxlength='50' readonly></td>
<td class='table-info><input type='text' name='dir' value='".$row2[4]."' size='75' placeholder='Digitar Nombre' Maxlength='75' required/></td>
</tr></table>
<button type='submit' name='actualizar'>Actualizar</button>
</form></div>";
}
else
{
echo ("<SCRIPT LANGUAGE='JavaScript'>window.alert('Problema con el Sistema / Registro NO encontrado')</SCRIPT>");
}
}
if (isset($_POST["actualizar"]))
{
$cod=strtoupper($_POST["mcodigo"]);
$nom=trim(ucwords($_POST["dir"]));
$sql3="update datos set Direccion='$nom' where Codigo ='$cod'";
$mod = mysqli_query($cnn,$sql3);
if ($mod)
{
echo ("<SCRIPT LANGUAGE='JavaScript'>window.alert('Cambio Exitoso !!!!')</SCRIPT>");
}
else
{
echo ("<SCRIPT LANGUAGE='JavaScript'>window.alert('NO se pudo realizar la actualizacion')</SCRIPT>");
}
}
?>
If I select a entry that exist in the dropdown it doesn't show when I click
<button type='submit' name='actualizar'>Actualizar</button>
it did worked when I didn't have the dropdown and instead had an input
<input type="text" name="alumno" size="15" placeholder="Carnet a Modificar" Maxlength="8" required autofocus />
The same issue happens to my other tables when I try to update, my most concerning one is the table that I have 3 dropdown menus of the different tables, as I mentioned it worked when I had the input but I want to make it so you can select information that already exists, as for this table and the others I'm not editing the primary key or i the case of the big table I'm not editing the foreign keys.
For the big table to show data I use 2 dropdown to select 2 different cells of the table to get 1 result in common and run the query same as above
$sql2 = "SELECT Carnet,Materia,Docente,Laboratorio,Parcial,Promedio FROM datos WHERE Carnet='".$_POST['alumno']."' AND Materia='".$_POST['materia']."'";
This code is similar to the one above the only difference between this is that the first 2 code blocks are to update 1 table and this last code block is to update a table but I have to select data from 2 cells and I use 2 dropdown menus for it.
php mysql mysqli
I been working on a site to add, edit, delete, and see the data from a few different tables in mysql using php, so far I been able to add data to them with dropdown menus, but to update is causing me a bit of a problem. It worked before I added the dropdown, but decided to add it to limit the user to use data that exist and not input a Carnet that doesn't exist or does not follow the format, then I added the dropdown.
<form method="post" class="text-center">
<select name="alumno" class="form-control mx-auto" style="width:auto;" required>
<option value="" disabled selected>Seleccione un Alumno</option>
<?php
$cnn=mysqli_connect('localhost', 'root', 'CC2CRO','control_de_notas')
or die('No se pudo conectar');
$sqlcg = "SELECT Carnet, Nombres, Apellidos FROM datos";
$result = mysqli_query($cnn, $sqlcg);
while ($row = mysqli_fetch_array($result))
{
echo "<option value='".$row['Carnet']."'>".$row['Nombres']." ".$row['Apellidos']."</option>";
}
?>
</select>
<button type="submit" name="buscar">Actualizar</button><br>
</form>
This dropdown works for another form I have to add information from the table datos into another table that has the information of 3 different tables, for example the same information from the table datos, the Carnet is the value I take in another form to input into a bigger table that has codes from smaller tables to join them together. But what I can't seem to fix is that when I want to edit the table it doesn't show any data even if the Carnet exist in the table
<?php
if (isset($_POST["buscar"]))
{
$cnn=mysqli_connect('localhost', 'root', 'CC2CRO','control_de_notas')
or die('No se pudo conectar');
$cod=strtoupper($_POST["alumno"]);
$sql2 = "SELECT Carnet,Apellidos,Nombres,Direccion FROM datos WHERE Carnet='".$cod."'";
$contar=mysqli_num_rows(mysqli_query($cnn,$sql2));
if ($contar!=0)
{
$result2 = mysqli_query($cnn,$sql2);
echo "<form name='mostrar' method='post' class='text-center'>";
echo "<div align='center' class='table-responsive-sm'><table border='3' class='table table-sm table-hover' style='width:auto'>
<tr>
<td class='table-secondary text-center' style='font-size:110%;'><b>Codigo</b></td>
<td class='table-secondary text-center' style='font-size:110%;'><b>Nombre</b></td>
<td class='table-secondary text-center' style='font-size:110%;'><b>Direccion</b></td>
</tr>";
$row2 = mysqli_fetch_row($result2);
echo "<tr>
<td class='table-info><input type='text' name='mcodigo' value='".$row2[0]."' size='12' placeholder='Carnet' readonly/></td>
<td class='table-info><input type='text' name='mnombre' value='".$row2[2]." ".$row2[1]."' size='50' placeholder='Digitar Nombre' Maxlength='50' readonly></td>
<td class='table-info><input type='text' name='dir' value='".$row2[4]."' size='75' placeholder='Digitar Nombre' Maxlength='75' required/></td>
</tr></table>
<button type='submit' name='actualizar'>Actualizar</button>
</form></div>";
}
else
{
echo ("<SCRIPT LANGUAGE='JavaScript'>window.alert('Problema con el Sistema / Registro NO encontrado')</SCRIPT>");
}
}
if (isset($_POST["actualizar"]))
{
$cod=strtoupper($_POST["mcodigo"]);
$nom=trim(ucwords($_POST["dir"]));
$sql3="update datos set Direccion='$nom' where Codigo ='$cod'";
$mod = mysqli_query($cnn,$sql3);
if ($mod)
{
echo ("<SCRIPT LANGUAGE='JavaScript'>window.alert('Cambio Exitoso !!!!')</SCRIPT>");
}
else
{
echo ("<SCRIPT LANGUAGE='JavaScript'>window.alert('NO se pudo realizar la actualizacion')</SCRIPT>");
}
}
?>
If I select a entry that exist in the dropdown it doesn't show when I click
<button type='submit' name='actualizar'>Actualizar</button>
it did worked when I didn't have the dropdown and instead had an input
<input type="text" name="alumno" size="15" placeholder="Carnet a Modificar" Maxlength="8" required autofocus />
The same issue happens to my other tables when I try to update, my most concerning one is the table that I have 3 dropdown menus of the different tables, as I mentioned it worked when I had the input but I want to make it so you can select information that already exists, as for this table and the others I'm not editing the primary key or i the case of the big table I'm not editing the foreign keys.
For the big table to show data I use 2 dropdown to select 2 different cells of the table to get 1 result in common and run the query same as above
$sql2 = "SELECT Carnet,Materia,Docente,Laboratorio,Parcial,Promedio FROM datos WHERE Carnet='".$_POST['alumno']."' AND Materia='".$_POST['materia']."'";
This code is similar to the one above the only difference between this is that the first 2 code blocks are to update 1 table and this last code block is to update a table but I have to select data from 2 cells and I use 2 dropdown menus for it.
php mysql mysqli
php mysql mysqli
edited Nov 10 at 7:48
asked Nov 10 at 5:21
Anguis Nox
128
128
gives me an error
? What error? Please update the question. You shouldn't execute the same query multiple times. You should parameterize your query.
– user3783243
Nov 10 at 5:43
doing the query multiple times times? the first one is to show me the data from the table in the dropdown and the second one is to show me the data of that row and allow me to edit that information,
– Anguis Nox
Nov 10 at 6:14
As I mentioned it hasn't given me a problem when I want to add something to the database, but only when I want to update something in said table the bottom table shows as empty
– Anguis Nox
Nov 10 at 6:16
You executemysqli_query($cnn,$sql2)
twice. You only need to do that once. What is the error you are getting?
– user3783243
Nov 10 at 7:00
any once, the last code block I mentioned was an example I have in another php file where I use 2 variables, I do havemysqli_query($cnn, $sqlcg);
for the dropdown,mysqli_query($cnn,$sql2
for the table to edit the data and $mod =mysqli_query($cnn,$sql3);
to send it to update that data, the problem is that even if the data exist it doesn't show anything in the 2nd table to edit
– Anguis Nox
Nov 10 at 7:40
add a comment |
gives me an error
? What error? Please update the question. You shouldn't execute the same query multiple times. You should parameterize your query.
– user3783243
Nov 10 at 5:43
doing the query multiple times times? the first one is to show me the data from the table in the dropdown and the second one is to show me the data of that row and allow me to edit that information,
– Anguis Nox
Nov 10 at 6:14
As I mentioned it hasn't given me a problem when I want to add something to the database, but only when I want to update something in said table the bottom table shows as empty
– Anguis Nox
Nov 10 at 6:16
You executemysqli_query($cnn,$sql2)
twice. You only need to do that once. What is the error you are getting?
– user3783243
Nov 10 at 7:00
any once, the last code block I mentioned was an example I have in another php file where I use 2 variables, I do havemysqli_query($cnn, $sqlcg);
for the dropdown,mysqli_query($cnn,$sql2
for the table to edit the data and $mod =mysqli_query($cnn,$sql3);
to send it to update that data, the problem is that even if the data exist it doesn't show anything in the 2nd table to edit
– Anguis Nox
Nov 10 at 7:40
gives me an error
? What error? Please update the question. You shouldn't execute the same query multiple times. You should parameterize your query.– user3783243
Nov 10 at 5:43
gives me an error
? What error? Please update the question. You shouldn't execute the same query multiple times. You should parameterize your query.– user3783243
Nov 10 at 5:43
doing the query multiple times times? the first one is to show me the data from the table in the dropdown and the second one is to show me the data of that row and allow me to edit that information,
– Anguis Nox
Nov 10 at 6:14
doing the query multiple times times? the first one is to show me the data from the table in the dropdown and the second one is to show me the data of that row and allow me to edit that information,
– Anguis Nox
Nov 10 at 6:14
As I mentioned it hasn't given me a problem when I want to add something to the database, but only when I want to update something in said table the bottom table shows as empty
– Anguis Nox
Nov 10 at 6:16
As I mentioned it hasn't given me a problem when I want to add something to the database, but only when I want to update something in said table the bottom table shows as empty
– Anguis Nox
Nov 10 at 6:16
You execute
mysqli_query($cnn,$sql2)
twice. You only need to do that once. What is the error you are getting?– user3783243
Nov 10 at 7:00
You execute
mysqli_query($cnn,$sql2)
twice. You only need to do that once. What is the error you are getting?– user3783243
Nov 10 at 7:00
any once, the last code block I mentioned was an example I have in another php file where I use 2 variables, I do have
mysqli_query($cnn, $sqlcg);
for the dropdown, mysqli_query($cnn,$sql2
for the table to edit the data and $mod = mysqli_query($cnn,$sql3);
to send it to update that data, the problem is that even if the data exist it doesn't show anything in the 2nd table to edit– Anguis Nox
Nov 10 at 7:40
any once, the last code block I mentioned was an example I have in another php file where I use 2 variables, I do have
mysqli_query($cnn, $sqlcg);
for the dropdown, mysqli_query($cnn,$sql2
for the table to edit the data and $mod = mysqli_query($cnn,$sql3);
to send it to update that data, the problem is that even if the data exist it doesn't show anything in the 2nd table to edit– Anguis Nox
Nov 10 at 7:40
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236218%2fphp-table-not-displaying-info-from-sql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236218%2fphp-table-not-displaying-info-from-sql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
gives me an error
? What error? Please update the question. You shouldn't execute the same query multiple times. You should parameterize your query.– user3783243
Nov 10 at 5:43
doing the query multiple times times? the first one is to show me the data from the table in the dropdown and the second one is to show me the data of that row and allow me to edit that information,
– Anguis Nox
Nov 10 at 6:14
As I mentioned it hasn't given me a problem when I want to add something to the database, but only when I want to update something in said table the bottom table shows as empty
– Anguis Nox
Nov 10 at 6:16
You execute
mysqli_query($cnn,$sql2)
twice. You only need to do that once. What is the error you are getting?– user3783243
Nov 10 at 7:00
any once, the last code block I mentioned was an example I have in another php file where I use 2 variables, I do have
mysqli_query($cnn, $sqlcg);
for the dropdown,mysqli_query($cnn,$sql2
for the table to edit the data and $mod =mysqli_query($cnn,$sql3);
to send it to update that data, the problem is that even if the data exist it doesn't show anything in the 2nd table to edit– Anguis Nox
Nov 10 at 7:40