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 8118151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:23:33+00:00 2026-06-06T04:23:33+00:00

I think I have a problem with casting. $db = mysqli_connect(‘127.0.0.1′,’root’,’password’,’test’); if (! $db)

  • 0

I think I have a problem with casting.

$db = mysqli_connect('127.0.0.1','root','password','test');
if (! $db) { die("Can't connect: " . mysqli_connect_error( )); }

$new_table = $_POST["newtablename"];
$old_table = $_POST["oldtablename"];
$numberRows = $_POST["numberrows"];
$startRow = $_POST["startrow"];
$counter = 0;

drop_table($db, $new_table);

create_table($db, $new_table);

for($counter = 0; $counter < $numberRows; $counter += 1)
{
   $currentRow = getRow($db, $old_table);
   $ID = $currentRow(1);
   $Partner = $currentRow(2);
   $Merchant = $currentRow(3);
}

function getRow($db, $old_table)
{
    $select = "SELECT ID, Partner, Merchant FROM " .$old_table;
    $q = mysqli_query($db, $select);
    $row = mysqli_fetch_row($q);

    return $row;
}



 function create_table($db, $new_table){
    $create = "CREATE TABLE " .$new_table. "(ID INT, Partner VARCHAR(20), Merchant       VARCHAR(30))";

    $q = mysqli_query($db, $create);
} 

 function drop_table($db,$new_table){
     $drop = "DROP TABLE IF EXISTS " .$new_table;
     $q = mysqli_query($db, $drop);
     } 

This is the error I get

Fatal error: Function name must be a string in C:\xampp\htdocs\myfiles\mysqli_combined_functions.php on line 26

Line 26 is where I set $ID = $currentRow(1). I am under the impression that the row will be returned as an array of variables, and using the proper number I can access the variable I want. Assuming thats true (let me know if its not) then I think it is reading the ID in the form of an INT which is what it is in the SQL table I have. Can someone help me cast it into string? or perhaps I’m missing the problem completely?

  • 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-06T04:23:34+00:00Added an answer on June 6, 2026 at 4:23 am

    Not casting. These are array indexes, note the square brackets. [ ]

       $currentRow = getRow($db, $old_table);
       $ID = $currentRow[1];
       $Partner = $currentRow[2];
       $Merchant = $currentRow[3];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a problem that i can't solve ! (sqlite3, but i think it
I think I have a problem in understanding the proper way of using MVC.
I think I have a synchronization problem...It may be too basic..Please help.. I have
I think i have a basic problem in understanding the dojo toolkit. Well I
I have a problem with a template and pointers ( I think ). Below
Hi I have a problem in sending data from php to pdf. I think
I have a peculiar problem, which I think that a lot of other people
I have been having the following problem, i think it's probably due to the
Friends, I have a strange need and cannot think my way through the problem.
I have a problem with docking. Here is the thing. I hope I can

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.