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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:10:47+00:00 2026-06-01T00:10:47+00:00

How do you put php within php? The script below is where I am

  • 0

How do you put php within php? The script below is where I am trying to place the php within the php script. Near the bottom for the function boutique_product_name. That line of code has two separate instances of calling functions but it must nest within this mysql table. I’ve omitted alot of the code that was not necessary to display so it would be easier to follow. But it will eventually be a mysql table pulled from an xml file for magic the gathering cards. Which will include pricing data and the ability to buy the cards hence which is what the functions at the bottom are for.

I will still need to figure out how to make actual product pages for each card within the table but that’s for later.

So if anyone knows how in the world to place a

<?php
    $z = new xmlreader;
    $z->open('http://*****.com/wp-content/themes/*****/mtg/arb.xml'); // Your XML File name
    $doc = new DOMDocument;

    while ($z->read() && $z->name !== 'card');
    echo "<table border=1>
    <tr></tr>";

    while ($z->name === 'card')
    {
        $node = new SimpleXMLElement($z->readOuterXML());

        echo "<tr>

        <td><div class='id1'>".$node->id."</div></td>
        <td><div class='cardname1'>".$node->name."</div></td>
        <td><div class='set1'>".$node->set."</div></td>
        <td><div class='cardtype1'>".$node->type."</div></td>
        <td><div class='rarity1'>".$node->rarity."</div></td>
        <td><div class='manacost1'>".$node->manacost."</div></td>

        $id     =   $node->id;
        $name       =   $node->name;
        $set        =   $node->set;
        $type       =   $node->type;
        $rarity     =   $node->rarity;
        $manacost   =   $node->manacost;

        $sql = "INSERT INTO `*****_wrdp2`.`cards` 

        (`id`, `name`, `set`, `type`, `rarity`, `mana cost`) 
        VALUES 
        ('$id', '$name', '$set', '$type', '$rarity', '$manacost');";

        if(mysql_query($sql)) 
        {
            echo "<td><div class='error'><font color='green'><b>Success!</b></font></div></td></tr>";

            } else {

            echo "<td><div class='error'><font color='red'><b>Failure! (".mysql_error().")</b></font></div></td></tr>";
        }

        echo "<a href="#<?php echo boutique_product_name('offer'); ?>" class="add-to-cart et-shop-item"><?php esc_html_e('Add to cart','Boutique'); ?></a>";
        $z->next('card');
    }

    echo "</table>";
?>
  • 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-01T00:10:49+00:00Added an answer on June 1, 2026 at 12:10 am

    Technically, you are looking for “eval”, but I don’t think that is really what you want. You seem to be passing in the same argument to the function every time. If this is done well, then the same input should result in the same output.

    Can’t you just call:

     $prodName = boutique_product_name('offer');
    
     while ($z->name === 'card')
    {
        $node = new SimpleXMLElement($z->readOuterXML());
    
        echo "<tr>
    
        <td><div class='id1'>".$node->id."</div></td>
        <td><div class='cardname1'>".$node->name."</div></td>
        <td><div class='set1'>".$node->set."</div></td>
        <td><div class='cardtype1'>".$node->type."</div></td>
        <td><div class='rarity1'>".$node->rarity."</div></td>
        <td><div class='manacost1'>".$node->manacost."</div></td>";
        // notice that close quote!
    
        $id     =   $node->id;
        $name       =   $node->name;
        $set        =   $node->set;
        $type       =   $node->type;
        $rarity     =   $node->rarity;
        $manacost   =   $node->manacost;
    
        $sql = "INSERT INTO `*****_wrdp2`.`cards` 
    
        (`id`, `name`, `set`, `type`, `rarity`, `mana cost`) 
        VALUES 
        ('$id', '$name', '$set', '$type', '$rarity', '$manacost');";
    
        if(mysql_query($sql)) 
        {
            echo "<td><div class='error'><font color='green'><b>Success!</b></font></div></td></tr>";
    
            } else {
    
            echo "<td><div class='error'><font color='red'><b>Failure! (".mysql_error().")</b></font></div></td></tr>";
        }
    
        // note the escapes
        echo "<a href=\"#$prodName\" class=\"add-to-cart et-shop-item\"><?php esc_html_e('Add to cart','Boutique'); ?></a>";
        $z->next('card');
    }
    
    echo "</table>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php script that outputs a link element within a list element
My code below needs to put in a setInterval within a for loop. I
On Apache/PHP sites if I want to put a senstive file within my website
Okay I'm working in jQuery mobile, and I just put in a PHP script
In PHP, I've noticed people put the @ symbol in source code comments. One
I have a php script that outputs json data. For the purposes of testing,
I have a PHP script that when loaded, check first if it was loaded
I've got a PHP script in the works that is a job worker; its
I'm working in PHP. I have a function (F1) that gets called a variable
I am getting a really frustrating problem with my php script below. Everything works

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.