1

In my query, is it possible to echo out a php value? If not, is there any way just to pass in the value of the id player_id?

<?php
$New = '<p id="player_id"></p>';

// This outputs the correct value. How can I output
// what is inside of the <p> tag into the SQL Query?
echo $New


$A = 'LRAR';
   
$Class_Data = $wpdb->prepare("
        SELECT FLA, Date, Location_Name FROM Class_Date
        INNER JOIN Class_Location
        ON Class_Date.Location_ID = 
        Class_Location.Central_Location_ID
        INNER JOIN Course
        ON Class_Date.CourseID = Course.CourseID
        WHERE FLA = %s", $A);
        
        $Class_Data_Results =$wpdb->get_results( $Class_Data );

Outputting $A works fine, but I want to be able to output $New. How can I set my query to be equal to a value with HTML tags included?

2
  • You really should look into $wpdb::prepare() and read through the WPDB Dev page
    – Howdy_McGee
    May 4 at 16:50
  • Thank you for that. I was able to output simple strings such as $a = 'Some stuff here'. However, I am finding it difficult to be able to print out whole html tags. For instance, $a = '<p>Some stuff here</p>'
    – John Lyons
    May 4 at 17:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.