Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8033959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:52:01+00:00 2026-06-05T01:52:01+00:00

I am having trouble with one of my scripts. What basically happens is that

  • 0

I am having trouble with one of my scripts. What basically happens is that my use of mysqli_data_seek() and mysqli_fetch_assoc() produces the following error:

Warning: mysqli_data_seek() expects parameter 1 to be mysqli_result, boolean given in /usr/home/myacc/includes/html/shop/categoryMain.html.php on line 49
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in /usr/home/myacc/includes/html/shop/categoryMain.html.php on line 50 

This is the code relating to those two lines:

mysqli_data_seek($subsSql, 0);
while($rowSubs = mysqli_fetch_assoc($subsSql))

These errors only occur when the script runs on my hosted (live) website. In my local development (latest version of WAMP) this script runs without error and produces the desired effect…

Here is the script in its full context:

//categories to local array
$catsQuery = "
    SELECT id, category, catDirPath
    FROM categories
    ORDER BY category
";
$catsSql = mysqli_query($link, $catsQuery);
$cats = array();
mysqli_data_seek($catsSql, 0);
while($rowCats = mysqli_fetch_assoc($catsSql))
{
    $cats[$rowCats['id']]['catName'] = $rowCats['category'];
    $cats[$rowCats['id']]['catPath'] = $rowCats['catDirPath'];
}

// subCats to local array
$subsQuery = "
    SELECT id, subCat, category_id, subDirPath
    FROM subCats, sub_categories
    WHERE subCats.id = sub_categories.sub_id
    ORDER BY subCat
";
$subsSql = mysqli_query($link, $subsQuery);
$subs = array();
mysqli_data_seek($subsSql, 0);
while($rowSubs = mysqli_fetch_assoc($subsSql))
{
    $subs[$rowSubs['id']]['subName'] = $rowSubs['subCat'];
    $subs[$rowSubs['id']]['catId'] = $rowSubs['category_id'];
    $subs[$rowSubs['id']]['subPath'] = $rowSubs['subDirPath'];
}

// loop through categories and if subs exist, add to resultset and display
foreach ($cats as $catId => $cat)
{
    ...
            foreach ($subs as $subId => $sub)
            {
                ...
            }
    ...
}

Could someone by chance spot a problem with the way I have coded this script or possibly suggest a reason as to why this would work via wamp and not the apache server used with my web host?

Any suggestions or advice relating to this would be greatly appreciated!

Thanks for your time in reading through this!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:52:02+00:00Added an answer on June 5, 2026 at 1:52 am

    The Documentation for mysqli_query says

    Returns FALSE on failure. For successful SELECT, SHOW, DESCRIBE or EXPLAIN queries mysqli_query() will return a mysqli_result object. For other successful queries mysqli_query() will return TRUE.

    That means that your query failed. Ensure that $link is connected ok, and double check the syntax of the $subsQuery and $catsSql.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble getting one of my LINQ to SQL queries to work
i am having trouble loading one of my text files into my GUI. I
right guys im having trouble with one. what i want to do is have
I am learning mysql and I am having trouble with one of my tables
I'm having trouble moving a website from one server to another. It seems to
I'm having trouble copying a row from one table to another using sqlite3 in
I'm having trouble inserting data from one column to another within the same table.
I am having trouble getting a variable from one defined function to another. For
I have been having trouble with the Google Maps API for one week now
I am having trouble getting one of my Android projects under Eclipse to run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.