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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:32:34+00:00 2026-05-17T19:32:34+00:00

Hi I made a query to a table below and when I tried to

  • 0

Hi I made a query to a table below and when I tried to get the value in each column , it returns the same value from the first column for all the other columns.
To elaborate
In my database table I have the following:

owner_id = 21
pet_id = 1
name = fluffy
color = green
type = dog
sub_type = boxer
location = LA

however whenever I try to access one column, say the name column, it returns 21 which is the
value in the owner_id column corresponding to that pet_id. I am not sure why this is
happening.

$query = sprintf("SELECT * FROM `petAttributes` where pet_id ='%d'",$p_id);
 $result = performQuery($query);

 $owner_id = stripslashes(mysql_result($result,"owner_id"));
 $pet_id = stripslashes(mysql_result($result,"pet_id"));
 $name = stripslashes(mysql_result($result,"name"));
 $color = stripslashes(mysql_result($result,"color"));
 $type = stripslashes(mysql_result($result,"type"));
 $sub_type = stripslashes(mysql_result($result,"sub_type"));
 $loc = stripslashes(mysql_result($result,"location"));

Information on my environment
PHP Version 5.2.14
MYSQL version 5.0.67

  • 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-05-17T19:32:35+00:00Added an answer on May 17, 2026 at 7:32 pm

    I believe that if you use mysql_result you also have to specify the row index number (row 0 in your case?), before you specify the column.

    $name = stripslashes(mysql_result($result, 0, "name"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a query that retrieve a list of items from a database: CREATE
So I made a query like this global $connection; $query = SELECT * FROM
I want to log my query times for each time when a query made.
I have a ViewBag.People made up from a View; var query = db.Vw_INTERACTPEOPLE.Select(p =>
I need to join another table to my query, and grab the max value
I am scheduling the a query to a table for each database in a
When I try to execute the query below, I get error Incorrect syntax near
I made query that accepts two parameters. Now I want to use that query
Using C# and Oracle Data Provider for .NET (ODP) I made a long query
I have made a form that accepts query and executes it through php. I

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.