-2

I'm currently working on creating a Real Estate Ads Script On the User Show page, I wanted to show the user-added ads, and I ran into a problem, which was to show only the first ad added by the user. The problem is not in a query mysqli nor while, I was print array using print_r function was printed first advertisement only, and I calculated the number of query results by mysqli_num_rows() function which is 8, and i used functions mysqli_fetch_array and mysqli_fetch_assoc and mysqli_fetch_row and all of them did not solve my problem Please solve this problem because I am late on the client in creating the site Code https://evotecpro.com/code.html

7
  • 2
    Yeah, don't send us to see your code, if you want to get help - Include the code in your post
    – Alon Eitan
    Commented Oct 28, 2017 at 17:54
  • you need to iterate while in mysqli_fetch_array()
    – Vipul L.
    Commented Oct 28, 2017 at 17:54
  • The linked script also is not a minimal example. You should provide as little code as needed to demonstrate the issue.
    – chris85
    Commented Oct 28, 2017 at 18:07
  • You do not provide enough to answer properly. But here are some suggestins. Ensure your query returns only 1 result, the one you want. To do this, sort via the posted date or something like that and limit to the first result. Then when you do mysqli_fetch_array once, you will get the first result you want. And please read the help on how to post good questions (stackoverflow.com/help/mcve).
    – Nic3500
    Commented Oct 28, 2017 at 18:13
  • @Vipul Lakhtariya I didn't understand, what do you mean Commented Oct 28, 2017 at 18:21

1 Answer 1

1

you need used to mysqli_fetch_all(). And you can see this tutorial more info about the fetch_all() function PHP mysqli_fetch_all() Function - W3Schools

2
  • I not have mysqlnd, what can i do? Commented Oct 28, 2017 at 19:32
  • @Alon Eitan i try to include the code, but i could not include it Commented Oct 28, 2017 at 20:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.