Adding php to call data in dynamically from database

Hi I’m trying to add the below Php to my page head so that I can call data into the body of my page any ideas how I can get this to work, see the code below:

<?php
$con = mysql_connect("localhost","root","root");
$db = mysql_select_db("rr_car_make",$con);
$get=mysql_query("SELECT car_make FROM rr_car_make ORDER BY car_make ASC");
$option = '';
while($row = mysql_fetch_assoc($get))
{
$option .= '<option value = "'.$row['car_make'].'">'.$row['car_make'].'</option>';
}
?>

<html>
<body>
<form>
 <select> 
<?php echo $option; ?>
</select>
</form>
</body>
</html>

Hello @Paullalley,

Thanks for posting in! Regretfully custom coding is beyond the scope of our support. We only cater getting your site set up, bug fixes and minor cosmetic changes.

Issues that might arise from the use of custom code and further enhancements should be directed to a third party developer.

Please check out this codex as it may help you achieve what you have in mind:
https://codex.wordpress.org/Custom_Queries
https://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query

Thank you for your understanding.

I can’t find the wp-header.php file to duplicate to my child theme?

Hi There @paullalley

You should be able to locate it under your relevant stack in the following location. For example, if you’re using Integrity stack.

/wp-content/themes/x/framework/legacy/cranium/headers/views/integrity/wp-header.php

To override the file in child theme, you need to create the same directory structure in your child theme as well. That is,

/wp-content/themes/x-child/framework/legacy/cranium/headers/views/integrity/wp-header.php

Hope that helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.