...but it's not applying properly. I am receiving a syntax error and a headache. Am I putting this in the wrong spot?

The $results variable is not being filled.

Edit: Code Added

Here's my connection...

<?php
mysql_connect("localhost", "jpcso_compliance", "abc*123") or die("Error connecting to database: ".mysql_error());
/*
localhost - it's location of the mysql server
root - username
third is your password
if connection fails it will stop loading the page and display an error
*/
mysql_select_db("jpcsolut_compliance") or die(mysql_error());
/* jpcsolut_webfro_HS is the name of database we've created */
?>

There is no other HTML formatting for the output, other than what is right here...

<div id="title">
<p><h1>Database Search Results</h1></p></div>
<br />
<div id="main_inner">
<?php
$query = $_GET['query'];
// gets value sent over search form
$min_length = 2;
// you can set minimum length of the query if you want
if(strlen($query) >= $min_length){ // if query length is more or equal minimum length then
$query = htmlspecialchars($query);
// changes characters used in html to their equivalents, for example: < to &gt;
$query = mysql_real_escape_string($query);
// makes sure nobody uses SQL injection
$raw_results = mysql_query("SELECT * FROM Compliance
WHERE (`Question` LIKE '%".$query."%') OR (`Sample Response / Must` LIKE '%".$query."%') OR (`Must` LIKE '%".$query."%') OR (`Can` LIKE '%".$query."%') OR (`Never` LIKE '%".$query."%') OR (`Tags` LIKE '%".$query."%')") or die(mysql_error());
// * means that it selects all fields, you can also write: `id`, `title`, `text`
// IllegitimateHighSchools is the name of our table
// '%$query%' is what we're looking for, % means anything, for example if $query is Hello
// it will match "hello", "Hello man", "gogohello", if you want exact match use `title`='$query'
// or if you want to match just full word so "gogohello" is out use '% $query %' ...OR ... '$query %' ... OR ... '% $query'
if(mysql_num_rows($raw_results) > 0){ // if one or more rows are returned do following
while($results = mysql_fetch_array($raw_results)){
// $results = mysql_fetch_array($raw_results) puts data from database into array, while it's valid it does the loop
echo "<p><strong><u><h2>Question:</u>&nbsp;".$results['Question']."".$results['text']."</h2></u></strong></p><br />";
echo "<p><strong>Sample Response / Must:</strong>&nbsp;".$results['Sample Response / Must']."".$results['text']."</p><br />";
//echo "<p><strong>Location:</strong>&nbsp;<a href='".$results['Location']."' target='_blank'>".$results['SchoolLocation']."</a>".$results['text']."</p><br />";
echo "<p><strong>Must:</strong>&nbsp;".$results['Must']."".$results['text']."</p><br />";
echo "<p><strong>Can:</strong>&nbsp;".$results['Can']."".$results['text']."</p><br />";
//echo "<p><strong>Never:</strong>&nbsp;".$results['Never']."".$results['text']."</p><br />";
echo "<span id=\"nevermsg\"><p><strong>Never:</strong>&nbsp;".$results['Never']."".$results['text']."</p></span><br />";
echo "<p><strong>_____________________________________________</strong>&nbsp;"."</p><br />";
echo "<p><strong>Tags:</strong>&nbsp;".$results['Tags']."".$results['text']."</p>";
// posts results gotten from database(title and text) you can also show id ($results['id'])
}
}
else{ // if there is no matching rows do following
echo "<br /><br /><br /><strong><h2>"."You have searched a term that is not in the database. Please contact <a href=\"mailto:" . htmlentities('email@domain.com') . "\">".htmlentities('email@domain.com') . "</a>, if you think this term should be added."."</h2></strong>";
}
}
else{ // if query length is less than minimum
echo "Minimum length is ".$min_length;
}
?>
<br />
<br />
<br />
<br />
<br />
<br />
</div>
<!--End of Inner Main-->

Additionally, here is a link to the site, where I've included a query in the URL here.

Lastly, I call the stylesheet 'global.css', which is where the style lives.

The top one is valid PHP. The bottom one, apparently is not.
–
webfrogsJul 25 '13 at 17:59

1

@webfrogs Then you need to post the your PHP code that makes the data base connection and the query. My guess is that is where it is failing.
–
defaultNINJAJul 25 '13 at 18:20

2

Is your question about the PHP syntax error, or the CSS "make it red" code? If it's about PHP, clarify your question to focus on that, and tag it PHP*. If it's about the CSS, remove all the PHP and provide raw HTML and CSS which demonstrate your problem.
–
KatieKJul 25 '13 at 18:23

1

First you index your result array with 'Never' then with an html tagged 'Never'. What are u trying to do?
–
MadeyedexterJul 25 '13 at 18:24

You may want to do a echo print_r($results); just see what the key and value is for each column being returned. It's fairly easy to then tweak code from there if your key isn't right.
–
defaultNINJAJul 25 '13 at 19:36

I did that. Curious about why you had me echo the question. Either way, it hasn't changed anything with styling the output of the "Never" line. You can re-review the link here
–
webfrogsJul 25 '13 at 19:45

I added your update, but all it did was repeat the results. Now, it's displaying two sets of results. You can view here
–
webfrogsJul 25 '13 at 19:49

@webfrogs that tells me that you don't need that second key out put. I removed it... still doesn't explain the lack of data. Have you done a echo print_r($results);? That will tell you what your actually returning. Do you mind just adding that line and I'll take a look at the output.
–
defaultNINJAJul 25 '13 at 19:55

The query is fine. I'm returning the results I want. I just want this line echo "<p><strong>Never:</strong>&nbsp;".$results['Never']."".$results['text']."</p><b‌​r />"; to return the results in the font color red.
–
webfrogsJul 25 '13 at 19:58