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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:03:49+00:00 2026-06-14T20:03:49+00:00

This is the code I have now: <td align=center valign=middle> <?php // IF the

  • 0

This is the code I have now:

<td align="center" valign="middle">
        <?php 
        // IF the users tips match with the correct tip, echo correct, else wrong on table cell
        if ($row['1g1']==$row['1w1']){
        ?>          
            <img src="../../images/tick-cross/Tick1.png" width="20" height="20" alt="Correct" border="0" />
        <?
        }
        else
        {
        ?>
            <img src="../../images/tick-cross/Cross1.png" width="20" height="20" alt="Wrong" border="0" />
        <?
        }
        ?>
        </td>

Basically, if 2 rows in the table are equal it inserts a image of a tick/check, if they arent it inserts an image of a cross.

if your confused view the table here

Ok so I want to make the numbers before the ‘g’ and the ‘w’ into variables because i would otherwise have to change them hundreds of times.
IN THE Line:

if ($row['1g1']==$row['1w1']){

I want to make it:if ($row['$VARIABLEg1']==$row['$VARIABLEw1']){

What is the correct syntax of doing this? its driving me insane!

  • 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-14T20:03:50+00:00Added an answer on June 14, 2026 at 8:03 pm

    The correct syntax is done by adding curly braces around the variable like so:

    $row["{$VARIABLE}g1"] == $row["{$VARIABLE}w1"]){
    

    Btw, it only works inside double quotes.

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

Sidebar

Related Questions

I have this code ,now can anyone reply s what happens to the lock
In Python I have this code: now = datetime.now().isoformat() if . not in now:
I have this code right now to get the row value from jquery grid..
I have this code in a xaml file now in a event handler code
I have this code: def display(self): print self.doc.toprettyxml(indent= ) strigName ='/Users/my_user/Desktop/python/' + str(datetime.datetime.now()) +
Right now, I have this code where $obj_arr maybe contain array and an object.
I have this working code, but now i need to be able to change
Right now, I have my code looking like this: SqlTables.java: // Separate file public
I have this div in my code: <div id=advice class=validation-advice style=>some text here</div> Now,
I have the following code: SPList list = web.Lists[this.ListName]; SPListItem item = list.Items.Add(); now

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.