2
I’m trying to run this code but it’s not working.
$sql = "SELECT * FROM cliente WHERE id = $id ";
$limite = mysql_query("$sql");
while ($sql = mysql_fetch_array($limite)){
$nome = $sql["nome"];
$telefone = $sql["telefone"];
$id = $_GET['id'];
echo "<div class='clientecelula'>" ;
echo "$nome";
echo "<span class='telcelula'> $telefone </span>";
echo "<span class='semcelula'> </span>";
echo "</div>" ;
}
I’m getting the bug:
Notice: Undefined variable: id in /Applications/XAMPP/xamppfiles/htdocs/Ross/semana.php on line 7
Warning: mysql_fetch_array() expects Parameter 1 to be Resource, Boolean Given in /Applications/XAMPP/xamppfiles/htdocs/Ross/semana.php on line 12
What’s the problem here?
I find this kind of question out of scope because it’s more about asking for help/support to solve something personal. I don’t think it’s up to the community to be doing the third party service..
– Daniel Omine
@Danielomine requests for help with bugs in the code are within the scope.
– Jorge B.
I think the question is within the scope, I think you confuse things, it’s not because someone is lost with something basic that she is outside the scope
– Isvaldo Fernandes
$_GET['id']
empty and caused an error in sql that returned a false. error-related question– rray
@rray the problem is not that, the problem is the location of the
$id
.– Jorge B.
I disagree. For me, this is out of scope. I don’t think this kind of issue brings community value. This is like doing the service of others, for free.
– Daniel Omine
Thank you for your help! I would like to apologize for asking such a basic question and that much was said that was out of scope. I’m still a student and I’m only php for 2 months.
– user3013911