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

  • Home
  • SEARCH
  • 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 9130813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:01:49+00:00 2026-06-17T08:01:49+00:00

I am trying to select a table within my database with a GET Method.

  • 0

I am trying to select a table within my database with a GET Method.
Now when I hardcode the value of the variable in there (the table name) it works as expected and it returns the values in an array.

But when I try to determine the table name through a variable, I get the following error:

Fatal error: Call to a member function fetch_array() on a non-object in

Now I have tried the var_dump($result); but that returns bool(false).

Now the variable does carry a value, because when I echo it back to the screen it gives the value I would expect.

So why does not return the value when making the query for my table search???

     $result = $mysqli->query("SELECT * FROM PodcastSermons  WHERE sermonSeries = ". $series); //This where a change needs to happen

    var_dump($result);

        $posts = array();

        while($row = $result->fetch_array()) 
        {    
            $ID=$row['ID'];
            $sermonTitle=$row['sermonTitle'];
            $sermonSpeaker=$row['sermonSpeaker'];
            $sermonSeries=$row['sermonSeries'];
            $sermonDate=$row['sermonDate'];
            $linkToImage=$row['linkToImage'];
            $linkToAudioFile=$row['linkToAudioFile'];

            $posts []= array (
                'ID'=> $ID,
                'sermonTitle'=> $sermonTitle,
                'sermonSpeaker'=> $sermonSpeaker,
                'sermonSeries'=> $sermonSeries,
                'sermonDate'=> $sermonDate,
                'linkToImage'=> $linkToImage,
                'linkToAudioFile'=> $linkToAudioFile
            );
    }

    $response['posts'] = $posts;

    var_dump($posts);

PS I have read about the depreciation in mysql style and that I know have to use mysqli writing. I am running PHP Version 5.2.6-1+lenny16

  • 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-17T08:01:50+00:00Added an answer on June 17, 2026 at 8:01 am

    If the $series is a string you need to put quotes around the variable..

    Try…

    $result = $mysqli->query("SELECT * FROM PodcastSermons  WHERE sermonSeries = '". $series ."'");
    

    Hope it helps.

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

Sidebar

Related Questions

I'm trying to select an element based on its href within a table of
I am trying to select minimum and maximum value for capacity from MySQL table
I'm trying to write a select to table with name contain \ ? select
I'm trying to select from table, excluding where id is something, say 7. I
I am trying to select rows from a table where one of the (NVARCHAR)
I am trying to select the last record from a table in MySQL using
I'm trying to select most recent date from one table (invoice) to a customer
i'm trying to do this query: SELECT * FROM TABLE WHERE value1='THIS'S AN EXAMPLE'.
I have a table structured as following: I'm trying to select the latest handicap
I am trying to create a statement as follows: SELECT * FROM table WHERE

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.