
gokhul
Members-
Posts
32 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
gokhul's Achievements

Newbie (1/5)
0
Reputation
-
I checked it. even though the mysql functions are in caps...its working. the query is giving the result "invalid query".
-
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.
-
that is what I wrote $result=MYSQL_QUERY("SELECT * FROM initial WHERE id='$search'");
-
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!
-
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>
-
KEN.....THANKS a lot KEN. I owe a lot to you. its working. thanks once again.
-
Please stay back ken... i will just check it.
-
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
-
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.
-
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?
-
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.
-
Its working. thanks a lot. Once again...you helped me a lot. Thanks once again.
-
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.
-
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.
-
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?