// Hello, // I am facing problem in displaying data which is uploaded in web server. I am struggling since long but couldn't find a way out. // Can i get some help, please?
// I am attaching a part of the code i used for reference. Please let me know if there is any problem in the code or i need to check elsewhere?
//Thanks, //Love, Souvik
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "Combination";
if ($conn->connect_error){
die("Connection failed: ". $conn->connect_error);
}
function func_mol($conn, $result){
$keyword_query = $conn->real_escape_string($_GET['query']);
$keyword_query = explode(',', $keyword_query);
switch ($_GET['molecules']) {
case "Byprotein":
while ($row = $result->fetch_assoc()) {
echo '<tr>
<td class="text-center" width="20%">' . $row['Crop'] . '</td>
<td class="text-center" width="20%">' . $row['stress'] . '</td>
<td class="text-center" width="20%">' . $row['Gene_Id'] . '</td>
<td class="text-center" width="20%">' . $row['Gene_symbol'] . '</td>
<td class="text-center" width="20%">' . $row['Description'] . '</td>
<td class="text-center" width="20%">' . $row['proteins'] . '</td>
<td class="text-center" width="20%">' . $row['Source'] . '</td>
<td class="text-center" width="20%">' . $row['LinkToSource'] . '</td>
</tr>';
}
}
}
function sql_line($conn){
$keyword_query = $conn->real_escape_string($_GET['query']);
$keyword_query = explode(',', $keyword_query);
switch ($_GET['molecules']) {
case "Byprotein":
// $sql = "SELECT Crop,stress,Gene_Id,Gene_symbol,Description,proteins,Source,LinkToSource FROM Cropcs WHERE Crop='" . $keyword . "' AND stress='" . $keyword . "'";
$sql = "SELECT Crop,stress,Gene_Id,Gene_symbol,Description,proteins,Source,LinkToSource FROM Cropcs WHERE Crop = '" . $_GET['crop'] . "' AND stress = '" . $_GET['stress'] ."'";
@$i = 0;
foreach ($keyword_query as $queryKey) {
++$i;
$sql .= "Gene_Id = '" . $queryKey . "'";
}
}
}
switch ($keyword_crop) {
case "Bymalus":
switch ($keyword_stress) {
case "$sp1[0]":
sql_line($conn);
}
}
$result = $conn->query($sql);
if ($result->num_rows > 0) {
switch ($_GET['searchBytype']) {
case "Bymalus":
switch ($_GET['stresss']) {
case "$sp1[0]":
$queryKey->func_mol;
}
}
}
?>
Thank you. But the command already added before. Can you give other way to write the two functions and show the code?