更新链接没有显示,而命令错误?

时间:2013-10-25 08:24:20

标签: php mysql echo

任何人都可以告诉我为什么更新链接没有在网页上显示以下代码? ('更新'链接)

{
 echo ('You did not complete all of the required fields');
 echo "<BR>";
 while($rows=mysql_fetch_array($result)){
 echo '<a href="update.php?Reference='. $rows['Reference'].' ">update</a>';
 }
 } // end of while loop
 else {
 echo "Successful";
 echo "<BR>";
 echo "<a href='list_records.php'>View result</a>";
 }

更新2

<?php

require_once('auth.php');

$host="xxx"; // Host name 
$username="xxx"; // Mysql username
$password="xxx"; // Mysql password 
$db_name="xxx"; // Database name 
$tbl_name="xxx"; // Table name 

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
 mysql_select_db("$db_name")or die("cannot select DB");

 $Reference=$_REQUEST['Reference'];
 $directly = $_REQUEST['directly'];
 $behalfclient = $_REQUEST['behalfclient'];
 $investigations = $_REQUEST['investigations'];
 $injuries = $_REQUEST['injuries'];
 $duties = $_REQUEST['duties'];
 $Wherepain = $_REQUEST['Wherepain'];
 $pain = $_REQUEST['pain'];
 $aggravates = $_REQUEST['aggravates'];
 $eases = $_REQUEST['eases'];
 $Movement = $_REQUEST['Movement'];
 $neural = $_REQUEST['neural'];
 $UnderstandNPRS = $_REQUEST['UnderstandNPRS'];
 $NPRSassessment = $_REQUEST['NPRSassessment'];
 $yourhobbies = $_REQUEST['yourhobbies'];
 $hobbiesaffected = $_REQUEST['hobbiesaffected'];
 $social = $_REQUEST['social'];
 $activities = $_REQUEST['activities'];
 $lifestyle = $_REQUEST['lifestyle'];
 $avoiddriving = $_REQUEST['avoiddriving'];
 $grip = $_REQUEST['grip'];
 $flashbacks = $_REQUEST['flashbacks'];
 $braking = $_REQUEST['braking'];
 $past = $_REQUEST['past'];
 $psychologically = $_REQUEST['psychologically'];
 $stomach = $_REQUEST['stomach'];
 $dental = $_REQUEST['dental'];
 $organs = $_REQUEST['organs'];
 $genitals = $_REQUEST['genitals'];
 $memory = $_REQUEST['memory'];
 $scaring = $_REQUEST['scaring'];
 $deformity = $_REQUEST['deformity'];
 $eyes = $_REQUEST['eyes'];
 $burns = $_REQUEST['burns'];
 $head = $_REQUEST['head'];
 $symptoms = $_REQUEST['symptoms'];
 $otherchanges = $_REQUEST['otherchanges'];
 $receivingtreatment = $_REQUEST['receivingtreatment'];
 $surgery = $_REQUEST['surgery'];
 $Impression = $_REQUEST['Impression'];
 $management = $_REQUEST['management'];
 $ifyes = $_REQUEST['ifyes'];
 $Rehabilitation = $_REQUEST['Rehabilitation'];
 $Number = $_REQUEST['Number'];
 $Psychological = $_REQUEST['Psychological'];
 $diagnostic = $_REQUEST['diagnostic'];
 $notrequiretreatment = $_REQUEST['notrequiretreatment'];
 $house = $_REQUEST['house'];
 $recommendations = $_REQUEST['recommendations'];
 $Prognosis = $_REQUEST['Prognosis'];
 $CV = $_REQUEST['CV'];
 $cervical = $_REQUEST['cervical'];
 $heat = $_REQUEST['heat'];
 $ice = $_REQUEST['ice'];
 $lumbar = $_REQUEST['lumbar'];
 $medication = $_REQUEST['medication'];
 $posture = $_REQUEST['posture'];
 $sport = $_REQUEST['sport'];
 $given = $_REQUEST['given'];
 $sceneaccident = $_REQUEST['sceneaccident'];

 $sql="UPDATE Triage SET sceneaccident='$sceneaccident', notrequiretreatment='$notrequiretreatment', house='$house', recommendations='$recommendations', Prognosis='$Prognosis', CV='$CV', cervical='$cervical', heat='$heat', ice='$ice', lumbar='$lumbar', medication='$medication', posture='$posture', sport='$sport', given='$given' ,organs='$organs', deformity='$deformity', otherchanges='$otherchanges', receivingtreatment='$receivingtreatment', surgery='$surgery', Impression='$Impression', management='$management', ifyes='$ifyes', Rehabilitation='$Rehabilitation', Number='$Number', Psychological='$Psychological', diagnostic='$diagnostic', eyes='$eyes', burns='$burns', head='$head', symptoms='$symptoms', memory='$memory', scaring='$scaring', genitals='$genitals', dental='$dental', stomach='$stomach', directly='$directly', behalfclient='$behalfclient', investigations='$investigations', injuries='$injuries', duties='$duties', Wherepain='$Wherepain', pain='$pain', aggravates='$aggravates', eases='$eases', Movement='$Movement', neural='$neural', UnderstandNPRS='$UnderstandNPRS', NPRSassessment='$NPRSassessment', yourhobbies='$yourhobbies', hobbiesaffected='$hobbiesaffected', social='$social', activities='$activities', lifestyle='$lifestyle', avoiddriving='$avoiddriving', grip='$grip', flashbacks='$flashbacks', braking='$braking', past='$past', psychologically='$psychologically' WHERE Reference='$Reference'";
 $result=mysql_query($sql);


if (!$_REQUEST['sceneaccident'] || !$_REQUEST['notrequiretreatment'] || !$_REQUEST['house'] || !$_REQUEST['recommendations'] || !$_REQUEST['Prognosis'] || !$_REQUEST['CV'] || !$_REQUEST['cervical'] || !$_REQUEST['heat'] || !$_REQUEST['ice'] || !$_REQUEST['lumbar'] || !$_REQUEST['medication'] || !$_REQUEST['posture'] || !$_REQUEST['sport'] || !$_REQUEST['given'] || !$_REQUEST['organs'] || !$_REQUEST['deformity'] || !$_REQUEST['otherchanges'] || !$_REQUEST['receivingtreatment'] || !$_REQUEST['surgery'] || !$_REQUEST['Impression'] || !$_REQUEST['management'] || !$_REQUEST['ifyes'] || !$_REQUEST['Rehabilitation'] || !$_REQUEST['Number'] || !$_REQUEST['Psychological'] || !$_REQUEST['diagnostic'] || !$_REQUEST['eyes'] || !$_REQUEST['burns'] || !$_REQUEST['head'] || !$_REQUEST['symptoms'] || !$_REQUEST['memory'] || !$_REQUEST['scaring'] || !$_REQUEST['genitals'] || !$_REQUEST['dental'] || !$_REQUEST['stomach'] || !$_REQUEST['directly'] || !$_REQUEST['behalfclient'] || !$_REQUEST['investigations'] || !$_REQUEST['injuries'] || !$_REQUEST['duties'] || !$_REQUEST['Wherepain'] || !$_REQUEST['pain'] || !$_REQUEST['aggravates'] || !$_REQUEST['eases'] || !$_REQUEST['Movement'] || !$_REQUEST['neural'] || !$_REQUEST['UnderstandNPRS'] || !$_REQUEST['NPRSassessment'] || !$_REQUEST['yourhobbies'] || !$_REQUEST['hobbiesaffected'] || !$_REQUEST['social'] || !$_REQUEST['activities'] || !$_REQUEST['lifestyle'] || !$_REQUEST['avoiddriving'] || !$_REQUEST['grip'] || !$_REQUEST['flashbacks'] || !$_REQUEST['braking'] || !$_REQUEST['past'] || !$_REQUEST['psychologically'] )

{
 echo ('You did not complete all of the required fields');
 echo "<BR>";
 while($rows=mysql_fetch_array($result)){
 echo '<a href="update.php?Reference='. $rows['Reference'].' ">update</a>';
 }
 } // end of while loop
 else {
 echo "Successful";
 echo "<BR>";
 echo "<a href='list_records.php'>View result</a>";
 }

 ?> 

1 个答案:

答案 0 :(得分:0)

while循环没有值。$ result不包含fetch值。更改您的更新查询以选择查询