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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:41:50+00:00 2026-05-26T10:41:50+00:00

Just learning this stuff, so bear with any ignorance… In what I’m trying to

  • 0

Just learning this stuff, so bear with any ignorance…

In what I’m trying to do, users input a word and as output receive their word as letter artwork that I’ve stored in a mysql database. I have a php page that breaks the characters of this word into an array and then matches these letter characters with tagged records.

What I’m having trouble with is getting the outputted images (a) into the same order as the characters of the user-inputted word and (b) choosing (randomly) only one tagged image (among many) per input letter.

Thanks for any suggestions or help on scripting this!


Here are some ideas I’ve cobbled together with some help…

$cxn = mysqli_connect($host, $user, $password, $database) or die("no cxn"); 
$lettertype = str_split($_POST['letter']);
array_walk($lettertype, 'mysql_real_escape_string');
$lettertype = "'" . implode("','", $lettertype) . "'";
$query = "SELECT * FROM images WHERE letter IN ($lettertype)";
$result = mysqli_query($cxn, $query)
        or die ("No good");
    while($row = mysqli_fetch_assoc($result))
        {
        echo "<a href='../delete3/images/{$row['imagePath']}' border='0'>
        <img src='../delete3/images/{$row['imagepath']}' width='100' height='80'/></a>";
        }
  • 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-26T10:41:51+00:00Added an answer on May 26, 2026 at 10:41 am

    You will have to test this yourself…

    $alphasoup = array();
    while($row = mysqli_fetch_assoc($result))
    {
      $alphasoup[$row['letter']][] = $row;
    }
    foreach(str_split($_POST['letter']) as $alpha)
    {
    echo "<a href='../delete3/images/{$alphasoup[($alpha][0]['imagePath']}' border='0'>
    <img src='../delete3/images/{$alphasoup[$alpha][0]['imagepath']}' width='100' height='80'/></a>";
    }
    

    Bonus Edit: and if you want the ability to have multiple graphics for the same letter and to pick one at random, store…

    $alphasoup[$alpha][array_rand($alphasoup[$alpha])]['imagepath']
    

    …as single variable to re-use in both instances in your string

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

Sidebar

Related Questions

Im just learning mod_rewrite and regex stuff, and what I'm trying to do is
I am learning Google's new language Go . I am just trying stuff out
I am just learning this stuff so please forgive if my code or questions
Just to clarify while learning this stuff: If I have a scene with just
I am learning this stuff and trying to understand it, so am using this
I'm just learning MongoDB and MongoMapper. This is on Rails 3. I created a
I'm guessing this is a simple problem, but I'm just learning... I have this:
I just started learning C but I don't understand this part of the code.
I am new to Scala, just started learning, so this is basic beginner question.
I was just reading through Learning Python by Mark Lutz and came across this

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.