Hello, I have made a table in php in which I will show several contents and by which one can search for these contents in the table. But a question arises when I try to write letters in other languages, it shows me as ?
with interrogations, an example creating a field in another language:
The code of my php my table will work with ajax and jquery, in my table in phpmyadmin the value is created but if it is a unicode character it introduces it with interrogations. The important part where I will show the table:
<div class="registros" id="agrega-registros"></div>
<center>
<ul class="pagination" id="pagination"></ul>
</center>
<!-- MODAL PARA EL REGISTRO DE PRODUCTOS-->
<div class="modal fade" id="registra-producto" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel"><b>Registra o Edita un Producto</b></h4>
</div>
<form id="formulario" class="formulario" onsubmit="return agregaRegistro();">
<div class="modal-body">
<table border="0" width="100%">
<tr>
<td colspan="2"><input type="text" required="required" readonly="readonly" id="id-prod" name="id-prod" readonly="readonly" style="visibility:hidden; height:5px;"/></td>
</tr>
<tr>
<td width="150">Proceso: </td>
<td><input type="text" required="required" readonly="readonly" id="pro" name="pro"/></td>
</tr>
<tr>
<td>Nombre: </td>
<td><input type="text" required="required" name="nombre" id="nombre" maxlength="100"/></td>
</tr>
<tr>
<td>Tipo: </td>
<td>
<input type="text" required="required" name="tipo" id="tipo" maxlength="100"/>
</tr>
<tr>
<td>URL: </td>
<td><input type="text" required="required" name="precio-uni" id="precio-uni"/></td>
</tr>
<tr>
<td>Numero: </td>
<td><input type="number" required="required" name="precio-dis" id="precio-dis"/></td>
</tr>
<td colspan="2">
<div id="mensaje"></div>
</td>
</tr>
</table>
</div>
<div class="modal-footer">
<input type="submit" value="Registrar" class="btn btn-success" id="reg"/>
<input type="submit" value="Editar" class="btn btn-warning" id="edi"/>
</div>
</form>
</div>
</div>
</div>
The php to enter the products:
<?php
include('conexion.php');
$database_connection= database_connect();
$id = $_POST['id-prod'];
$proceso = $_POST['pro'];
$nombre = $_POST['nombre'];
$tipo = $_POST['tipo'];
$precio_uni = $_POST['precio-uni'];
$precio_dis = $_POST['precio-dis'];
$fecha = date('Y-m-d');
//VERIFICAMOS EL PROCESO
switch($proceso){
case 'Registro':
$database_connection->query("INSERT INTO productos (nomb_prod, tipo_prod, precio_unit, precio_dist, fecha_reg)VALUES('$nombre','$tipo','$precio_uni','$precio_dis', '$fecha')");
break;
case 'Edicion':
$database_connection->query("UPDATE productos SET nomb_prod = '$nombre', tipo_prod = '$tipo', precio_unit = '$precio_uni', precio_dist = '$precio_dis' WHERE id_prod = '$id'");
break;
}
//ACTUALIZAMOS LOS REGISTROS Y LOS OBTENEMOS
$registro = $database_connection->query("SELECT * FROM productos ORDER BY id_prod ASC");
//CREAMOS NUESTRA VISTA Y LA DEVOLVEMOS AL AJAX
echo '<table class="table table-striped table-condensed table-hover">
<tr>
<th width="0px">Nombre</th>
<th width="0px">Descripcion</th>
<th width="50">Opciones</th>
</tr>';
$registro = $database_connection-> query("SELECT * FROM productos")->fetchAll();
foreach ($registro as $registro2){
echo '<tr>
<td>'.$registro2['nomb_prod'].'</td>
<td><a href="https://'.$registro2['precio_unit'].'">'.$registro2['tipo_prod'].'</a></td>
<td><a href="javascript:editarProducto('.$registro2['id_prod'].');" class="glyphicon glyphicon-edit"></a> <a href="javascript:eliminarProducto('.$registro2['id_prod'].');" class="glyphicon glyphicon-remove-circle"></a></td>
</tr>';
}
echo '</table>';
?>
The page:
http://hzforo.byethost24.com/?i=1
Anyone can enter the page and add something. But the problem is if I write something in unicode in the table of my database if you enter it in unicode character it will see in this way the field ????????
there is some way to solve it.