-1
I’m trying to run the code below but I’m getting the message HTTP ERROR 500
, how can I correct?
<?php
//chama o arquivo de conexão com o banco
include("connect_db.php");
//consulta mysqli
$query = mysql_query("SELECT numero, orig, dest, eqpt, rota FROM voos ORDER BY RAND() LIMIT 5") or die(mysql_error());
//aqui ele gera looping e cria um array com os campos da consulta
$array = mysql_fetch_array($query)
foreach($array as $indice => $item)
{
if(isset($array[$indice + 1])){
echo $array[$indice]['numero'];
echo $array[$indice]['orig'];
echo $array[$indice]['dest'];
echo $array[$indice]['eqpt'];
echo $array[$indice]['rota'];
echo "<br>";
//Se for o item 2 primeiro inverta a parte de baixo com a de cima
echo $array[$indice + 1]['numero'];
echo $array[$indice + 1]['orig'];
echo $array[$indice + 1]['dest'];
echo $array[$indice + 1]['eqpt'];
echo $array[$indice + 1]['rota'];
}
?>
<br />
<?php
}
?>
I made and edit and thank you for the help, but it kept popping up the same message on my site > http://latamvirtual.net/core/gera_escala.php
– Joaquim Alberico
@Joaquimalberico See the answer edition.
– Guilherme Nascimento
Guiherme thank you for your help, I made the changes that I can "understand" because I am not a programmer but the error persists.
– Joaquim Alberico
@Joaquimalberico must be inside connect_db.php
– Guilherme Nascimento
But even if I call $link = mysqli_connect("localhost", "my_user", "my_password", "world"); from within the file the error persists, it may be some configuration from where I host the site ?
– Joaquim Alberico
@Joaquimalberico you must have done something wrong when you switched to mysqli, you followed the example I posted? Understand thatmysqli_ is totally different from mysql_, the functions look like, but in fact they are not the same, so do not just exchange mysql_ for mysqli_, recommend that you redo the codes by following the example, and exchange my_user, my_password and world by your login, password and name of the database you use in your mysql database.
– Guilherme Nascimento