Been trying to update this code to run on PHP 7.0 but it doesn’t show the right data from the database… Can anyone help with any suggestions?
<?php
function check_input($value)
{
global $db;
// Stripslashes
if (get_magic_quotes_gpc())
{
$value = stripslashes($value);
}
// Quote if not a number
if (!is_numeric($value))
{
$value = mysqli_real_escape_string($db, $value);
}
return $value;
}
if($_POST['searchvalue1'])
// Open the database and connect to it
{
$db = mysqli_connect("XXXXX", "XXXXX", "XXXXX");
mysqli_set_charset($db, "utf8");
mysqli_select_db($db, "XXXXX") or die(mysqli_error());
$searchvalue1 = check_input($_POST['searchvalue1']);
$searchvalue2 = check_input($_POST['searchvalue2']);
$searchvalue3 = check_input($_POST['searchvalue3']);
$sql="SELECT PIN, Status, RegRenewDate, DoNotShareData, RegRenewFeesWaived FROM XXXXX WHERE PIN ='$searchvalue1''-''$searchvalue2''-''$searchvalue3'";
$result = mysqli_query ( $db, $sql);
if(mysqli_num_rows($result) == 0)
{
<blockquote>
Sorry, that PIN does not exist in the database
</blockquote>
<p>Check your practitioner number and try again. Don't add any spaces or change the punctuation.</p>
<h3>Your number should look like this: ABC-9999-9999A</h3>
<form method="POST" action=" $PHP_SELF ">
<table border="0" cellspacing="2">
<tr><th>Insert your practitioner number</th>
</tr>
<tr>
<th><input type="text" name="searchvalue1" size="3" maxlength="3">-<input type="text" name="searchvalue2" size="4" maxlength="4">-<input type="text" name="searchvalue3" size="5" maxlength="5"></th>
</tr>
</table>
<p><input type="submit" value="Find" name="B11"></p>
</form>
<p>For help <>contact the Bach Centre</a>.</p>
<p>If you sent us a renewal or a change of status request recently we may not have had time to process your request. Before contacting us please wait another week and check your status again. Thank you!</p>
}
else {
$myrow = mysqli_fetch_array($result);
echo "<blockquote>".$myrow[PIN];
echo "<br><br>Your BFRP status: ".$myrow["Status"];
echo "<br>Renewal date (year-month-day): ".$myrow["RegRenewDate"];
echo "<br>Data protection status: ".$myrow["DoNotShareData"];
echo "<br>Registration fees waived?: ".$myrow["RegRenewFeesWaived"]."</blockquote>";
<p>If you sent us a renewal or a change of status request recently we may not have had time to process your request. Before contacting us please wait another week and check your status again. Thank you! </p>
<h1>What does it all mean?</h1>
<h3>BFRP status</h3>
<ul>
<li>RP means you are registered and listed for referrals</li>
<li>SP means you are registered but not listed for referrals; this is probably because you didn't confirm you are engaged in <Link>Continuing Professional Development</a> the last time you re-registered</li>
<li>XX means you are no longer on the Register; this is probably because you didn't renew your registration when asked to do so; <Link>re-register</a> by filling out the forms</li>
</ul>
<h3>Renewal date</h3>
<ul>
<li>This is the date that you are or were due to renew your registration</li>
<li>The Centre issues renewal reminders in September and November each year</li>
<li>Reminders go to everyone whose renewal date falls between 1st April of the present year and 31st March of next year</li>
<li>Some practitioners receive reminders after their renewal date, some before</li>
<li>If your reminder arrives after your renewal date, please renew as soon as you can</li>
<li>If your reminder is early you can renew anytime up to your renewal date</li>
<li>We work this way to reduce the administrative burden of collecting renewal fees; that in turn means we can charge you less</li>
<li>You don't have to wait for a reminder to renew; if you renew early the full number of years you pay for will be added to your current date</li>
<li>Failure to renew in a timely manner means you will be removed from the Register</li>
</ul>
<h3>Data protection status</h3>
<ul>
<li>'1' means you have told the not to pass your contact information to third parties who may publish referral lists of their own or offer services to BFRPs, e.g. people, distributors etc.</li>
<li>'0' means you <i>have</i> given us permission to share your information (NOTE: we do not sell your data and we are very careful who we share it with)</li>
</ul>
<h3>Registration fees waived</h3>
<ul>
<li>'1' means renewal fees have been waived; usually this is because you are 65 or over and are not doing any paid work involving the remedies</li>
<li>'0' means renewal fees have not been waived</li>
</ul>
<blockquote>
<>Contact us</a> if you think there has been an error
</blockquote>
mysqli_close($db);
}
}
else
{
<p>To start, type your practitioner number (PIN) into the box and click the <i>Find</i> button. Your practitioner number is on your Certificate of Registration.</p>
<H3>The format must be ABC-9999-9999A, i.e. three letters, hyphen, four numbers, hyphen, four numbers, one letter</h3>
<form method="POST" action=" $PHP_SELF ">
<table border="0" cellspacing="2">
<tr><th>Practitioner number</th>
</tr>
<tr>
<th><input type="text" name="searchvalue1" size="3" maxlength="3">-<input type="text" name="searchvalue2" size="4" maxlength="4">-<input type="text" name="searchvalue3" size="5" maxlength="5"></th>
</tr>
</table>
<p><input type="submit" value="Find" name="B11"></p>
</form>
<p>Can't find your practitioner number? <>Contact</a>.</p>
<p>If you sent us a renewal or a change of status request recently we may not have had time to process your request. Before contacting us please wait another week and check your status again. Thank you!</p>
}
<!-- SEARCH FUNCTION ENDS here -->
Cheers