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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:01:20+00:00 2026-06-11T00:01:20+00:00

HTML CODE <tr> <td><input type=text name=batch_code[] required=required value=<?php if(isset($batch_code[0]))echo htmlentities($batch_code[0]); ?>/></td> <td><input type=text name=description[]

  • 0

HTML CODE

<tr>
   <td><input type="text" name="batch_code[]" required="required" value="<?php      if(isset($batch_code[0]))echo htmlentities($batch_code[0]); ?>"/></td>
   <td><input type="text" name="description[]" value="<?php if(isset($description[0]))echo htmlentities($description[0]); ?>"/></td>
   <td><input type="text" name="current_value[]" value="<?php if(isset($current_value[0]))echo htmlentities($current_value[0]); ?>"/></td>
   <td><input type="text" size="12" name="qty[]"  required="required"  value="<?php if(isset($qty[0]))echo htmlentities($qty[0]); ?>"/></td>
   <td><select id="asset_id" class="asset_id" name="asset_id[0][]" multiple="multiple" required>
    <?php foreach($asset_ids as $asset_id): ?>
            <option class="dropdownlist"><?php echo $asset_id->asset_id; ?></option> 
     <?php endforeach; ?>
    </select></td>
</tr>
<tr>
   <td><input type="text" name="batch_code[]" required="required" value="<?php      if(isset($batch_code[1]))echo htmlentities($batch_code[1]); ?>"/></td>
   <td><input type="text" name="description[]" value="<?php if(isset($description[1]))echo htmlentities($description[1]); ?>"/></td>
   <td><input type="text" name="current_value[]" value="<?php if(isset($current_value[1]))echo htmlentities($current_value[1]); ?>"/></td>
   <td><input type="text" size="12" name="qty[]"  required="required"  value="<?php if(isset($qty[1]))echo htmlentities($qty[1]); ?>"/></td>
   <td><select id="asset_id" class="asset_id" name="asset_id[1][]" multiple="multiple" required>
    <?php foreach($asset_ids as $asset_id): ?>
            <option class="dropdownlist"><?php echo $asset_id->asset_id; ?></option> 
     <?php endforeach; ?>
    </select></td>
</tr>

And My php codes are

$count = count(array_filter($this->asset_id))-1;
for($value = 0; $value <= $count; $value++){
    $count_asset = count(array_filter($this->asset_id))-1;
    for($asset_value = 0; $asset_value <= $count_asset; $asset_value++){
        $sql  = "INSERT INTO dispatch_items (";
        $sql .= "dis_id, batch_code, asset_id, description, current_value, qty";
        $sql .= ") VALUES ('";
        $sql .= $database->escape_value($this->dis_id) ."', '";
        $sql .= $database->escape_value($this->batch_code[$value])."', '";
        $sql .= $database->escape_value($this->asset_id[$value][$asset_value]) ."', '";
        $sql .= $database->escape_value($this->description[$value]) ."', '";
        $sql .= $database->escape_value($this->current_value[$value]) ."', '";
        $sql .= $database->escape_value($this->qty[$value]) ."')";
        $query = $datanase->query($sql);
        $sql  = "UPDATE asset_manager SET ";
        $sql .= "location='".$database->escape_value($this->rstore_code)."', ";
        $sql .= "dis_id='".$database->escape_value($this->dis_id)."' ";
        $sql .= "WHERE asset_id='".$database->escape_value($this->asset_id[$value][$asset_value])."' ";
        $sql .= "AND batch_code='".$database->escape_value($this->batch_code[$value])."' ";
        $query = $database->query($sql);
    }
}

I’m trying insert multiple form data to database and give option to user select multiple asset_id[][] for every batch_code[] but when inset it to database keep getting this error.. 🙁

Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in D:\assetmanagement\includes\database.php on line 52

public function escape_value( $value ) {
      if( $this->real_escape_string ) { // PHP v4.3.0 or higher
     // undo any magic quote effects so mysql_real_escape_string can do the work
     if( $this->magic_quotes_active ) { $value = stripslashes( $value ); }
         $value = mysql_real_escape_string( $value );\\ line 53
     } else { // before PHP v4.3.0
         // if magic quotes aren't already on then add slashes manually
         if( !$this->magic_quotes_active ) { $value = addslashes( $value ); }
         // if magic quotes are active, then the slashes already exist
     }
    return $value;
}

How can i fix this error..?

  • 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-11T00:01:22+00:00Added an answer on June 11, 2026 at 12:01 am

    Instead of using

    if( $this->real_escape_string ) { // PHP v4.3.0 or higher
    

    check php version with

    phpversion()
    

    or

    function_exists('real_escape_string')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My HTML code: <p>NEWS</p> <p> <form action=news.php method=post> <center><input name=NEW type=submit id=new value=NEW/> <input
browsing some html code I find a text input coded as: <input type=text name=Email<%=orderRow.ID
I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
HTML code: <div class=clearfix style=color: #555 style=display:block; > <input type=text id=id_site placeholder=nom-du-site style=width: 245px;
This is my html Code: <input type=checkbox name=test id=test /> Here i want to
My HTML code goes like this: <div id=single><br><br> 1) effew<br> <input name=answer0 id=answer0 value=1
I have below html code in my aspx. <input type=hidden id=medicalLink value='<a href=/forms/contactus.aspx >Contact
This is my html code : <div id=d1 class=division> <input type=button value=one class=division> </div>
xss.php <?php header('Content-Type:text/html; charset=UTF-8'); var_dump(ini_get('filter.default')); if (isset($_GET['name'])) { echo $_GET['name']; exit(); } browsing http://localhost/xss.php?name=%3Cscript%3Ealert('XSS')%3C/script%3E
Hi this is my HTML code:::: <form> <fieldset > <legend><b>TRIP</b></legend> <p> <input type =

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.