Jump to content

gokhul

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Everything posted by gokhul

  1. I checked it. even though the mysql functions are in caps...its working. the query is giving the result "invalid query".
  2. but the id that is given is existing in the database.and one more thing is...i used the same code for another database and it is working. i am uanble to find why the results are not being displayed for this one. except the results...everything is being displayed.
  3. that is what I wrote $result=MYSQL_QUERY("SELECT * FROM initial WHERE id='$search'");
  4. Hi, Can you tell me why am I getting a blank results page even though I am giving the record that is in the database as the search term. The following is my code. <br><br> <?PHP $hostname = "localhost"; $username = "gkkilaru"; $password = "gkkilaru"; $database = "gkkilaru_db"; $search = $_POST["txtSearch"]; $choice = $_POST["txtChoice"]; MYSQL_CONNECT($hostname, $username, $password) or die ( "<H3>Server unreachable</H3>"); MYSQL_SELECT_DB($database) or die ( "<H3>Database non existent</H3>"); switch ($choice) { /////////////////////////////// INITIAL///////////////////////////////////// case "initial": $result=MYSQL_QUERY("SELECT * FROM initial WHERE id='$search'"); /* if (mysql_num_rows($result)>0) { echo "<table cellpadding='1' cellspacing='1' bordercolor="339900" width='800' border='1'>"; echo "<tr align='center'>"; echo "<td><b>id</b></td>"; echo "<td><b>dateenrolled</b></td>"; echo "<td><b>name</b></td>"; echo "<td><b>age</b></td>"; echo "<td><b>mrn</b></td>"; echo "<td><b>compounds</b></td>"; echo "<td><b>comments</b></td>"; echo "<td><b>doctor</b></td>"; echo "<td><b>compensation</b></td>"; echo "<td><b>liverbiopsy</b></td>"; echo "<td><b>exemption</b></td>"; echo "</tr>"; } //else { // echo "<tr align='center'><td>"; // echo "<p><font size='4' color='339900'>"; // echo "No Records Found!</p>"; // echo "</td></tr>"; } */ break; ////////////////////////////////////// SIX MONTH /////////////////////////////// case "six": $result=MYSQL_QUERY("SELECT * FROM six WHERE id='$search'"); /* if(mysql_num_rows($result)>0) { echo "<table cellpadding='1' cellspacing='1' bordercolor="339900" width='800' border='1'>"; echo "<tr align='center'>"; echo "<td><b>id</b></td>"; echo "<td><b>followup</b></td>"; echo "<td><b>datefollowup</b></td>"; echo "<td><b>comments</b></td>"; echo "<td><b>compensation</b></td>"; echo "<td><b>chronic</b></td>"; echo "<td><b>narrative</b></td>"; echo "<td><b>caseadj</b></td>"; echo "<td><b>liverbiopsy</b></td>"; echo "</tr>"; } else { // echo "<tr align='center'><td>"; // echo "<p><font size='4' color='339900'>"; // echo "No Records Found!</p>"; // echo "</td></tr>"; } */ break; //////////////////////////////// TWELVE MONTH////////////////////////////////// case "twelve": $result=MYSQL_QUERY("SELECT * FROM twelve WHERE id='$search'"); /* if(mysql_num_rows($result)>0) { echo "<table cellpadding='1' cellspacing='1' bordercolor="339900" width='800' border='1'>"; echo "<tr align='center'>"; echo "<td><b>id</b></td>"; echo "<td><b>followup</b></td>"; echo "<td><b>datecompleted</b></td>"; echo "<td><b>comments</b></td>"; echo "<td><b>compensation</b></td>"; echo "<td><b>narrative</b></td>"; echo "</tr>"; } else { // echo "<tr align='center'><td>"; // echo "<p><font size='4' color='339900'>"; // echo "No Records Found!</p>"; // echo "</td></tr>"; } */ break; } ?> </table> <br> <br> </form> </div> </td> </tr> </table></td> <td valign="top"> </td> </tr> </table> <table width="648" border="0" cellspacing="0" cellpadding="0"> </table> <br> </div> </body> </html> EDIT: Please use [code][/code] tags!
  5. Hello, Can anyone tell me about how to get the results in different pages? Right now, I am getting all the results in a single page, making it difficult for me to go through them. I want to get a particular number of results on a single page. The following is the code which I am using to get the results. $ncols=mysql_num_fields($result);/* How many columns (fields) */ $queryResults = NULL; if( mysql_num_rows($result)>0) { print "<br>"; print "<table cellpadding=0 cellspacing=0 width=100% border=1 bordercolor=skyblue>"; 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); } else { echo ("<h3>There is no data pertaining to your request</h3>"); } ?> </table> <br> <br> </form> </div> </td> </tr> </table></td> <td valign="top"> </td> </tr> </table> <table width="648" border="0" cellspacing="0" cellpadding="0"> </table> <br> </div> </body> </html>
  6. KEN.....THANKS a lot KEN. I owe a lot to you. its working. thanks once again.
  7. Please stay back ken... i will just check it.
  8. Hi, i have changed the date format to yyyy-mm-dd now. Can anyone tell me how to write the select statement to get the details in the database between any two given dates. Regards
  9. Yes..I am looking for the entire details in my database between any two given dates. I have the data in the following format. patient age gender consultdate 1 20 male 04/23/09 2 30 male 04/30/09 3 10 female 05/19/08 Sorry for giving the wrong data above. Now, If i say the range as 05/19/08 and 04/23/09....i should get all the three results. Can you tell me what should be my select statement. Regards.
  10. yaa... i mean the joining date and the leaving date. i have the date format in varchar now. so if i change the datatype to date, what statement should i use to get the details?
  11. hello, can anyone tell me how to get the result between the range of the following dates. name age gender joiningdate leavingdate xxx 10 male 04/23/09 05/22/09 yyy 11 female 01/02/09 08/02/09 zzz 12 male 04/26/09 04/28/09 How should I write the select statement such that I can get the details between any two given dates? Please help me.
  12. Its working. thanks a lot. Once again...you helped me a lot. Thanks once again.
  13. Hey ken...how are you? it was you..who helped me last time. nice meeting you once again. that code is not working. it is either giving the record of patient 3 or it is giving all the records in the table.
  14. Hello, Can anyone tell me how to get the result from 3 columns that have the same value. I have 5 columns namely patient age diag1 diag2 diag3 1 20 75 20 100 2 30 89 100 67 3 40 100 89 89 I need to get the total details as result that has a value 100 in either of the three columns(diag1,diag2,diag3). I am using the following code.... select * from patient where diag1 or diag2 or diag3=100; is that correct? Please help me.
  15. I use windows XP. I have one more que... what should be my database name if i am going to use it on my computer? is it the same as the drive name/ folder name?
  16. Hello, Can I use MySQL that has been installed on my laptop to create a databse and to use my hard drive as the server? Also, can I run the php scripts on this kind of servers? I appreciate your help.
  17. do you mean to $htmltable ="<table>" ? if so...i did...but the table is at one place and the results are at one place..in the page. can you tell me where to place exactly?
  18. hello, i am getting the results in two columns after using the following code... import_request_variables('p','p_'); $connect=mysql_connect('localhost','gkkilaru','gkkilaru') or die('could not open:'. mysql_error()); mysql_select_db('gkkilaru_db'); $result=mysql_query("SELECT * FROM human WHERE $p_Searchtype='$p_Search'"); function returnResultsInColumns( $mysqlResult ) { $queryResults = NULL; if( mysql_num_rows($mysqlResult) > 0 ) { while($resultRow = mysql_fetch_array($mysqlResult)) { for ($intPos = 0; $intPos < mysql_num_fields($mysqlResult); $intPos++) { $fieldName = mysql_field_name($mysqlResult, $intPos); $currentArrayPos = ( isset( $queryResults[$fieldName] ) ? count( $queryResults[$fieldName] ) : 0); $queryResults[$fieldName][$currentArrayPos] = $resultRow[$fieldName]; } } $htmlTable = "<table>"; foreach( $queryResults as $field => $results ) { $htmlTable.= "<tr>"; $htmlTable.= "<td>" . $field . "</td><td>" . implode( ", ", $results ) . "</td>"; $htmlTable.= "</tr>"; } $htmlTable.= "</table>"; return $htmlTable; } else { return "The query returned no results."; } } // Pass the result of the MySQL query into the function. $tableLayout = returnResultsInColumns($result); echo $tableLayout; can anyone let me know the code for how to place a border or table for the result obtained?
  19. mike.....thanks a lot thankkkkkkkkkkkksssssssssssssssss its working mike. one more doubt is like can we put the results in a table? please help regarding this one issue. plzzzzzzzzzzzzzzzzzzzzzzz mike.
  20. hey thank you... i got my desired results.... but it is giving an error like undefined index: genename and undefined index:unprot_id near the line $currentArrayPos = count( $queryResults[$fieldName] ); can u check this out.
  21. the results are coming in columns but the titles are in row forms itself. the result is like this keggid genename uniprotid xxx yyy zzz but i want the result as keggid xxx genename yyy uniprotid zzz thanks to everyone...who was helping me.
  22. please anyone....solve this
  23. its showing the same result...in the horizontal form itself.
  24. I didnt find any difference between my code and yours.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.