User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 429,965 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,576 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 1325 | Replies: 3
Reply
Join Date: Mar 2007
Posts: 2
Reputation: webbyboy is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
webbyboy webbyboy is offline Offline
Newbie Poster

Serious problem here.. Warning: mysql_query(): 2 is not a valid............

  #1  
Mar 8th, 2007
When i try to access this page: it shows this:

Warning: mysql_query(): 2 is not a valid MySQL-Link resource in /user/langlab/wwwhome/signup/signup_adm.html on line 28

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /user/langlab/wwwhome/signup/signup_adm.html on line 29

Warning: mysql_query(): 2 is not a valid MySQL-Link resource in /user/langlab/wwwhome/signup/signup_adm.html on line 36

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /user/langlab/wwwhome/signup/signup_adm.html on line 37

Warning: mysql_query(): 2 is not a valid MySQL-Link resource in /user/langlab/wwwhome/signup/signup_adm.html on line 44

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /user/langlab/wwwhome/signup/signup_adm.html on line 45


Warning: mysql_close(): 2 is not a valid MySQL-Link resource in /user/langlab/wwwhome/signup/signup_adm.html on line 580





I don't know whats going though but on the same db account i added a few more db file for a forum and this happens..i hope someone can help me.. A BIG THANKS!

  1. <?
  2. $DbConn = mysql_connect("localhost", "langlab", "djgkrdnjs");
  3. mysql_select_db("langlab", $DbConn);
  4.  
  5. //--- 관리자인지 체크한다. ----------------------------
  6. $Query = "SELECT count(kname) FROM s_master WHERE kname='$nm' AND juminno='$jm1-$jm2'";
  7. $DbResult = mysql_query($Query);
  8. $Cnts = mysql_result($DbResult,0,0);
  9. if(!$Cnts){
  10. exit;
  11. }
  12. ?>
  13.  
  14. <?
  15. include "top_adm.html";
  16. ?>
  17.  
  18. <?
  19. $msg = "수강신청 리스트가 표시 됩니다.";
  20.  
  21. if($tag==""){
  22. $msg = "";
  23.  
  24. $Query = "SELECT s_kwamok.haksuno,kwname,youil,s_kwamok.sigan,teacher,amount,inwonsu,kname,sgntime";
  25. $Query .= ",phone1,phone2,email,hakkwa,hakbun,hakyeon,reading,dungrok,s_haksang.juminno ";
  26. $Query .= "FROM s_kwamok,s_signup,s_haksang WHERE dungrok='on' AND s_kwamok.yearh='$ggyearh' AND s_signup.yearh='$ggyearh' AND s_haksang.yearh='$ggyearh' ";
  27. $Query .= "AND s_signup.juminno=s_haksang.juminno AND s_kwamok.haksuno=s_signup.haksuno AND gubn LIKE '%$gb%' ORDER BY sgntime DESC";
  28. $Result = mysql_query($Query, $DbConn);
  29. $TotalCnt = mysql_num_rows($Result);
  30. $msg1 = "등록건수 : " . $TotalCnt . "";
  31.  
  32. $Query = "SELECT s_kwamok.haksuno,kwname,youil,s_kwamok.sigan,teacher,amount,inwonsu,kname,sgntime";
  33. $Query .= ",phone1,phone2,email,hakkwa,hakbun,hakyeon,reading,dungrok,s_haksang.juminno ";
  34. $Query .= "FROM s_kwamok,s_signup,s_haksang WHERE reading='on' AND s_kwamok.yearh='$ggyearh' AND s_signup.yearh='$ggyearh' AND s_haksang.yearh='$ggyearh' ";
  35. $Query .= "AND s_signup.juminno=s_haksang.juminno AND s_kwamok.haksuno=s_signup.haksuno AND gubn LIKE '%$gb%' ORDER BY sgntime DESC";
  36. $Result = mysql_query($Query, $DbConn);
  37. $TotalCnt = mysql_num_rows($Result);
  38. $msg2 = "확인건수 : " . $TotalCnt . ", ";
  39.  
  40. $Query = "SELECT s_kwamok.haksuno,kwname,youil,s_kwamok.sigan,teacher,amount,inwonsu,kname,sgntime";
  41. $Query .= ",phone1,phone2,email,hakkwa,hakbun,hakyeon,reading,dungrok,s_haksang.juminno ";
  42. $Query .= "FROM s_kwamok,s_signup,s_haksang WHERE s_kwamok.yearh='$ggyearh' AND s_signup.yearh='$ggyearh' AND s_haksang.yearh='$ggyearh' ";
  43. $Query .= "AND s_signup.juminno=s_haksang.juminno AND s_kwamok.haksuno=s_signup.haksuno AND gubn LIKE '%$gb%' ORDER BY sgntime DESC";
  44. $Result = mysql_query($Query, $DbConn);
  45. $TotalCnt = mysql_num_rows($Result);
  46.  
  47. $msg = "총건수 : " . $TotalCnt . ", " . $msg2 . $msg1;
  48.  
  49. echo("<table border=0 width='95%' cellpadding='1' cellspacing='0' bordercolor='silver' bordercolordark='white' bordercolorlight='gray'>");
  50. echo(" <tr>");
  51. echo(" <td><b>* 수강신청 과목 리스트</b> (<font color=navy>$msg</font>)</td>");
  52. echo(" </tr>");
  53. echo("</table>");
  54.  
  55. echo("<table border=1 width='95%' cellpadding='1' cellspacing='0' bordercolor='silver' bordercolordark='white' bordercolorlight='gray'>");
  56. echo("<tr bgcolor=#eeeeee>");
  57. echo("<td>순번</td>");
  58. echo("<td>날자 시간</td>");
  59. echo("<td>이름</td>");
  60. echo("<td>학수<br>번호</td>");
  61. echo("<td>과목명</td>");
  62. echo("<td>요일</td>");
  63. echo("<td>시간</td>");
  64. echo("<td>집전화</td>");
  65. echo("<td>휴대폰</td>");
  66. //echo("<td>이메일</td>");
  67. //echo("<td>학생정보(학번,학과,학년)</td>");
  68. echo("<td>확인</td>");
  69. echo("<td>등록</td>");
  70. echo("</tr>");
  71.  
  72. if($TotalCnt >= 1){
  73. $sno = 1;
  74. while($Row = mysql_fetch_array($Result)){
  75. echo("<tr>");
  76. echo("<td align=center>" . $sno++ . "</td>");
  77. //echo("<td>" . substr($Row["sgntime"],0,10) . "</td>");
  78. echo("<td>" . $Row["sgntime"] . "</td>");
  79. echo("<td><a href=signup_adm.html?gb=$gb&tag=detail&ssyearh=$ggyearh&srnum=" . substr($Row["juminno"],7,7) . $Row["haksuno"] . substr($Row["juminno"],0,6) . ">" . $Row["kname"] . "</a></td>");
  80. echo("<td>" . $Row["haksuno"] . "</td>");
  81. echo("<td>" . $Row["kwname"] . "</td>");
  82. echo("<td>" . $Row["youil"] . "&nbsp;</td>");
  83. echo("<td>" . $Row["sigan"] . "</td>");
  84. //echo("<td>" . $Row["roomno"] . "&nbsp;</td>");
  85. echo("<td>" . $Row["phone1"] . "</td>");
  86. echo("<td>" . $Row["phone2"] . "</td>");
  87. //echo("<td>" . $Row["email"] . "</td>");
  88. //echo("<td>" . $Row["hakbun"] . "," . $Row["hakkwa"] . "," .$Row["hakyeon"] . "</td>");
  89. if($Row["reading"]=="on") echo("<td><font color=blue>확인</font></td>");
  90. else echo("<td>미확인</td>");
  91. if($Row["dungrok"]=="on") echo("<td><font color=red>등록</font></td>");
  92. else echo("<td>미등록</td>");
  93. echo("</tr>");
  94. }
  95. }else{
  96. echo("<tr>");
  97. echo("<td colspan=12 height=25 align=center>현재 신청된 자료가 없습니다.</td>");
  98. echo("</tr>");
  99. }
  100. echo("</table>");
  101. }
  102.  
  103. if($tag=="detail"){
  104. $Query = "SELECT juminno,kname,ename,hakkwa,hakyeon,hakbun,phone1,phone2,htime,email FROM s_haksang WHERE yearh='$ggyearh' AND juminno='" . substr($srnum,11,6). "-" . substr($srnum,0,7) . "'";
  105. $Result = mysql_query($Query, $DbConn);
  106. $Row = mysql_fetch_array($Result);
  107. ?>
  108. <table border=0 width='100%' cellpadding="1" cellspacing="0" bordercolor="silver" bordercolordark="white" bordercolorlight="gray">
  109. <tr>
  110. <td><b>* 신청자 기본정보</b></td>
  111. </tr>
  112. </table>
  113. <table border=1 width='600' cellpadding="1" cellspacing="0" bordercolor="silver" bordercolordark="white" bordercolorlight="gray">
  114. <tr>
  115. <td align=right bgcolor=#eeeeee width='20%'>이름(한글)&nbsp;</td>
  116. <td width='30%'>&nbsp;<?=$Row["kname"]?> (<?=$Row["juminno"]?>)</td>
  117. <td align=right bgcolor=#eeeeee width='20%'>이름(영문)&nbsp;</td>
  118. <td width='30%'>&nbsp;<?=$Row["ename"]?>&nbsp;</td>
  119. </tr>
  120.  
  121. <tr>
  122. <td align=right bgcolor=#eeeeee>학과&nbsp;</td>
  123. <td>&nbsp;<?=$Row["hakkwa"]?>&nbsp;</td>
  124. <td align=right bgcolor=#eeeeee>학번&nbsp;</td>
  125. <td>&nbsp;<?=$Row["hakbun"]?>&nbsp;</td>
  126. </tr>
  127.  
  128. <tr>
  129. <td align=right bgcolor=#eeeeee>학년&nbsp;</td>
  130. <td>&nbsp;<?=$Row["hakyeon"]?>&nbsp;</td>
  131. <td align=right bgcolor=#eeeeee>연락처(집)&nbsp;</td>
  132. <td>&nbsp;<?=$Row["phone1"]?>&nbsp;</td>
  133. </tr>
  134.  
  135. <tr>
  136. <td align=right bgcolor=#eeeeee>연락처(휴대폰)&nbsp;</td>
  137. <td>&nbsp;<?=$Row["phone2"]?>&nbsp;</td>
  138. <td align=right bgcolor=#eeeeee>이메일&nbsp;</td>
  139. <td>&nbsp;<?=$Row["email"]?>&nbsp;</td>
  140. </tr>
  141.  
  142. <tr>
  143. <td align=right bgcolor=#eeeeee>희망 시간&nbsp;</td>
  144. <td colspan=3>&nbsp;<?=$Row["htime"]?>&nbsp;</td>
  145. </tr>
  146. </table>
  147.  
  148. <br>
  149.  
  150. <?
  151. $Query = "SELECT s_kwamok.haksuno,kwname,youil,s_kwamok.sigan,teacher,amount,inwonsu,reading,dungrok,roomno,sgntime FROM s_kwamok,s_signup WHERE s_kwamok.yearh='$ggyearh' AND s_kwamok.haksuno=s_signup.haksuno AND s_signup.haksuno='" . substr($srnum,7,4). "' AND juminno='" . substr($srnum,11,6). "-" . substr($srnum,0,7) . "'";
  152. $Result = mysql_query($Query, $DbConn);
  153. $TotalCnt = mysql_num_rows($Result);
  154.  
  155. echo("<table border=0 width='95%' cellpadding='1' cellspacing='0' bordercolor='silver' bordercolordark='white' bordercolorlight='gray'>");
  156. echo(" <tr>");
  157. echo(" <td><b>* 수강신청 과목 리스트</b> (<font color=red>$msg</font>)</td>");
  158. echo(" </tr>");
  159. echo("</table>");
  160.  
  161. echo("<table border=1 width='95%' cellpadding='1' cellspacing='0' bordercolor='silver' bordercolordark='white' bordercolorlight='gray'>");
  162. echo("<tr bgcolor=#eeeeee>");
  163. echo("<td>학수<br>번호</td>");
  164. echo("<td>과목명</td>");
  165. echo("<td>요일</td>");
  166. echo("<td>시간</td>");
  167. echo("<td>강의실</td>");
  168. echo("<td>교수명</td>");
  169. echo("<td>수강료</td>");
  170. echo("<td>인원<br>제한</td>");
  171. echo("<td>등록<br>시간</td>");
  172. echo("</tr>");
  173. if($TotalCnt >= 1){
  174. while($Row = mysql_fetch_array($Result)){
  175. echo("<tr>");
  176. echo("<td>" . $Row["haksuno"] . "</td>");
  177. echo("<td>" . $Row["kwname"] . "</td>");
  178. echo("<td>" . $Row["youil"] . "&nbsp;</td>");
  179. echo("<td>" . $Row["sigan"] . "</td>");
  180. echo("<td>" . $Row["roomno"] . "&nbsp;</td>");
  181. echo("<td>" . $Row["teacher"] . "&nbsp;</td>");
  182. echo("<td>" . number_format($Row["amount"]) . "</td>");
  183. echo("<td>" . $Row["inwonsu"] . "</td>");
  184. echo("<td>" . $Row["sgntime"] . "</td>");
  185. echo("</tr>");
  186. $temp_r = $Row["reading"];
  187. $temp_d = $Row["dungrok"];
  188. }
  189. }else{
  190. echo("<tr>");
  191. echo("<td colspan=7 height=25 align=center>현재 신청된 과목이 없습니다.</td>");
  192. echo("</tr>");
  193. }
  194. echo("</table>");
  195.  
  196. echo("<form name=chk method=post action=signup_adm.html>");
  197. echo("<input type=hidden name=tag value=chkupd>");
  198. echo("<input type=hidden name=ssyearh value=$ggyearh>");
  199. echo("<input type=hidden name=gb value=$gb>");
  200. echo("<input type=hidden name=srnum value=$srnum>");
  201.  
  202. echo("<table border=1 cellpadding='1' cellspacing='0' bordercolor='silver' bordercolordark='white' bordercolorlight='gray'>");
  203. echo(" <tr>");
  204. echo(" <td>");
  205. if($temp_r=="on"){
  206. echo("확인 : <input type=checkbox name=reading checked value="ON">&nbsp;&nbsp;");
  207. }else{
  208. echo("확인 : <input type=checkbox name=reading value="ON">&nbsp;&nbsp;");
  209. }
  210. echo(" </td>");
  211. echo(" <td>");
  212. if($temp_d=="on"){
  213. echo("등록 : <input type=checkbox name=dungrok checked value="ON">");
  214. }else{
  215. echo("등록 : <input type=checkbox name=dungrok value="ON">");
  216. }
  217. echo(" </td>");
  218. echo(" <td>");
  219. echo("삭제 : <input type=checkbox name=sakjae value="ON">");
  220. echo(" </td>");
  221. echo(" </tr>");
  222. echo("</table>");
  223. echo("<br><br>
  224. <input type=image src=images/sin_info_save.gif border=0 width="179" height="21">");
  225. echo("</form>");
  226. }
  227.  
  228. if($tag=="chkupd"){
  229. $Query = "UPDATE s_signup SET reading='$reading',dungrok='$dungrok' WHERE yearh='$ggyearh' AND haksuno='" . substr($srnum,7,4) . "' AND juminno='" . substr($srnum,11,6). "-" . substr($srnum,0,7) . "'";
  230. $Result = mysql_query($Query, $DbConn);
  231.  
  232. if($sakjae=="on"){
  233. $Query = "DELETE FROM s_signup WHERE yearh='$ggyearh' AND haksuno='" . substr($srnum,7,4) . "' AND juminno='" . substr($srnum,11,6). "-" . substr($srnum,0,7) . "'";
  234. $Result = mysql_query($Query, $DbConn);
  235. }
  236.  
  237. echo("<form name=chk method=post action=signup_adm.html>");
  238. echo("<input type=hidden name=tag value=''>");
  239. echo("<input type=hidden name=ssyearh value=$ggyearh>");
  240. echo("<input type=hidden name=gb value=$gb>");
  241. echo("</form>");
  242. echo("<script language=javascript> document.chk.submit(); </script>");
  243. }
  244.  
  245. if($tag=="2"){
  246. if($tag2=="copy"){
  247. //$Query = "UPDATE s_ggyear SET ggcode='0' WHERE yearh='$ggyearh'";
  248. $Query = "UPDATE s_ggyear SET ggcode='0'";
  249. $Result = mysql_query($Query, $DbConn);
  250.  
  251. $Query = "INSERT INTO s_ggyear VALUES ('$nyear-$nhaki','1')";
  252. $Result = mysql_query($Query, $DbConn);
  253.  
  254. //$Query = "SELECT * FROM s_kwamok WHERE yearh='$ggyearh'";
  255. //$Result = mysql_query($Query, $DbConn);
  256. //while($Row = mysql_fetch_array($Result)){
  257. // $Query1 = "INSERT INTO s_kwamok VALUES ('$nyear-$nhaki','$Row[1]','$Row[2]','$Row[3]','$Row[4]','$Row[5]','$Row[6]','$Row[7]','$Row[8]','$Row[9]')";
  258. // $Result1 = mysql_query($Query1, $DbConn);
  259. //}
  260. }
  261. $Query = "SELECT yearh,ggcode FROM s_ggyear order by ggcode desc, yearh desc";
  262. $Result = mysql_query($Query, $DbConn);
  263.  
  264. echo("<form name=chyr method=post action=signup_adm.html>
  265. </form>
  266. ");
  267. echo("<input type=hidden name=tag value='2'>");
  268. echo("<input type=hidden name=tag2 value='copy'>");
  269. echo("<table border=1 cellpadding='1' cellspacing='0' bordercolor='silver' bordercolordark='white' bordercolorlight='gray'>");
  270. echo(" <tr>");
  271. echo(" <td>");
  272. echo(" <select name=nyear> ");
  273. echo(" <option value=2005>2005</option> ");
  274. echo(" <option value=2006>2006</option> ");
  275. echo(" <option value=2007>2007</option> ");
  276. echo(" <option value=2007>2008</option> ");
  277. echo(" <option value=2007>2009</option> ");
  278. echo(" <option value=2007>2010</option> ");
  279. echo(" </select>");
  280. echo(" <select name=nhaki> ");
  281. echo(" <option value=춘계>춘계</option> ");
  282. echo(" <option value=4월>4월</option> ");
  283. echo(" <option value=5월>5월</option> ");
  284. echo(" <option value=6월>6월</option> ");
  285. echo(" <option value=하계>하계</option> ");
  286. echo(" <option value=추계>추계</option> ");
  287. echo(" <option value=10월>10월</option> ");
  288. echo(" <option value=동계>동계</option> ");
  289. echo(" </select>");
  290. echo(" <td>");
  291. echo(" </tr>");
  292. echo(" <tr>");
  293. echo(" <td colspan=2><input type=submit name=submit value='새학기 개설'></td>");
  294. echo(" </tr>");
  295. echo("</form>");
  296. echo("</table>");
  297.  
  298. echo("<form name=chyr method=post action=signup_adm.html>
  299. </form>
  300. ");
  301. echo("<input type=hidden name=tag value='2'>");
  302. echo("<table border=1 cellpadding='1' cellspacing='0' bordercolor='silver' bordercolordark='white' bordercolorlight='gray'>");
  303. while($Row = mysql_fetch_array($Result)){
  304. echo(" <tr>");
  305. echo("<td><input type=text size=10 name=yearh value=" . $Row["yearh"] . " readonly></td>");
  306. echo("<td>");
  307. if($Row["ggcode"]=="1"){
  308. echo("<input type=radio name=yearrdo checked>");
  309. }else{
  310. echo("<input type=radio name=yearrdo>");
  311. }
  312. echo(" </td>");
  313. echo("</tr>");
  314. }
  315. echo("</form>");
  316. echo("</table>");
  317. }
  318.  
  319. if($tag=="3"){
  320. $Query = "SELECT gubn,startday,endday FROM s_seday";
  321. $Result = mysql_query($Query, $DbConn);
  322.  
  323. echo("<form name=chyr method=post action=signup_adm.html>");
  324. echo("<input type=hidden name=tag value=dayupd>");
  325. echo("<table border=1 cellpadding='1' cellspacing='0' bordercolor='silver' bordercolordark='white' bordercolorlight='gray'>");
  326. echo("<tr bgcolor=#eeeeee>");
  327. echo("<td>구분</td>");
  328. echo("<td>시작일</td>");
  329. echo("<td>종료일</td>");
  330. echo("</tr>");
  331. $while_cnt = 0;
  332. while($Row = mysql_fetch_array($Result)){
  333. echo("<tr>");
  334. echo("<td><input type=hidden name=g[" . $while_cnt . "] value='" . $Row["gubn"] . "'>" . $Row["gubn"] . "</td>");
  335. echo("<td>
  336. <input type=text name=s[" . $while_cnt . "] value='" . $Row["startday"] . "'></td>");
  337. echo("<td size="20"><input type=text name=e[" . $while_cnt . "] value='" . $Row["endday"] . "'></td>");
  338. echo("</tr size="20">");
  339. $while_cnt = $while_cnt + 1;
  340. }
  341. echo("</table>");
  342. echo("<br><br>
  343. <input type=image src=images/sin_info_save.gif border=0 width="179" height="21">");
  344. echo("</form>");
  345. }
  346.  
  347. if($tag=="dayupd"){
  348. $while_cnt = 0;
  349. while($g[$while_cnt]!=""){
  350. $Query = "UPDATE s_seday SET startday='$s[$while_cnt]',endday='$e[$while_cnt]' WHERE gubn='$g[$while_cnt]'";
  351. $Result = mysql_query($Query, $DbConn);
  352. $while_cnt++;
  353. }
  354.  
  355. echo("<form name=chk method=post action=signup_adm.html>");
  356. echo("<input type=hidden name=tag value='3'>");
  357. echo("</form>");
  358. echo("<script language=javascript> document.chk.submit(); </script>");
  359. }
  360.  
  361. if($tag=="6"){
  362. if($del=="1"){
  363. $Query = "DELETE FROM s_master WHERE juminno='$jm'";
  364. $Result = mysql_query($Query, $DbConn);
  365. }
  366. if($ins=="1"){
  367. $Query = "INSERT INTO s_master VALUES ('$m_name','$jm')";
  368. $Result = mysql_query($Query, $DbConn);
  369. }
  370.  
  371. $Query = "SELECT kname,juminno FROM s_master ORDER BY juminno";
  372. $Result = mysql_query($Query, $DbConn);
  373.  
  374. echo("<form name=chyr method=post action=signup_adm.html>");
  375. echo("<input type=hidden name=tag value=6>");
  376. echo("<input type=hidden name=ins value=1>");
  377. echo("<table width=300 border=1 cellpadding='1' cellspacing='0' bordercolor='silver' bordercolordark='white' bordercolorlight='gray'>");
  378. echo("<tr bgcolor=#eeeeee>");
  379. echo("<td>이름</td>");
  380. echo("<td>주민번호</td>");
  381. echo("<td> </td>");
  382. echo("</tr>");
  383. echo("<tr>");
  384. echo("<td><input type=text name=m_name size=6 maxlength=5 value=''></td>");
  385. echo("<td><input type=text name=jm size=15 maxlength=14 value=''> ( - 포함)</td>");
  386. echo("<td><input type=submit value='입력'></td>");
  387. echo("</tr>");
  388. echo("</table>");
  389. echo("</form>");
  390.  
  391. echo("<table width=300 border=1 cellpadding='1' cellspacing='0' bordercolor='silver' bordercolordark='white' bordercolorlight='gray'>");
  392. echo("<tr bgcolor=#eeeeee>");
  393. echo("<td>이름</td>");
  394. echo("<td>주민번호</td>");
  395. echo("<td> </td>");
  396. echo("</tr>");
  397. $while_cnt = 0;
  398. while($Row = mysql_fetch_array($Result)){
  399. if($Row["kname"]=="관리자"){
  400. //
  401. }else{
  402. echo("<tr>");
  403. echo("<td>". $Row["kname"] . "</td>");
  404. echo("<td>". $Row["juminno"] . "</td>");
  405. echo("<td><a href=signup_adm.html?tag=6&del=1&jm=". $Row["juminno"] . ">[삭제]</a></td>");
  406. echo("</tr>");
  407. $while_cnt = $while_cnt + 1;
  408. }
  409. }
  410. echo("</table>");
  411. }
  412.  
  413. if($tag=="4"){
  414. if($tag2=="del"){
  415. $Query = "DELETE FROM s_kwamok WHERE yearh='$yearh' and haksuno='$haksuno'";
  416. $Result = mysql_query($Query, $DbConn);
  417. }
  418. if($tag2=="upd"){
  419. //$Query = "UPDATE s_kwamok SET yearh='$yearh',haksuno='$haksuno',gubn='$gubn',kwname='$kwname',youil='$youil',sigan='$sigan',roomno='$roomno',teacher='$teacher',amount='$amount',inwonsu='$inwonsu' WHERE yearh='$yearh' and haksuno='$o_haksuno'";
  420. $Query = "UPDATE s_kwamok SET gubn='$gubn',kwname='$kwname',youil='$youil',sigan='$sigan',roomno='$roomno',teacher='$teacher',amount='$amount',inwonsu='$inwonsu',info='$info' WHERE yearh='$yearh' and haksuno='$o_haksuno'";
  421. $Result = mysql_query($Query, $DbConn);
  422. //echo $Query;
  423. }
  424. if($tag2=="ins"){
  425. $Query = "INSERT INTO s_kwamok VALUES ('$yearh','$o_haksuno','$gubn','$kwname','$youil','$sigan','$roomno','$teacher','$amount','$inwonsu','$info')";
  426. $Result = mysql_query($Query, $DbConn);
  427. }
  428.  
  429. $msg = "개설 과목 리스트 입니다.";
  430.  
  431. $Query = "SELECT yearh,haksuno,gubn,kwname,youil,sigan,roomno,teacher,amount,inwonsu,info FROM s_kwamok WHERE yearh='$ggyearh'";
  432. $Result = mysql_query($Query, $DbConn);
  433. $TotalCnt = mysql_num_rows($Result);
  434.  
  435. echo("<table border=0 width='95%' cellpadding='1' cellspacing='0' bordercolor='silver' bordercolordark='white' bordercolorlight='gray'>");
  436. echo(" <tr>");
  437. echo(" <td><b>* 수강 개설 과목 리스트</b> (<font color=red>$msg</font>)</td>");
  438. echo(" </tr>");
  439. echo("</table>");
  440.  
  441. echo("<table border=1 width='95%' cellpadding='1' cellspacing='0' bordercolor='silver' bordercolordark='white' bordercolorlight='gray'>");
  442. echo("<tr bgcolor=#eeeeee>");
  443. echo("<td>년도<br>학기</td>");
  444. echo("<td>학수<br>번호</td>");
  445. echo("<td>구분</td>");
  446. echo("<td>과목명</td>");
  447. echo("<td>요일</td>");
  448. echo("<td>시간</td>");
  449. echo("<td>강의실</td>");
  450. echo("<td>교수명</td>");
  451. echo("<td>수강료</td>");
  452. echo("<td>인원<br>제한</td>");
  453. echo("<td>교수소개</td>");
  454. echo("<td>비고</td>");
  455. echo("</tr>");
  456. if($TotalCnt >= 1){
  457. while($Row = mysql_fetch_array($Result)){
  458. echo("<tr>");
  459. echo("<form name=upd action=signup_adm.html>");
  460. echo("<input type=hidden name=tag value='4'>");
  461. echo("<input type=hidden name=tag2 value='upd'>");
  462. //echo("<td><input size=8 type=text name=yearh value='" . $Row["yearh"] . "'></td>");
  463. echo("<td><input type=hidden name=yearh value='" . $Row["yearh"] . "'>" . $Row["yearh"] . "</td>");
  464. //echo("<td><input size=4 type=hidden name=o_haksuno value='" . $Row["haksuno"] . "'><input size=4 type=text name=haksuno value='" . $Row["haksuno"] . "'></td>");
  465. echo("<td><input size=4 type=hidden name=o_haksuno value='" . $Row["haksuno"] . "'>" . $Row["haksuno"] . "</td>");
  466. echo("<td><input size=7 type=text name=gubn value='" . $Row["gubn"] . "'></td>");
  467. echo("<td><input size=28 type=text name=kwname value='" . $Row["kwname"] . "'></td>");
  468. echo("<td><input size=7 type=text name=youil value='" . $Row["youil"] . "'></td>");
  469. echo("<td><input size=10 type=text name=sigan value='" . $Row["sigan"] . "'></td>");
  470. echo("<td><input size=9 type=text name=roomno value='" . $Row["roomno"] . "'></td>");
  471. echo("<td><input size=10 type=text name=teacher value='" . $Row["teacher"] . "'></td>");
  472. //echo("<td><input size=7 type=text name=amount value='" . number_format($Row["amount"]) . "'></td>");
  473. echo("<td><input size=6 type=text name=amount value='" . $Row["amount"] . "'></td>");
  474. echo("<td><input size=3 type=text name=inwonsu value='" . $Row["inwonsu"] . "'></td>");
  475. echo("<td><input size=10 type=text name=info value='" . $Row["info"] . "'></td>");
  476. echo("<td><input type=submit value='수정'><a href=signup_adm.html?tag=4&yearh=" . $Row["yearh"] . "&haksuno=" . $Row["haksuno"] . "&tag2=del>[삭제]</a></td>");
  477. echo("</form>");
  478. echo("</tr>");
  479. $temp_r = $Row["reading"];
  480. $temp_d = $Row["dungrok"];
  481. }
  482. echo("<tr>");
  483. echo("<form name=upd action=signup_adm.html>");
  484. echo("<input type=hidden name=tag value='4'>");
  485. echo("<input type=hidden name=tag2 value='ins'>");
  486. echo("<td><input type=hidden name=yearh value='" . $ggyearh . "'>" . $ggyearh . "</td>");
  487. echo("<td><input size=4 type=text name=o_haksuno value='" . $Row["haksuno"] . "'></td>");
  488. echo("<td><input size=7 type=text name=gubn value='" . $Row["gubn"] . "'></td>");
  489. echo("<td><input size=28 type=text name=kwname value='" . $Row["kwname"] . "'></td>");
  490. echo("<td><input size=7 type=text name=youil value='" . $Row["youil"] . "'></td>");
  491. echo("<td><input size=10 type=text name=sigan value='" . $Row["sigan"] . "'></td>");
  492. echo("<td><input size=9 type=text name=roomno value='" . $Row["roomno"] . "'></td>");
  493. echo("<td><input size=10 type=text name=teacher value='" . $Row["teacher"] . "'></td>");
  494. echo("<td><input size=6 type=text name=amount value='" . $Row["amount"] . "'></td>");
  495. echo("<td><input size=3 type=text name=inwonsu value='" . $Row["inwonsu"] . "'></td>");
  496. echo("<td><input size=10 type=text name=info value='" . $Row["info"] . "'></td>");
  497. echo("<td><input type=submit value='입력'></td>");
  498. echo("</form>");
  499. echo("</tr>");
  500. }else{
  501. echo("<tr>");
  502. echo("<form name=upd action=signup_adm.html>");
  503. echo("<input type=hidden name=tag value='4'>");
  504. echo("<input type=hidden name=tag2 value='ins'>");
  505. echo("<td><input type=hidden name=yearh value='" . $ggyearh . "'>" . $ggyearh . "</td>");
  506. echo("<td><input size=4 type=text name=o_haksuno value='" . $Row["haksuno"] . "'></td>");
  507. echo("<td><input size=7 type=text name=gubn value='" . $Row["gubn"] . "'></td>");
  508. echo("<td><input size=28 type=text name=kwname value='" . $Row["kwname"] . "'></td>");
  509. echo("<td><input size=7 type=text name=youil value='" . $Row["youil"] . "'></td>");
  510. echo("<td><input size=10 type=text name=sigan value='" . $Row["sigan"] . "'></td>");
  511. echo("<td><input size=9 type=text name=roomno value='" . $Row["roomno"] . "'></td>");
  512. echo("<td><input size=10 type=text name=teacher value='" . $Row["teacher"] . "'></td>");
  513. echo("<td><input size=6 type=text name=amount value='" . $Row["amount"] . "'></td>");
  514. echo("<td><input size=3 type=text name=inwonsu value='" . $Row["inwonsu"] . "'></td>");
  515. echo("<td><input type=submit value='입력'></td>");
  516. echo("</form>");
  517. echo("</tr>");
  518.  
  519. echo("<tr>");
  520. echo("<td colspan=11 height=25 align=center>현재 개설된 과목이 없습니다.</td>");
  521. echo("</tr>");
  522. }
  523. echo("</table>");
  524. }
  525.  
  526. if($tag=="5"){
  527. if($tag2=="del"){
  528. $Query = "DELETE FROM s_haksang WHERE yearh='$yearh' and juminno='$juminno'";
  529. $Result = mysql_query($Query, $DbConn);
  530. }
  531.  
  532. $msg = "저장된 학생 정보 리스트 입니다.";
  533.  
  534. $Query = "SELECT yearh,juminno,kname,ename,hakkwa,hakyeon,hakbun,phone1,phone2,htime,email FROM s_haksang WHERE yearh='$ggyearh'";
  535. $Result = mysql_query($Query, $DbConn);
  536. $TotalCnt = mysql_num_rows($Result);
  537.  
  538. echo("<table border=0 width='95%' cellpadding='1' cellspacing='0' bordercolor='silver' bordercolordark='white' bordercolorlight='gray'>");
  539. echo(" <tr>");
  540. echo(" <td><b>* 학생 정보 리스트</b> (<font color=red>$msg</font>)</td>");
  541. echo(" </tr>");
  542. echo("</table>");
  543.  
  544. echo("<table border=1 width='95%' cellpadding='1' cellspacing='0' bordercolor='silver' bordercolordark='white' bordercolorlight='gray'>");
  545. echo("<tr bgcolor=#eeeeee>");
  546. echo("<td>순번</td>");
  547. echo("<td>년도<br>학기</td>");
  548. echo("<td>주민번호</td>");
  549. echo("<td>한글이름</td>");
  550. echo("<td>영문이름</td>");
  551. //echo("<td>학과</td>");
  552. echo("<td>학번</td>");
  553. echo("<td>집전화</td>");
  554. echo("<td>휴대폰</td>");
  555. //echo("<td>희망 공강시간</td>");
  556. echo("<td>이메일</td>");
  557. echo("<td>비고</td>");
  558. echo("</tr>");
  559. if($TotalCnt >= 1){
  560. $while_cnt = 1;
  561. while($Row = mysql_fetch_array($Result)){
  562. echo("<tr>");
  563. echo("<td>" . $while_cnt++ . "</td>");
  564. echo("<td>" . $Row["yearh"] . "</td>");
  565. echo("<td>" . $Row["juminno"] . "</td>");
  566. echo("<td>" . $Row["kname"] . "</td>");
  567. echo("<td>" . $Row["ename"] . "</td>");
  568. //echo("<td>" . $Row["hakkwa"] . "&nbsp;</td>");
  569. echo("<td>" . $Row["hakbun"] . "</td>");
  570. echo("<td>" . $Row["phone1"] . "&nbsp;</td>");
  571. echo("<td>" . $Row["phone2"] . "&nbsp;</td>");
  572. //echo("<td>" . $Row["htime"] . "&nbsp;</td>");
  573. echo("<td>" . $Row["email"] . "</td>");
  574. echo("<td><a href=signup_adm.html?tag=5&yearh=" . $Row["yearh"] . "&juminno=" . $Row["juminno"] . "&tag2=del>[삭제]</a></td>");
  575. echo("</tr>");
  576. $temp_r = $Row["reading"];
  577. $temp_d = $Row["dungrok"];
  578. }
  579. }else{
  580. echo("<tr>");
  581. echo("<td colspan=97 height=25 align=center>현재 학기에 저장된 학생 정보가 없습니다.</td>");
  582. echo("</tr>");
  583. }
  584. echo("</table>");
  585. }
  586.  
  587. mysql_close($DbConn);
  588. ?></body></html>
Last edited by webbyboy : Mar 8th, 2007 at 11:47 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2006
Location: Canada
Posts: 55
Reputation: GliderPilot is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 2
GliderPilot's Avatar
GliderPilot GliderPilot is offline Offline
Junior Poster in Training

Re: Serious problem here.. Warning: mysql_query(): 2 is not a valid............

  #2  
Mar 9th, 2007
Couple of things that may help you out.

First I noticed that you are using PHP code, yet the page is a .html page. In order for PHP to be processed your page needs to be .php not .html

Second in your myqsl_query command you have ($Query, $DBCon) which is unnessesary. Just have your query: $Result = mysql_query($Query)

As well, when coding you should add the following to your querys, this will instead of showing a generic MySQL error, give you a more exact error as to what happened, and will stop processing the code if one of the queries do not work:
$Result = mysql_query($Query) or die (mysql_error());

If your still having troubles, post the new error you get with that new query code.
Reply With Quote  
Join Date: Mar 2007
Posts: 2
Reputation: webbyboy is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
webbyboy webbyboy is offline Offline
Newbie Poster

Re: Serious problem here.. Warning: mysql_query(): 2 is not a valid............

  #3  
Mar 10th, 2007
if i replace the original $result code with your format, it shows this error:

Parse error: syntax error, unexpected T_VARIABLE in /user/langlab/wwwhome/signup/signup_adm.html on line 8


which is

$Cnts = mysql_result($DbResult,0,0);







So I add or die (mysql_error()); to my original $result code and this it what it shows:



Parse error: syntax error, unexpected T_STRING in /user/langlab/wwwhome/signup/signup_adm.html on line 206



WHICH IS:

echo("확인 : <input type=checkbox name=reading checked value="ON">&nbsp;&nbsp;");


how can this line gives problem?

Thanks!
Originally Posted by GliderPilot View Post
Couple of things that may help you out.

First I noticed that you are using PHP code, yet the page is a .html page. In order for PHP to be processed your page needs to be .php not .html

Second in your myqsl_query command you have ($Query, $DBCon) which is unnessesary. Just have your query: $Result = mysql_query($Query)

As well, when coding you should add the following to your querys, this will instead of showing a generic MySQL error, give you a more exact error as to what happened, and will stop processing the code if one of the queries do not work:
$Result = mysql_query($Query) or die (mysql_error());

If your still having troubles, post the new error you get with that new query code.
Last edited by webbyboy : Mar 10th, 2007 at 12:46 am.
Reply With Quote  
Join Date: Sep 2004
Posts: 3
Reputation: mmxx66 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mmxx66 mmxx66 is offline Offline
Newbie Poster

Re: Serious problem here.. Warning: mysql_query(): 2 is not a valid............

  #4  
Mar 22nd, 2007
  1. echo("확인 : <input type=checkbox name=reading checked value="ON">&nbsp;&nbsp;");

should be: