Thursday, 30 August 2018

The mysql query does not work - it does not select the table information

I have a query that is working in all my other php files but it will not work here. Can someone please look at what I have and let me know why the query is not selecting the fields?

Please keep in mind that $res is my database connection that's open, and all the table fields are spelled correctly to the table. I have tried not having those single quotes that are sideways and as you can see in the code I have tried it with them. I have also tried not having ' ' and have tried it with them. I can remark out the lines and the code works, but put them back live and the code stops working with no error given.
I don't know if this helps, but my PHP version is 5.3.3-40.el6_6
 $result2 = mysqli_query($res, "SELECT pre_sponsor_sponsor, slid FROM `pres` WHERE `pre_sponsor` = '$spospo' AND `slid` = '$slid' AND `pre_id` <= '$pre_id' LIMIT 1");
 $row2 = mysqli_fetch_array($result2)
 $spospo = $row2[pre_sponsor_sponsor];
 $slid = $row2[slid];


First of all you missed semicolon at line 3. But I think you should write $row2 = mysqli_fetch_array($result2, MYSQLI_ASSOC);

0 comments:

Post a Comment