Well the problem is the following I am doing a simple query with a where
within php
, I already echo some more with this type of syntax and I have done well, especially in logging and inserting data, the problem is this
I work with three iframes
of javascript
and at the time of login I send a variable of class php
to iframe
number 0 since that never moves and always stored this variable here the code.
<script>
window.parent.frames[2].location = "../inicio.php";
window.parent.frames[0].location = "../menu2.php?nick=<?php echo $nombre; ?>";
</script>
There I send my variable php
to my iframe
number 0, well then now I print it and I know that if it is in that place, then in my profile class, I need that variable since depending on the nickname of the user will show your profile information and this is the code
$nick = "<script> document.write(window.parent.frames[0].prueba) </script>";
echo $nick;
$sql = "SELECT * FROM usuario WHERE nick = '$nick'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while ($row = mysqli_fetch_assoc($result)) {
echo "nick: " . $row["nick"] . "<br>";
}
}
Then as you will see I do an echo within the nick variable in the above code and print the variable depending on the user that I entered, that means that it brings me what I need, but when I put the variable $nick
inside of my query of php
does not bring me any record, but if I do it by means of the id, if I tare the row that I need or even if I put the nick in a direct way it brings me the row, my problem is that when I put the variable that stores the user that entered through the iframe
number zero, it does not bring me an error or anything just stays at zero. some way to solve that slight error, thank you in advance for reading the Post.