gokhul Posted April 15, 2009 Share Posted April 15, 2009 I have the following doubt. Please help me. 1. I use 2 tables HPD and HPD1. 2. Using a file "p3.php", I query HPD using an ID. 3. The result page "p4.php" gets me with the ID and the name related to it. 4. Now, I need to store the name in the result page and I need to call it in a file "p5.php". 5. "p5.php" queries for the data related to this name in HPD1. 6. Both HPD and HPD1 contains data related to the name. Please help me Link to comment https://forums.phpfreaks.com/topic/154266-storing-and-calling-a-variable/ Share on other sites More sharing options...
kenrbnsn Posted April 15, 2009 Share Posted April 15, 2009 Code? Ken Link to comment https://forums.phpfreaks.com/topic/154266-storing-and-calling-a-variable/#findComment-811040 Share on other sites More sharing options...
gokhul Posted April 16, 2009 Author Share Posted April 16, 2009 p3.php <HTML> <head><title>Human Pathway Database</title></head> <BODY> <?php echo("<h2><center>Human Pathway Database Search Wizard</center></h2>"); echo("<hr>"); echo("<center>Enter the details you want to search."); echo ("<form method=post action=p4.php>"); echo ("<center>Search: <input type=varchar name=search value=>"); echo ("<br><br>Search type: "); $connect=mysql_connect('localhost','*****','*****') ; mysql_select_db('gkkilaru_db'); /* Identify database */ $result = mysql_query('SELECT * FROM HPD'); /* Do the query */ $ncols=mysql_num_fields($result); /* How many columns (fields) */ echo("<select name=searchtype>"); for ( $i=0; $i <$ncols; $i++ ) { $column_name=mysql_field_name($result,$i); /* field name */ echo("<option value=".$column_name.">". $column_name. "</option>"); } echo ("</select>"); mysql_free_result($result); echo ("<br><br><input type=submit value=Submit><input type=reset value=Clear>"); echo ("</form>"); echo ("<br><center><a href=\"/~gkkilaru/p1.html\">Go Home</a></center>"); echo("</center><hr>"); ?> </BODY> </HTML> p4.php <HTML> <head><title>Human Pathway Database </title></head> <BODY> <?php echo("<h2><center>Results from Human Pathway Database</center></h2>"); echo("<hr>"); /*echo $_POST['search'];*/ /*echo $_REQUEST['search'];*/ import_request_variables('p','p_'); $connect=mysql_connect('localhost','*****','*****') or die('could not open:'. mysql_error()); mysql_select_db('gkkilaru_db'); /* Identify database */ $result=mysql_query("SELECT * FROM HPD WHERE $p_searchtype='$p_search'"); /*echo $p_searchname;*/ /*echo $p_searchtype;*/ $ncols=mysql_num_fields($result); /* How many columns (fields) */ print "<table cellpadding=0 cellspacing=0 width=100% border=1 >"; print "<tr>"; for ( $i=0; $i <$ncols; $i++ ) { $column_name=mysql_field_name($result,$i);/* field name */ print "<td align=center><b>".$column_name."</b></td>"; } print "</tr>"; $total=0; while ( $row = mysql_fetch_array($result) ) /* process result row-by-row */ { print "<tr>"; $total++; for ( $i=0; $i <$ncols; $i++ ) { $column_value=$row[$i]; /* field value */ print "<td align=center>".$column_value . "</td>"; } } mysql_free_result($result); echo ("<h3>Search for Result: Totally ". $total."- records found</h3>"); echo ("<br><center><a href=\"/~gkkilaru/p3.php\">Back</a></center>"); echo ("<br><center><a href=\"/~gkkilaru/p5.php\">View More</a></center>"); echo ("<hr>"); ?> </BODY> </HTML> p5.php <HTML> <head><title>Human Pathway Database</title></head> <BODY> <?php echo("<h2><center>Results from Human Pathway Database</center></h2>"); echo("<hr>"); /*echo $_POST['search'];*/ /*echo $_REQUEST['search'];*/ import_request_variables('p','p_'); $connect=mysql_connect('localhost','*****','*****') or die('could not open:'. mysql_error()); mysql_select_db('gkkilaru_db'); /* Identify database */ $result=mysql_query("select * from HPD1 where HPD1.Gene_Name = (SELECT Gene_Name FROM HPD WHERE KEGG_ID='$p_search')"); /*echo $p_searchname;*/ /*echo $p_searchtype;*/ $ncols=mysql_num_fields($result); /* How many columns (fields) */ print "<table cellpadding=0 cellspacing=0 width=100% border=1 >"; print "<tr>"; for ( $i=0; $i <$ncols; $i++ ) { $column_name=mysql_field_name($result,$i);/* field name */ print "<td align=center><b>".$column_name."</b></td>"; } print "</tr>"; $total=0; while ( $row = mysql_fetch_array($result) ) /* process result row-by-row */ { print "<tr>"; $total++; for ( $i=0; $i <$ncols; $i++ ) { $column_value=$row[$i]; /* field value */ print "<td align=center>".$column_value . "</td>"; } } mysql_free_result($result); echo ("<h3>Search for Result: Totally ". $total."- records found</h3>"); echo ("<br><center><a href=\"/~gkkilaru/p3.php\">Back</a></center>"); echo ("<br><center><a href=\"/~gkkilaru/p6.php\">View More</a></center>"); echo ("<hr>"); ?> </BODY> </HTML> (please use tags when posting code) Link to comment https://forums.phpfreaks.com/topic/154266-storing-and-calling-a-variable/#findComment-811108 Share on other sites More sharing options...
gokhul Posted April 16, 2009 Author Share Posted April 16, 2009 pLEASE ANYONE HELP ME Link to comment https://forums.phpfreaks.com/topic/154266-storing-and-calling-a-variable/#findComment-811592 Share on other sites More sharing options...
gokhul Posted April 17, 2009 Author Share Posted April 17, 2009 hello could anyone help me out? plzzzzzzz guys Link to comment https://forums.phpfreaks.com/topic/154266-storing-and-calling-a-variable/#findComment-812730 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.