hi.. i am a bioscience student i have develop a database which output is shwon in coulmns. here is its coding /////////////////////////////////////// <table align="center" border="1" width="800"> <tr> <td> <table align="center" border="1" width="100%"> <tr bgcolor="#DADADA"> <th>PRODUCT NAME </th> <th>DRUG NAME </th> <th> bio name </th> <th> solibiliuty </th> <th> drug formula </th> </tr> <?php if (isset($_GET['act']) and $_GET['act'] == 1) { $search = $_GET['search']; $sql_ser = "SELECT * FROM liposome WHERE drug_name LIKE '%".trim($search)."%'"; //'%.$search.%'"; $result_ser = mysql_query($sql_ser); //echo mysql_num_rows($result_ser); if (mysql_num_rows($result_ser) > 0) { while($row = mysql_fetch_array($result_ser)) { echo ' <tr bgcolor="#FFFFFF"> <td> '.$row['prod_name'].' </td> <td> '.$row['drug_name'].' </td> <td> '.$row['bio_name'].' </td> <td> '.$row['solibiliuty'].' </td> <td> '.$row['drug_formula'].' </td> </tr> '; } } } ?> </table> </td> </tr> </table> //////////////////////////////////// i want to display the result in that formate PRODUCT NAME result form dbn DRUG NAME rsult from the db BIO name result from the db solibiliuty result from the db DRUG FOMULA result from the db //////////////////// also when the drug formula is shwn in output then user click on it then it opens a new window containing the formula . and also looking for suggestions to make it more good. can some one help me?
I couldn't see the connection to database anywhere. I'm hoping you do it in a config.php file you include at the top of this script. It should look something like this: mysql_connect('localhost', 'username', 'password'); PHP: of course using your database connection info. to put a link on the formula you would replace <td> '.$row['drug_formula'].' </td> PHP: with: <td> <a href="formula.php?id='.$row['id'].'">'.$row['drug_formula'].'</a> </td> PHP: granted you have a primary key named id. if not, either create it or use some other unique field. in formula.php file you you would extract and display only the formula corresponding to that id.
if u want to see the results below the header as you have mentioned, u need to modify the table slightly as <TR><TH>PRODUCT NAME <TR><TD></TD></TR> <TR><TH>DRUG NAME <TR><TD></TD></TR> PHP: and so on........and display the results from the database..... However displaying in a more convenient manner would be as follows <TR><TD><TH>PRODUCT NAME</TD> <TD><TH>DRUG NAME </TD> PHP: and so on....and display the subsequent results below in the table
which file do u want to link with? it opens formula.php where u need to save the formulas by id's to display accordingly.