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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:04:40+00:00 2026-06-09T22:04:40+00:00

I am just shifting my database from MS-Access to mysql I am using the

  • 0

I am just shifting my database from MS-Access to mysql

I am using the following code (part of related code only) to retrieve data from mysql

$con = mysql_connect("localhost","abc","abc@123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }


  $conn= mysql_select_db('xyz', $con);
if (!$con) {
    die ('Can\'t connect to database : ' . mysql_error());
}

$sql="SELECT * FROM Inventory where Text5='y' OR Text5='Y'  ";
$rs=mysql_query($sql);
if (!$rs)
  {exit("Error connecting database,,,");}

while (mysql_fetch_row($rs))
//while (!$rs->EOF)
  {
        $ASIN=trim(mysql_result($rs,"ASIN"));

        $LocalSKU = trim(mysql_result($rs,"LocalSKU"));

        //$ASIN=trim($rs->fields[120]);
        if(trim($ASIN)!=""){
            //include('funtions.php');
            $shipArray = shipingPrice($ASIN);
            $Price=round((mysql_result($rs,"Price")),2);
            $Price2=round((mysql_result($rs,"Price2")),2);  

but when I run the script I get the following error message

Warning: mysql_result() expects parameter 2 to be long, string given
in C:\wamp1\www\nathan\amazonPrice.php on line 67

basically, from the query result, I want to select the value of ASIN and LocalSKU fields to process it further..

can somebody suggest me what I am doing wrong here?

  • 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-09T22:04:41+00:00Added an answer on June 9, 2026 at 10:04 pm

    http://php.net/mysql_result

    The second parameter of mysql_result is the row you want. It’s NOT a string field.

    Your code is rather horrible. You could vastly simplify it with:

    $row = mysql_fetch_assoc($rs);
    $price = $row['price'];
    $pric2 = $row['price2'];
    etc...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I will be shifting my code base to the new 2.0 framework and just
There is a growing tendency for shifting from mysql to NOSQL, SQLite, etc. I
I'm shifting code from an application built in a non-standard custom PHP framework into
just wanted to ask where I define initial class properties? From other languages I
just wondering if there is a way to reduce the amount of code needed
Just see this: SELECT clientid,clientname,startdate,enddate,age FROM clients WHERE clientid IN (1,2,3,4,5) AND CASE WHEN
I want to use shift-tab for auto completion and shifting code blocks visually. I
I'm developing a multi-user application which uses a (postgresql-)database to store its data. I
Im wondering why my data in 'intFront' does not stay the same. Im shifting
I recently did an assignment using bit masking and shifting to manipulate a 4

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.