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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:21:39+00:00 2026-06-05T15:21:39+00:00

How do I show the results for $wordavg in php. I have done the

  • 0

How do I show the results for $wordavg in php. I have done the query in SQL on database after taking out variables so I believe the query is correct but don’t know how to show the results of the search in php.

$usertable = 'words';
$yourfield = 'wordname'; 

$query = "SELECT AVG(CHAR_LENGTH( wordname)) AS $wordavg FROM $usertable WHERE $yourfield LIKE '"."$current_letter"."%' ";
$result = mysql_query($query);
  • 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-05T15:21:40+00:00Added an answer on June 5, 2026 at 3:21 pm

    First, you should be using mysqli instead. Back to your question, usually you can iterate over a result with a loop as follows:

    while ($row = mysql_fetch_assoc($result)) {
        echo $row['field'];
    }
    

    More info and examples in the PHP mysql_query doc.

    Since you only have one row of data to return, you don’t need the loop part. You can simply use

    $row = mysql_fetch_assoc($result);
    $wordavg = $row['wordavg'];
    

    You shouldn’t have the $ in wordavg in your query. It should be just ...AS wordavg FROM...

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why does this sql query only show results if they only have a row
I have a sql query that is retrieving results from a table but I
I have a query that show results of projects being worked between 2 dates.
I want to connect 2 tables in my query to show results. I have
I am trying to query and parse Yahoo fantasy sports data and show results
I have a mysql datebase, and im trying to show in the results all
have a search screen and I want to show results by searching specific data.My
I must do something like that; I have 2 sql tables like this Results:
I have this form: <form name=customize> Only show results within <select name=distance id=slct_distance> <option>25</option>
I try to use GtktreeView to show results of mysql query in C with

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.