dongyu9263 2016-07-24 00:08
浏览 68

我在php中查询有问题(0结果)

Well the problem is this I am making a simple query with a where in php, and throw some more with this type of syntax and I have done well, especially in the logging and inserting data, the problem is this. Working with three javascript and iframes when loguearme control a variable of the class php iframe number 0 because that never moves and always store that variable code here.

<Script>
window.parent.frames [2] .location = "../inicio.php";
window.parent.frames [0] .location = "../menu2.php?nick=<?php echo $ name;?>";
</ Script>

There send my php variable my number iframe 0, well then now print it and that if in that place, then in my class profile, I need that variable because depending on the nick of user profile information will be displayed and this is the code

$ Nick = "<script> document.write (window.parent.frames [0] .prueba) </ script>";
echo $ nick;

$ Sql ​​= "SELECT * FROM users 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 can see I do a cast within the nick variable in the code above and I print the variable depending on the user income, that means that brings me what I require, but when you put the variable $ nick within my query php does not bring me any record, but if I do it through the id, if I tare the row that I need or even if I put the nick directly brings back row, my problem is that putting the variable that stores the user income through iframe number zero, not bring me any mistakes or anything just stays at zero. any way to fix this slight error, in advance thanks for reading the Post.

  • 写回答

2条回答 默认 最新

  • doushi2902 2016-07-24 00:33
    关注

    David, I suggest you to eliminate the ‘if’. In my experience, if you don’t have any result from your consult, then nothing happen.

    I relation with the variable, you can to implement a listener in Jquery between the parent frame and any iframe. Using that, you can send a value to the parent frame from the iframe, or the contrary. Also via jquery, call to php algorithm sending that value.

    Tray that and I hope that that works.

    If you are interested with my approach, see this.

    评论

报告相同问题?

悬赏问题

  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂