Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old April 12th, 2004, 02:38 PM
BlackLotus BlackLotus is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Greenville, SC
Posts: 25 BlackLotus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to BlackLotus Send a message via Yahoo to BlackLotus
Don't have a clue what these mean.....

I'm getting the following error messages when I try to run my PHP code:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:program filesapache groupapachehtdocsptvisionadmininsnewpatient.php on line 47

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:program filesapache groupapachehtdocsptvisionadmininsnewpatient.php on line 48


The two lines of code that the above errors are reffering to are:

$row = mysql_fetch_array($result);
$number = mysql_num_rows($result);


Please please help....I've been beating my head against a wall for this for two days...

Reply With Quote
  #2  
Old April 12th, 2004, 02:50 PM
sliver's Avatar
sliver sliver is offline
Moderator
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: WI, USA
Posts: 906 sliver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 21 m 10 sec
Reputation Power: 2
Send a message via AIM to sliver Send a message via XFire to sliver
RE: Don't have a clue what these mean.....

Try adding this right before those two lines:
php Code:
Original - php Code


Reply With Quote
  #3  
Old April 12th, 2004, 02:56 PM
BlackLotus BlackLotus is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Greenville, SC
Posts: 25 BlackLotus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to BlackLotus Send a message via Yahoo to BlackLotus
RE: Don't have a clue what these mean.....

okay now it's saying this:

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use nere ')' at line 1.... and then it repeats the above error messages...

Reply With Quote
  #4  
Old April 12th, 2004, 02:57 PM
BlackLotus BlackLotus is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Greenville, SC
Posts: 25 BlackLotus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to BlackLotus Send a message via Yahoo to BlackLotus
RE: Don't have a clue what these mean.....

but that's near impossible b/c the code on line one is simply...

<?php

Reply With Quote
  #5  
Old April 12th, 2004, 06:58 PM
opus006 opus006 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 65 opus006 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Don't have a clue what these mean.....

what does your code look like?

Reply With Quote
  #6  
Old April 12th, 2004, 08:32 PM
sliver's Avatar
sliver sliver is offline
Moderator
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: WI, USA
Posts: 906 sliver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 21 m 10 sec
Reputation Power: 2
Send a message via AIM to sliver Send a message via XFire to sliver
RE: Don't have a clue what these mean.....

No, that was a MySQL error. That error was on line one of your query.

Reply With Quote
  #7  
Old April 13th, 2004, 05:29 PM
BlackLotus BlackLotus is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Greenville, SC
Posts: 25 BlackLotus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to BlackLotus Send a message via Yahoo to BlackLotus
here is the code you asked about

php Code:
Original - php Code
  1.  
  2. <?php
  3.  
  4.  
  5. include("../common/db.php");
  6. $doby="";
  7. $dobm="";
  8. $dobd="";
  9. $dobiy="";
  10. $dobim="";
  11. $dobid="";
  12. $ssn1="";
  13. $ssn2="";
  14. $ssn3="";
  15. $fname="";
  16. $lname="";
  17. $middle="";
  18. $sex="";
  19. $mrn="";
  20. $occupation="";
  21. $account_number="";
  22. $age="";
  23. $ethnicity="";
  24. $therapist="";
  25. $tot_app_visits="";
  26. $physician="";
  27. $treatid="";
  28. $diagnosis="";
  29. $handdom="";
  30. $sympextrid="";
  31. $pastmedhist="";
  32. $surgerydet="";
  33. $chiefcomplaint="";
  34. $workrelated="";
  35. $comments="";
  36. $current_medications="";
  37.  
  38.  
  39. $dob="(".$doby."-".$dobm."-".$dobd.")";
  40. $initvisitdt = "(".$dobiy."-".$dobim."-".$dobid.")";
  41. $ssn="(".$ssn1."-".$ssn2."-".$ssn3.")";
  42.  
  43. $query = "select ssn from patientmaster where ssn=$ssn";
  44. $result = mysql_query($query);
  45. $row = mysql_fetch_array($result);
  46. $number = mysql_num_rows($result);
  47. if($number == 0) {
  48.  
  49. $query2="insert into patientmaster(fname, lname, middleinit, dob, sex, ssn, MRN, Occupation, account_number, age, ethnicity, therapist, tot_app_visits) values('".$fname."','".$lname."','".$middle."','".$dob."','".$sex."','".$ssn."','".$mrn."','".$occupation."','".$account_number."','".$age."','".$ethnicity."','".$therapist."','".$tot_app_visits."')";
  50.  
  51. @$mysql_query = mysql_query($query2);
  52. if (!$mysql_query){
  53.     die(mysql_error());
  54.     }
  55.  
  56. $justinserted_id = mysql_insert_id();
  57.  
  58. if($physician=="other") $physician=$phsc_txt;
  59. if($treatid=="other") $treatid=$treat_txt;
  60. $query3="insert into patientdetails(patient_id, treatorder, physician,diagnosis, initvisit,handdominance,symptomatic, pastmedhist, surgery, chiefcomplaint,workrelated,comments, current_medications)
  61. values(".$justinserted_id.",'".$treatid."','".$physician."','".$diagnosis."', '".$initvisitdt."','".$handdom."','".$sympextrid."','".$pastmedhist."','".$surgerydet."', '".$chiefcomplaint."','".$workrelated."','".$comments."', '".$current_medications."')";
  62. $mysql_query = mysql_query($query3);
  63. if ($mysql_query){
  64.     die(mysql_error());
  65.     }
  66.  
  67. $loc1 = "assessment.php?patientid=".$justinserted_id;
  68.  
  69. echo "<script language="JavaScript">n
  70. location.href='".$loc1."';n
  71. </script>nn";
  72.  
  73.  
  74. }elseif($number != 0) {
  75. ?><br><br><br>
  76. <center>
  77. <font size="+1" face="Verdana, Arial, Helvetica, sans-serif"
  78.  
  79. color="#990000">
  80. A patient with the same SSN is already in database.
  81. </font><br><br>
  82. <input type="button" value="Back" onClick="history.back()">
  83. </center>
  84. ?>
  85. }

Reply With Quote
  #8  
Old April 13th, 2004, 07:50 PM
-vertigo- -vertigo- is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Louth, Lincolnshire
Posts: 314 -vertigo- User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 24 sec
Reputation Power: 2
RE: Don't have a clue what these mean.....

php Code:
Original - php Code
  1. $ssn="(".$ssn1."-".$ssn2."-".$ssn3.")";
  2.  
  3. $query = "select ssn from patientmaster where ssn=$ssn";


The query is expecting a literal at the part 'where ssn=...', but you variable $ssn is something like "(01-23-45)". It ends up like 'where ssn=(01-23-45)'. This is causing the error. Change the query to be "where ssn='$ssn'".

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Don't have a clue what these mean.....


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |