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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:02:40+00:00 2026-06-14T11:02:40+00:00

I have been given a task to convert the hardcoded fields into dynamic fields.I

  • 0

I have been given a task to convert the hardcoded fields into dynamic fields.I have changed it partially to dynamic
Let me explain you the situation ,

We have a lot of databases and each database has a table by name Surveys

By using the DESCRIBE statement we will retrieve the fields in the Surveys table regardless of the database .

I need to know the way where we can loop again and again till all the fields in the survey table appears.

In the below code I have left the for loop blank .

Please let me know the changes that neeeds to be done to get this working

I would really appreciate any kind of help

function insertIntoUserUploadFileds() {

    $describe="DESCRIBE surveys";

    $sql = "INSERT INTO `userUploadFields` (`fieldName`, `inUse`, `mandatory`, `type`, `mapTo`) VALUES";

    $inUse="0";
    $type="";

    //for(){
        if($field=='type'){
            $type="N";
        }elseif(($field=='fname') || ($field=='lname') || ($field=='phone')){
            $inUse="1";
            $type="T";
        }elseif($field=='email'){
            $inUse="1";
            $type="E";
        }

        //$sql .= "('".$field."', '".$inUse."', '0', '
        $result1 = mysql_query ($describe);
        $result = mysql_query ($sql);
    //}
}
  • 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-14T11:02:41+00:00Added an answer on June 14, 2026 at 11:02 am
        $result1 = mysql_query ('DESCRIBE surveys');
    
            //here is how you retieve all field and check
            while($row = mysql_fetch_array($result1)) {
    
             $sql = "INSERT INTO `userUploadFields` (`fieldName`, `inUse`, `mandatory`, `type`, `mapTo`) VALUES";
    
               //here you can do if else to check the column name
               if($row['field']=='type')
                {
                    $type="N";
                }
                else if(($row['field']=='fname') || ($row['field']=='lname') || ($row['type']=='phone'))
                {
                    $inUse="1";
                    $type="T";
                 }
    
                 else ($row['field']=='email')
                {
                     $inUse="1"
                     $type="E";
                }
    
    
               //build your query
    
               $sql .= "('".$field."', '".$inUse."', '0', '......)
    
               //execute your complete query
               $result = mysql_query ($sql);
            }//end of while
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been given the task to design a database to store a lot
I have been given a task to covert lower case character into upper case
I have been given the task to convert an uncompressed movie to H.264 format.
I have been given the task of bringing three legacy systems together into one
I have been given the task of implementing a way to convert a string
I have been given the task of adding functionality to an existing IIS 6.0
I have been given the task of re-writing some libraries written in C# so
I have been given the task of devising a custom forms manager that has
I have been given the task of converting a macromedia application to a web
I am a student on a work placement. I have been given the task

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.