Zaloguj | Zarejestruj | FAQ
Anonymous

Not able to retrieve data

+ Odpowiedz

Posty: 1 Strona 1 z 1


Not able to retrieve data

przez SangpoSangpo » N mar 17, 2019 2:56 am

In local Machine
I have made php script to view data from my table. It it able to view my data.

But this same script and data table is not working on my website. I have changed the value of config while using in website. Example server name, password, username and database name.

1.action file
<a href="searchqcwildcard.php">search more records</a>


<?php
include('config_qc.php');
?>
<?php
$find1=$_POST["generic"];
$find2=$_POST["mfg"];
$find3=$_POST["mah"];
$find1=strtoupper($_POST["generic"]);
$find2=strtoupper($_POST["mfg"]);
$find3=strtoupper($_POST["mah"]);
$find1=strip_tags($find1);
$find2=strip_tags($find2);
$find3=strip_tags($find3);
$find1=trim($find1);
$find2=trim($find2);
$find3=strip_tags($find3);


$sql=mysql_query("SELECT * FROM qc_tbl WHERE generic LIKE '$find1%' && mfg LIKE '$find2%' && mah LIKE '$find3%' ORDER By generic ASC");

//$result = mysql_query($sql);

?>
<table width="400" border="0" cellspacing="1" cellpadding="1" bgcolor="#CCCCCC">
<tr>
<td>
<table width="400" border="1" cellspacing="0" cellpadding="0">
<tr>
<td colspan="25"><strong>Detail list of products sent for qc testing </strong> </td>
</tr>

<tr>

<td align="center"><strong>ID</strong></td>
<td align="center"><strong>Date sent</strong></td>
<td align="center"><strong>Fileno</strong></td>
<td align="center"><strong>Sammple code no</strong></td>
<td align="center"><strong>Brand name</strong></td>
<td align="center"><strong>Generic name</strong></td>
<td align="center"><strong>Batch no</strong></td>
<td align="center"><strong>mdate</strong></td>
<td align="center"><strong>Expiry date</strong></td>
<td align="center"><strong>Standard boo</strong></td>
<td align="center"><strong>Manufacurer</strong></td>
<td align="center"><strong>Market Authh holder</strong></td>
<td align="center"><strong>Sample Quantity</strong></td>
<td align="center"><strong>Test requested</strong></td>
<td align="center"><strong>Nature of problem</strong></td>
<td align="center"><strong>Result qc</strong></td>
<td align="center"><strong>QC failed or passed</strong></td>
<td align="center"><strong>Date of committee meeting</strong></td>
<td align="center"><strong>Class of defect</strong></td>
<td align="center"><strong>Class of Recall</strong></td>
<td align="center"><strong>Action taken</strong></td>
<td align="center"><strong>Recall letter no</strong></td>
<td align="center"><strong>Despched no</strong></td>
<td align="center"><strong>Date of QC rresult recived</strong></td>
<td align="center"><strong>Remark</strong></td>
<td align="center"><strong>enterby</strong></td>
<td align="center"><strong>entrydate</strong></td>
</tr>

<?php
//while($rows = mysql_fetch_assoc($result)){
while($rows = mysql_fetch_assoc($sql))
{
?>

<td bgcolor="#FFFFFF"><?php echo $rows['id']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['datesent']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['fileno']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['codesample']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['brand']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['generic']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['bno']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['mdate']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['edate']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['stdbook']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['mfg']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['mah']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['qty']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['testrequested']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['reasonforqc']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['qcresult']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['pass_fail']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['datecommittee']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['defectclass']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['recallclass']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['actiontaken']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['recallletterno']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['despdate']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['dateresultreceived']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['remarks']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['dateandtime']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['enterby']; ?></td>
</tr>

<?php
}
?>

</table>
</td>
</tr>
</table>
<?php
mysql_close();

?>

<br>
<br>

<?php
$anymatches=mysql_num_rows($sql);
if ($anymatches==0)
{
echo "<b> Sorry we cannot find entry that matches your search query";
}

?>
2.form.

<b>Please enter first few letters of what you are searching for. To dispaly all records, just click search button.
<br>
<br>
<form name="search" method="post" action="searchqcwildcard_ac.php">

Search by Generic name:<input type="text" name="generic">

<br>
Search by Manufacturer:<input type="text" name="mfg">
<br>
Search by Market authorization holder:<input type="text" name="mah">

<input type="hidden" name="searching" value="yes" />
<input type="submit" name="search" value="Search"/>

<input type="reset" name="reset" value="reset"/>

</form>

<a HREF=qcpage.php>Finished Searching</a>
3.config file
<?php
$username = "u123950792_suser";
$password = "123456";
$db_name = "u123950792_sdata";
$server = "mysq.hostinger.com";
//Connect to server and select database.
mysql_connect("$server", "$username", "$password")or die("cannot connect to server");
mysql_select_db("$db_name")or die("cannot select DB");

?>


Please kindly explain why not working.
Thank you
Avatar użytkownika

SangpoSangpo

  • Posty: 2
  • Dołączył(a): N mar 17, 2019 2:54 am


+ Odpowiedz

Strona 1 z 1