www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] output mysql_fetch_array into seperate strings

  1. #1
    Join Date
    Oct 2006
    Location
    Scotland
    Posts
    38

    resolved [RESOLVED] output mysql_fetch_array into seperate strings

    Hi i was wandering if anyone could help me out with a little problem im having, I am currently trying to make a php image file that a user can call like so

    img.php?userid=unique20charid

    And it will display there charaters information stored in the database.

    Anyway i have the basic thing working but need some help i will explain or try to explain how it all works.

    The database has 2 different tables 1 for user information and 1 for character info the user info contains the uniqe 20 char ID and i use this to query the actual userID for the user then use that userID to query the character table each character stored in the character is stored with the userID and then the info.

    Anyway as you can see in this example i want to somehow enable the script to display seperate charaters on a new line after "Hour(s)" -
    Exmaple Image

    Currently i am using this function to output all the results to a single string

    Code:
    	function outputsigstring()
    	{
    		global $GetChars;
    		
    		while($GetCharsrow = mysql_fetch_array($GetChars))
    		{
    			$string.="Class: ".$GetCharsrow['class']." Level: ".$GetCharsrow['level']." Current XP: ".$GetCharsrow['currentxp']."% Time to Level: ".$GetCharsrow['timetolevel']." Hour(s)";
    		}
    		return $string;
    	}
    	
    	$outputstring = outputsigstring();
    
    ImageString($image, 3, 5, 3, $outputstring, $black);
    Could anyone point me in the right direction i have a feeling i will need to split the outputstring into seperate strings and add them to the image in another loop function depending on how many charaters a user has.

    If have not explained myself well enough please feel free to ask what i mean.

  2. #2
    Join Date
    Oct 2006
    Location
    Scotland
    Posts
    38
    Ok i found a function to split strings after \n its not hard actually i will mark this as resolved. Sorry for taking up space actually.

  3. #3
    Join Date
    Jul 2009
    Location
    Falls Church, Va.
    Posts
    780
    Sorry for taking up space actually.
    Make sure it NEVER happens again, darnit.

    I'm kidding, of course, and glad you figured it out. Good that you posted it, ya never know someone else might run into the same trouble. Cheers!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles