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

  • Home
  • SEARCH
  • 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 9068365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:10:26+00:00 2026-06-16T17:10:26+00:00

Look at the following code : <?php function getmangainfo($teamname) { $rValue = ; $lValue

  • 0

Look at the following code :

<?php

function getmangainfo($teamname)
{
    $rValue = "";
    $lValue = "";
    $query = ("SELECT pic, mn_title FROM table Where mn_team LIKE '%" . $teamname . "%' Limit 0,4 ");
    $row_data = mysql_query($query);
    while ($row_data = mysql_fetch_array($row_data)) {
        $rValue = $row['pic'];
        $lValue = $row['mn_title'];
        return "<a class='linksrepeated' href='" . $ABSPATH . "/" . $lValue . "/'> <img src='" . $rValue . "'/></a>";
    }
}

this function is not returning anything! I am thinking it is because that the return statement is inside the while loop. I tried many things hoping it will return the 4 results but nothing happened. the SQL query works 100%. the problem is with my function. please let me know what is wrong and how to fix it.

  • 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-16T17:10:27+00:00Added an answer on June 16, 2026 at 5:10 pm

    change the $row_data to $row in your while statement

    while($row = mysql_fetch_array($row_data))
    

    because as I see the codes inside the while

    $rValue = $row['pic'];
    $lValue = $row['mn_title'];
    

    you get your data as $row but your in while statement is $row_data

    the problem is not on the while loop as the execution reaches the return statement, the execution pointer will exit the function(of course in the while statement)

    but for me to make your code cleaner as i see you expect only one row in return pull out the return statement on your while

    $rValue = "";
     $lValue = "";
     while ($row_data = mysql_fetch_array($row_data)) {
            $rValue = $row['pic'];
            $lValue = $row['mn_title'];
            break; //just to make sure for one row return
     }
     return "<a class='linksrepeated' href='" . $ABSPATH . "/" . $lValue . "/'> <img src='" . $rValue . "'/></a>";
    

    but as the others says that you expect 4 row returns you can create a variable that would store all the returns in a single string

       $rValue = "";
         $lValue = "";
         $links = "";
         while ($row_data = mysql_fetch_array($row_data)) {
                $rValue = $row['pic'];
                $lValue = $row['mn_title'];
                $links .="<a class='linksrepeated' href='" . $ABSPATH . "/" . $lValue . "/'> <img src='" . $rValue . "'/></a>";
         }
         return $links
    

    reference:
    http://php.net/manual/en/function.mysql-fetch-array.php

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

Sidebar

Related Questions

Please take a look at the following autocomplete code. $(document).ready(function(){ $(#the_input).autocomplete(/autocomplete.php, { //some options
Look at the following code snippet: <?php class A { function fn() { print
Pls look at following code <select name=VideoType id=VideoType style=width:60px> <option value=All>All</option> <option value=Movie>Movie</option> <option
Please have a look at the following code: $(#saveButton).click(function(){ $this = $(#tableData).find(input:checked).parent().parent(); tea =
I have the following PHP code; <?php component_customer_init(); component_customer_go(); function component_customer_init() { $customer =
I have the following PHP code which runs a MySQL query and returns the
take a look in following code: <?php $a = 20; $a= NULL; //or unset($a)
The finfo function is returning crazy mime types. Look the following code, what is
Look at the following code: ECHO A2 MKDIR -v /tmp/My Batch Script File Assignment
Please look at the following code: char* test ( ) { char word[20]; printf

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.