I am trying to produce a spreadsheet like page - right now ive got the information from the database being displayed and an additional page allowing the user to add information.
I cannot understand how i would call the database to display a set row. I am not running an AI id so that is out the question. I tried to implement one after but it resulted in my code not working and giving me a blank white page.
Here is the code i am using to display the database:
<?php
$link = mysql_connect('', '', '');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
//connect to the database
mysql_select_db('');
//query the database
$query = mysql_query("SELECT * FROM ");
echo "<table border='1'>
<tr>
<td class='td'>Date</td>
<td class='td'>Region</td>
<td class='td'>Cameraman</td>
<td class='td'>Livestream?</td>
<td class='td'>Event Title</td>
<td class='td'>Lecturer</td>
<td class='td'>Time</td>
<td class='td'>Speaker</td>
<td class='td'>ICE Contact</td>
<td class='td'>Venue Address</td>
<td class='td'>Venue Contact</td>
<td class='td'>Additional Comments</td>
<td class='td'>On App?</td>
<td class='td'>Edit</td>
<td class='td'>Delete</td>
</tr>";
WHILE($rows = mysql_fetch_array($query)):
$rows = array_filter($rows);
if (!empty($rows)) {
echo "<tr>";
echo "<td>" . $rows['date'] . "</td>";
echo "<td>" . $rows['region'] . "</td>";
echo "<td>" . $rows['cameraman'] . "</td>";
echo "<td>" . $rows['livestream'] . "</td>";
echo "<td>" . $rows['eventitle'] . "</td>";
echo "<td>" . $rows['lecturer'] . "</td>";
echo "<td>" . $rows['time'] . "</td>";
echo "<td>" . $rows['speaker'] . "</td>";
echo "<td>" . $rows['icecontact'] . "</td>";
echo "<td>" . $rows['venueaddress'] . "</td>";
echo "<td>" . $rows['venuecontact'] . "</td>";
echo "<td>" . $rows['additionalcomments'] . "</td>";
echo "<td>" . $rows['onapp'] . "</td>";
echo "<td><img src=""></td>";
echo "<td><img src=""></td>";
echo "</tr>";
}
endwhile;
echo "</table>";
?>
Any help would be appreciated.
Thanks
There was a quotes mismatch in the third last and second last line of the if block where you used double quotes within the double quotes which causes for syntax error. Here outer double quotes is replace with single quotes. Update the if block like this:
if (!empty($rows)) {
echo "<tr>";
echo "<td>" . $rows['date'] . "</td>";
echo "<td>" . $rows['region'] . "</td>";
echo "<td>" . $rows['cameraman'] . "</td>";
echo "<td>" . $rows['livestream'] . "</td>";
echo "<td>" . $rows['eventitle'] . "</td>";
echo "<td>" . $rows['lecturer'] . "</td>";
echo "<td>" . $rows['time'] . "</td>";
echo "<td>" . $rows['speaker'] . "</td>";
echo "<td>" . $rows['icecontact'] . "</td>";
echo "<td>" . $rows['venueaddress'] . "</td>";
echo "<td>" . $rows['venuecontact'] . "</td>";
echo "<td>" . $rows['additionalcomments'] . "</td>";
echo "<td>" . $rows['onapp'] . "</td>";
echo '<td><img src=""></td>';
echo '<td><img src=""></td>';
echo "</tr>";
}
Is it possible to have the table setup for each record instead of all the records in the database. I can do it with asp.net but can't figure how to do it with php. I just need a sample not the work done for me or a book or link that shows how to do it.
<?php
require_once("../db_connect.php");
error_reporting(E_ERROR | E_PARSE);
$sql = "SELECT id, lanId, name, department, manager, request, request_description, request_comments, status, comments, compUser, compDt FROM requests WHERE status='received'";
$results = mysql_query($sql) or die(mysql_error());
echo"Received Requests";
echo "<br><br>";
echo("<table bgcolor=F2F2F2 width=1000 border='2'>");
echo("<tr><th>Id</th><th>LanID</th><th>Name</th><th>Department Location</th><th>Manager</th><th>request</th><th>request_description</th><th>request_comments</th><th>Status</th><th>Comments</th><th>Completed User</th><th>Completed Date</th><th>Update</th></tr>");
while($row = mysql_fetch_array($results)){
echo("<tr>");
echo "<td>". $row['id'] . "</td>"
."<td>" . $row['lanId'] . "</td> "
. "<td>". $row['name'] . "</td>"
. "<td>". $row['department'] . "</td>"
. "<td>" . $row['manager'] . "</td>"
. "<td>" . $row['request'] ."</td>"
. "<td>" . $row['request_description'] ."</td>"
. "<td>" . $row['request_comments'] ."</td>"
. "<td>" . $row['status'] ."</td>"
. "<td>" . $row['comments'] ."</td>"
. "<td>" . $row['compUser'] ."</td>"
. "<td>" . $row['compDt'] ."</td>"
."<td><a href='../update.php?id=" . $row['id'] . "'>Update</a></td>";
echo '</tr>';
}
echo("</table>");
?>
<html>
<head>
<meta http-equiv="refresh" content="5" >
<title>
</title>
</head>
<body background="../images/background.jpg">
</body>
</html>
Yes
Just put the table tags inside the the while loop
echo("<table bgcolor=F2F2F2 width=1000 border='2'>");
while($row = mysql_fetch_array($results)){
echo("<tr><th>Id</th><th>LanID</th><th>Name</th><th>Department Location</th><th>Manager</th> <th>request</th><th>request_description</th><th>request_comments</th><th>Status</th><th>Comments</th> <th>Completed User</th><th>Completed Date</th><th>Update</th></tr>");
echo("<tr>");
echo "<td>". $row['id'] . "</td>"
."<td>" . $row['lanId'] . "</td> "
. "<td>". $row['name'] . "</td>"
. "<td>". $row['department'] . "</td>"
. "<td>" . $row['manager'] . "</td>"
. "<td>" . $row['request'] ."</td>"
. "<td>" . $row['request_description'] ."</td>"
. "<td>" . $row['request_comments'] ."</td>"
. "<td>" . $row['status'] ."</td>"
. "<td>" . $row['comments'] ."</td>"
. "<td>" . $row['compUser'] ."</td>"
. "<td>" . $row['compDt'] ."</td>"
."<td><a href='../update.php?id=" . $row['id'] . "'>Update</a></td>";
echo '</tr>';
echo("</table>");
}
while($row = mysql_fetch_array($query2testing)) {
echo "<tr>";
echo "<td><center>$i</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['matricNo'] . "</td>";
echo "<td><center>" . $row['LC'] . "</td>";
echo "<td>" . $row['Code'] . "</td>";
echo "<td>" . $row['Subject'] . "</td>";
if(!empty($row['Assignment1'])) {
echo "<td><center><font color='red'>" . $row['Assignment1'] . "</td>";
}
echo "<td><center>" . $row['Quiz'] . "</td>";
echo "<td><center>" . $row['Participation'] . "</td>";
echo "<td><center>" . $row['Attendance'] . "</td>";
echo "<td><center>" . $row['Exam'] . "</td>";
echo "</tr>";
$i++;
}
echo "</table>";
This is my simple code.
How to make my column red if assigment1 is null
and assigment1 is not null to blue
style="background-color:red;" and background-color:blue; is possibly what you are looking for. You did not specify how the columns should be painted so you might have to adjust this.
Just insert this to your columns or rows you want to apply the color:
e.g. for a row (guess this is your header):
echo "<td style="background-color:red;"><center><font color='blue'>" . $row['Assignment1'] . "</td>";
use this in the first echo
echo "<tr style='background-color:" . (($row['Assignment1'] === NULL) ? "red" : "blue") . "'>";
Please replace your code with below code:
while($row = mysql_fetch_array($query2testing))
{
echo "<tr>";
echo "<td><center>$i</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['matricNo'] . "</td>";
echo "<td><center>" . $row['LC'] . "</td>";
echo "<td>" . $row['Code'] . "</td>";
echo "<td>" . $row['Subject'] . "</td>";
if(!empty($row['Assignment1']))
{
echo "<td><center><font color='blue'>" . $row['Assignment1'] . "</td>";
}
else
{
echo "<td><center><font color='red'>" . $row['Assignment1'] . "</td>";
}
echo "<td><center>" . $row['Quiz'] . "</td>";
echo "<td><center>" . $row['Participation'] . "</td>";
echo "<td><center>" . $row['Attendance'] . "</td>";
echo "<td><center>" . $row['Exam'] . "</td>";
echo "</tr>";
$i++;
}
echo "</table>";
Try this:
while($row = mysql_fetch_array($query2testing))
{
echo "<tr>";
echo "<td><center>$i</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['matricNo'] . "</td>";
echo "<td><center>" . $row['LC'] . "</td>";
echo "<td>" . $row['Code'] . "</td>";
echo "<td>" . $row['Subject'] . "</td>";
if(!empty($row['Assignment1']))
{
echo "<td><center><font color='blue'>" . $row['Assignment1'] . "</td>";
}
else {
echo "<td><center><font color='red'>" . $row['Assignment1'] . "</td>";
}
echo "<td><center>" . $row['Quiz'] . "</td>";
echo "<td><center>" . $row['Participation'] . "</td>";
echo "<td><center>" . $row['Attendance'] . "</td>";
echo "<td><center>" . $row['Exam'] . "</td>";
echo "</tr>";
$i++;
}
echo "</table>";
Three (3) things:
Let's convert your MySQL to MySQLi. Just put else on to your if(empty($row['Assignment1'])). AND Border Color is what you want to change color, right?
<html>
<body>
<?php
$con=mysqli_connect("host","username","password","database");
if(mysqli_connect_errno()){
echo "Error".mysqli_connect_error();
}
$i=1;
$query2testing=mysqli_query($con,"SELECT * FROM yourTable");
echo "<table>";
while($row = mysqli_fetch_array($query2testing))
{
echo "<tr>";
echo "<td><center>$i</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['matricNo'] . "</td>";
echo "<td><center>" . $row['LC'] . "</td>";
echo "<td>" . $row['Code'] . "</td>";
echo "<td>" . $row['Subject'] . "</td>";
if(empty($row['Assignment1']))
{
echo "<td style='border: 1px solid red;'><center>" .$row['Assignment1'] . "</td>"; /* YOU WANT THE BORDER TO CHANGE COLOR, RIGHT? */
}
else {
echo "<td style='border: 1px solid blue;'><center>" .$row['Assignment1']."</td>"; /* YOU WANT THE BORDER TO CHANGE COLOR, RIGHT? */
}
echo "<td><center>" . $row['Quiz'] . "</td>";
echo "<td><center>" . $row['Participation'] . "</td>";
echo "<td><center>" . $row['Attendance'] . "</td>";
echo "<td><center>" . $row['Exam'] . "</td>";
echo "</tr>";
$i++;
}
echo "</table>";
?>
</body>
</html>
I am developing a php site to sort data for the exporting of terrestrial laser scanning data in a electrical design company. When one row of data is present the forms update in MYSQL fine, but as soon as I display 2 or more rows of data the multiple rows conflict with each other when the submit but is click.
My aim is to individually sort through each row of data separately and update via MYSQL when I click submit on the row. But like I said, multiple rows conflict. Can I some how re-code it to specify data entered in forms only on a certain row?
the problem also stems from wanting to display current existing data in each cell through the forms so I know which is entered and what is not.
I apologize immensely for the untidy coding, and as you may judge I am very new to this. It's not my profession.
while ($row = $result->fetch_object()) {
echo "<tr>";
echo '<td>' . $row->point_number . ' Delete</td>';
echo "<td>" . $row->easting . "</td>";
echo "<td>" . $row->northing . "</td>";
echo "<td>" . $row->reduced_level . "</td>";
echo "<td><input type='text' name='description' value='$row->description' size='2'/></td>";
echo "<td><input type='number' name='string_number' value='$row->string_number' size='1'/></td>";
echo "<td><input type='number' name='pole_number' value='$row->pole_number' size='1'/></td>";
// drop down menu for poles size
echo '<td><select name="pole_length">';
echo '<option>' . $row->pole_length . '</option>';
echo '<option value=' . $pole30 . '>30'</option>';
echo '<option value=' . $pole35 . '>35'</option>';
echo '<option value=' . $pole11 . '>11</option>';
echo '<option value=' . $pole12 . '>12</option>';
echo '<option value=' . $pole40 . '>40'</option>';
echo '<option value=' . $pole125 . '>12.5</option>';
echo '<option value=' . $pole13 . '>13</option>';
echo '<option value=' . $pole45 . '>45'</option>';
echo '<option value=' . $pole14 . '>14</option>';
echo '<option value=' . $pole15 . '>15</option>';
echo '<option value=' . $pole155 . '>15.5</option>';
echo '<option value=' . $pole17 . '>17</option>';
echo '<option value=' . $pole185 . '>18.5</option>';
echo '<option value=' . $pole20 . '>20</option>';
echo '</select></td>';
// echo '<td>' . $row[8] . '</td>';
// drop down menu for Pole strength
echo '<td><a>' . $row->pole_strength . ' </a><select name="pole_strength">';
echo '<option></option>';
echo '<option value=' . $poleA . '>A</option>';
echo '<option value=' . $poleB . '>B</option>';
echo '<option value=' . $pole5 . '>5</option>';
echo '<option value=' . $pole8 . '>8</option>';
echo '<option value=' . $pole12 . '>12</option>';
echo '<option value=' . $pole16 . '>16</option>';
echo '<option value=' . $pole20 . '>20</option>';
echo '</select></td>';
//echo '<td>' . $row[9] . '</td>';
// drop down menu for Pole Type
echo '<td><a>' . $row->pole_type . ' </a><select name="pole_type">';
echo '<option></option>';
echo '<option value=' . $poleWOOD . '>Wood</option>';
echo '<option value=' . $poleCONC . '>Concrete</option>';
echo '<option value=' . $poleSTEEL . '>Steel</option>';
echo '<option value=' . $poleSTOBIE . '>Stobie</option>';
echo '<option value=' . $poleIBCONC . '>I-be...Conc</option>';
echo '<option value=' . $poleFABST . '>Fab Steel</option>';
echo '</select></td>';
echo '<td>' . $row->pole_top. '</td>';
echo "<td><input type='text' name='remark' value='$row->remark'/></td>";
echo "<td>" . $row->circuitheight_1 . "</td>";
echo "<td>" . $row->circuitinsulatorleft_1 . "</td>";
echo "<td>" . $row->circuitremark_1 . "</td>";
echo "<td>" . $row->circuitheight_2 . "</td>";
echo "<td>" . $row->circuitinsulatorleft_2 . "</td>";
echo "<td>" . $row->circuitremark_2 . "</td>";
echo "<td>" . $row->circuitheight_3 . "</td>";
echo "<td>" . $row->circuitinsulatorleft_3 . "</td>";
echo "<td>" . $row->circuitremark_3 . "</td>";
echo "<td>" . $row->circuitheight_4 . "</td>";
echo "<td>" . $row->circuitinsulatorleft_4 . "</td>";
echo "<td>" . $row->circuitremark_4 . "</td>";
echo "<td>" . $row->circuitheight_5 . "</td>";
echo "<td>" . $row->circuitinsulatorleft_5 . "</td>";
echo "<td>" . $row->circuitremark_5 . "</td>";
echo "<td>" . $row->stayattachmentheight1 . "</td>";
echo "<td><button type='submit' name='submit' value=' . $row->point_number . '/>SEND</td>";
echo "</tr>";
}
echo "</table>";
if (isset($_POST['submit']))
{
$point_no = $_POST['submit'];
$point_number = substr($point_no, 2, 3);
$description = htmlentities($_POST['description'], ENT_QUOTES);
$string_number = htmlentities($_POST['string_number'], ENT_QUOTES);
$pole_number = htmlentities($_POST['pole_number'], ENT_QUOTES);
$pole_length = htmlentities($_POST['pole_length'], ENT_QUOTES);
$pole_strength = htmlentities($_POST['pole_strength'], ENT_QUOTES);
$pole_type = htmlentities($_POST['pole_type'], ENT_QUOTES);
$remark = htmlentities($_POST['remark'], ENT_QUOTES);
if ($description == '' || $string_number == '')
{
$error = 'ERROR: Please fill in all required fields!';
//echo "<h2>" . $row->$point_number . $easting . $northing . $reduced_level ."</h2>";
}
else
{
if ($stmt = $mysqli->prepare("UPDATE final SET description = ?, string_number = ?, pole_number = ?, pole_length = ?, pole_strength = ?, pole_type = ?, remark = ? WHERE point_number=?"))
{
$stmt->bind_param("siissssi", $description, $string_number, $pole_number, $pole_length, $pole_strength, $pole_type, $remark, $point_number);
$stmt->execute();
$stmt->close();
}
else
{
echo "ERROR: could not prepare SQL statement.";
}
}
My query string is $SQLstring = "SELECT name, address, city, state, zip, homephone, cellphone, position, shift, status, workedherebefore, previousemploymentdate, referred, empname, under18, friends, empname2, currentlyemployed, contactemployer, lawful, worktime, workweekends, dateavailable, desiredsalary, position1, from1, to1, duties1, company1, cophone1, startsalary, endsalary, reasonleaving1, supervisor1, contact1, position2, from2, to2, duties2, company2, cophone2, startsalary2,
endsalary2, reasonleaving2, supervisor2, contact2, position3, from3, to3, duties3, company3, cophone3, startsalary3, endsalary3, reasonleaving3, supervisor3, contact3, comments, training, otherqual, documents, dltype, dlstate, expdate, yearsdriving, movingviolations, hsname, hscity, hsstate, hsdates, collegename, collegecity, collegestate, collegedates, othername, othercity, otherstate, otherdates, licenseorcert, refname1, refbusiness1, reftitle1, refaddress1, refphone1, refname2, refbusiness2, reftitle2, refaddress2, refphone2, refname3, refbusiness3, reftitle3, refaddress3, refphone3,felony, iffelony, fired, iffired, resident, explanation, signed, q1, q2, q3, q4, mq1, mq2, mq3, mq4, mq5, mq6, mq7, mq8, mq9, mq10, mq11, mq12, mq13, mq14, mq15, mq16,
mq17, mq18, mq19, mq20, mq21, mq22, mq23, mq24, mq24b, mq25, mq25b, mq26, mq27a, mq27b, mq27c, mq28, mq29, mq30answer, disclosuresig, verify_name, other_names, dob, AES_DECRYPT(ssn,'$key') AS ssn FROM applications";
I query the results and then return them in a table. All of them work except for the AES_DECRYPT field (ssn). In the database it seems to have been encrypted fine, but this field in the query is returned as blank. Here is the rest of the code, just in case it's relevant:
$key="88b871WZ3SntWK67rN3l2J1SvMqsOjyk";
$QueryResult = #mysql_query($SQLstring, $conn) or die("Query Problem - "
. mysql_error($conn) . " - Error Number - "
. mysql_errno($conn));
$num_result = mysql_num_rows($QueryResult);
echo "<table>";
for ($i = 0; $i < $num_result; $i++)
{
$row = mysql_fetch_array($QueryResult);
echo "<tr>";
echo "<td>" . $row["name"] . "</td>";
echo "<td>" . $row["email"] . "</td>";
echo "<td>" . $row["address"] . "</td>";
echo "<td>" . $row["city"] . "</td>";
echo "<td>" . $row["state"] . "</td>";
echo "<td>" . $row["zip"] . "</td>";
echo "<td>" . $row["homephone"] . "</td>";
echo "<td>" . $row["cellphone"] . "</td>";
echo "<td>" . $row["position"] . "</td>";
echo "<td>" . $row["shift"] . "</td>";
echo "<td>" . $row["status"] . "</td>";
echo "<td>" . $row["workedherebefore"] . "</td>";
echo "<td>" . $row["previousemploymentdate"] . "</td>";
echo "<td>" . $row["referred"] . "</td>";
echo "<td>" . $row["empname"] . "</td>";
echo "<td>" . $row["under18"] . "</td>";
echo "<td>" . $row["friends"] . "</td>";
echo "<td>" . $row["empname2"] . "</td>";
echo "<td>" . $row["currentlyemployed"] . "</td>";
echo "<td>" . $row["contactemployer"] . "</td>";
echo "<td>" . $row["lawful"] . "</td>";
echo "<td>" . $row["worktime"] . "</td>";
echo "<td>" . $row["workweekends"] . "</td>";
echo "<td>" . $row["dateavailable"] . "</td>";
echo "<td>" . $row["desiredsalary"] . "</td>";
echo "<td>" . $row["position1"] . "</td>";
echo "<td>" . $row["from1"] . "</td>";
echo "<td>" . $row["to1"] . "</td>";
echo "<td>" . $row["duties1"] . "</td>";
echo "<td>" . $row["company1"] . "</td>";
echo "<td>" . $row["cophone1"] . "</td>";
echo "<td>" . $row["startsalary"] . "</td>";
echo "<td>" . $row["endsalary"] . "</td>";
echo "<td>" . $row["reasonleaving1"] . "</td>";
echo "<td>" . $row["supervisor1"] . "</td>";
echo "<td>" . $row["contact1"] . "</td>";
echo "<td>" . $row["position2"] . "</td>";
echo "<td>" . $row["from2"] . "</td>";
echo "<td>" . $row["to2"] . "</td>";
echo "<td>" . $row["duties2"] . "</td>";
echo "<td>" . $row["company2"] . "</td>";
echo "<td>" . $row["cophone2"] . "</td>";
echo "<td>" . $row["startsalary2"] . "</td>";
echo "<td>" . $row["endsalary2"] . "</td>";
echo "<td>" . $row["reasonleaving2"] . "</td>";
echo "<td>" . $row["supervisor2"] . "</td>";
echo "<td>" . $row["contact2"] . "</td>";
echo "<td>" . $row["position3"] . "</td>";
echo "<td>" . $row["from3"] . "</td>";
echo "<td>" . $row["to3"] . "</td>";
echo "<td>" . $row["duties3"] . "</td>";
echo "<td>" . $row["company3"] . "</td>";
echo "<td>" . $row["cophone3"] . "</td>";
echo "<td>" . $row["startsalary3"] . "</td>";
echo "<td>" . $row["endsalary3"] . "</td>";
echo "<td>" . $row["reasonleaving3"] . "</td>";
echo "<td>" . $row["supervisor3"] . "</td>";
echo "<td>" . $row["contact3"] . "</td>";
echo "<td>" . $row["comments"] . "</td>";
echo "<td>" . $row["training"] . "</td>";
echo "<td>" . $row["otherqual"] . "</td>";
echo "<td>" . $row["documents"] . "</td>";
echo "<td>" . $row["dltype"] . "</td>";
echo "<td>" . $row["dlstate"] . "</td>";
echo "<td>" . $row["expdate"] . "</td>";
echo "<td>" . $row["yearsdriving"] . "</td>";
echo "<td>" . $row["movingviolations"] . "</td>";
echo "<td>" . $row["hsname"] . "</td>";
echo "<td>" . $row["hscity"] . "</td>";
echo "<td>" . $row["hsstate"] . "</td>";
echo "<td>" . $row["hsdates"] . "</td>";
echo "<td>" . $row["collegename"] . "</td>";
echo "<td>" . $row["collegecity"] . "</td>";
echo "<td>" . $row["collegestate"] . "</td>";
echo "<td>" . $row["collegedates"] . "</td>";
echo "<td>" . $row["othername"] . "</td>";
echo "<td>" . $row["othercity"] . "</td>";
echo "<td>" . $row["otherstate"] . "</td>";
echo "<td>" . $row["otherdates"] . "</td>";
echo "<td>" . $row["licenseorcert"] . "</td>";
echo "<td>" . $row["refname1"] . "</td>";
echo "<td>" . $row["refbusiness1"] . "</td>";
echo "<td>" . $row["reftitle1"] . "</td>";
echo "<td>" . $row["refaddress1"] . "</td>";
echo "<td>" . $row["refphone1"] . "</td>";
echo "<td>" . $row["refname2"] . "</td>";
echo "<td>" . $row["refbusiness2"] . "</td>";
echo "<td>" . $row["reftitle2"] . "</td>";
echo "<td>" . $row["refaddress2"] . "</td>";
echo "<td>" . $row["refphone2"] . "</td>";
echo "<td>" . $row["refname3"] . "</td>";
echo "<td>" . $row["refbusiness3"] . "</td>";
echo "<td>" . $row["reftitle3"] . "</td>";
echo "<td>" . $row["refaddress3"] . "</td>";
echo "<td>" . $row["refphone3,felony"] . "</td>";
echo "<td>" . $row["iffelony"] . "</td>";
echo "<td>" . $row["fired"] . "</td>";
echo "<td>" . $row["iffired"] . "</td>";
echo "<td>" . $row["resident"] . "</td>";
echo "<td>" . $row["explanation"] . "</td>";
echo "<td>" . $row["signed"] . "</td>";
echo "<td>" . $row["q1"] . "</td>";
echo "<td>" . $row["q2"] . "</td>";
echo "<td>" . $row["q3"] . "</td>";
echo "<td>" . $row["q4"] . "</td>";
echo "<td>" . $row["mq1"] . "</td>";
echo "<td>" . $row["mq2"] . "</td>";
echo "<td>" . $row["mq3"] . "</td>";
echo "<td>" . $row["mq4"] . "</td>";
echo "<td>" . $row["mq5"] . "</td>";
echo "<td>" . $row["mq6"] . "</td>";
echo "<td>" . $row["mq7"] . "</td>";
echo "<td>" . $row["mq8"] . "</td>";
echo "<td>" . $row["mq9"] . "</td>";
echo "<td>" . $row["mq10"] . "</td>";
echo "<td>" . $row["mq11"] . "</td>";
echo "<td>" . $row["mq12"] . "</td>";
echo "<td>" . $row["mq13"] . "</td>";
echo "<td>" . $row["mq14"] . "</td>";
echo "<td>" . $row["mq15"] . "</td>";
echo "<td>" . $row["mq16"] . "</td>";
echo "<td>" . $row["mq17"] . "</td>";
echo "<td>" . $row["mq18"] . "</td>";
echo "<td>" . $row["mq19"] . "</td>";
echo "<td>" . $row["mq20"] . "</td>";
echo "<td>" . $row["mq21"] . "</td>";
echo "<td>" . $row["mq22"] . "</td>";
echo "<td>" . $row["mq23"] . "</td>";
echo "<td>" . $row["mq24"] . "</td>";
echo "<td>" . $row["mq24b"] . "</td>";
echo "<td>" . $row["mq25"] . "</td>";
echo "<td>" . $row["mq25b"] . "</td>";
echo "<td>" . $row["mq26"] . "</td>";
echo "<td>" . $row["mq27a"] . "</td>";
echo "<td>" . $row["mq27b"] . "</td>";
echo "<td>" . $row["mq27c"] . "</td>";
echo "<td>" . $row["mq28"] . "</td>";
echo "<td>" . $row["mq29"] . "</td>";
echo "<td>" . $row["mq30answer"] . "</td>";
echo "<td>" . $row["disclosuresig"] . "</td>";
echo "<td>" . $row["verify_name"] . "</td>";
echo "<td>" . $row["other_names"] . "</td>";
echo "<td>" . $row['ssn'] . "</td>";
echo "<td>" . $row["dob"] . "</td>";
echo "</tr>";
}
echo "</table>";
}
To use AES_ENCRYPT and AES_DECRYPT the field type must be BLOB. I had it set to VARCHAR and it wasn't recognizing some of the characters. Changing the field type to blob worked perfectly.
MySQL AES_DECRYPT() returns NULL if detects invalid data.
So the strings passed to the AES_DECRYPT() are invalid.
In this type of cases, I recommend to ECHO/alert the query so that you can see everything is right. The most probable mistake is what AD7six noted... the $key is probably empty.
$key="88b871WZ3SntWK67rN3l2J1SvMqsOjyk";
$SQLstring = "SELECT * FROM table"; // Replace with your Query
echo $SQLstring;
$QueryResult = #mysql_query($SQLstring, $conn) or die("Query Problem - " . mysql_error($conn) . " - Error Number - " . mysql_errno($conn));
Alerter:
echo "<script type='text/javascript'>
alert($SQLstring);
</script>";
I also recommend you read about mysqli