Respected Professors,
I have this screen
and blocks are like this
and php codes are like this
//---------------------------------------------------------------
if ($button == "btn_show_file")
{
$_id = mysqli_real_escape_string($dbc, $_GET["_id"]);
$query = ("select extension,nombre,timestamp FROM dibujo WHERE id='$_id'");
if ($result=mysqli_query($dbc, $query))
{
$numColumns = mysqli_field_count($dbc);
if ($numColumns > 0)
{
// echo $numColumns;
$en_csv = '';
while ($row = mysqli_fetch_assoc($result))
{
foreach ($row as $column)
{
$en_csv .= $column . ",";
}
$en_csv = rtrim($en_csv, ",");
$en_csv .= "\n";
}
$en_csv = rtrim($en_csv, "\n");
print $en_csv;
}
}
else
{
echo "ERROR: Could not able to execute" . $query . " " . mysqli_error($dbc);
exit();
}
mysqli_close($dbc);
exit();
}
//---------------------------------------------------------------
if ($button == "btn_show_pic")
{
$_id = mysqli_real_escape_string($dbc, $_GET["_id"]);
echo $_id;
$sql = "SELECT imagen, extension FROM dibujo WHERE id='$_id'";
$result = mysqli_query($dbc,"$sql");
$row = mysqli_fetch_array($result);
file_put_contents('temporal.png', $row["imagen"] );
mysqli_close($link);
exit();
}
//---------------------------------------------------------------
There are 2 buttons, 2 code blocks and 2 php procedures.
First button displays IMAGE NAME
Second button displays IMAGE FILE
Is it possible to use ONE button to call both php procedures?
Regards