Note that there are some explanatory texts on larger screens.

plurals
  1. POpage not bringing through the correct row from the table in mysql
    primarykey
    data
    text
    <p>I seem to be having problems with this line of code, it should be bring through the reference field in the address bar of the browser.</p> <pre><code>echo &lt;a href="update.php?Reference=&lt;? echo $rows['Reference']; ?&gt;"&gt;update&lt;/a&gt; </code></pre> <p>it should look like this in the address bar "localip/update.php?Reference=123456"</p> <p>but instead is like this "localip/update.php?Reference="</p> <p>it doesn't seem to be bringing through the field into the address bar to display the information about that row in the table.</p> <p>any help would be much appreciated (pretty new to all of this)</p> <p>Cheers</p> <p>UPDATE - <pre><code>require_once('auth.php'); $host=""; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name=""; // Database name $tbl_name=""; // 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=$_POST['Reference']; $directly = $_POST['directly']; $behalfclient = $_POST['behalfclient']; $investigations = $_POST['investigations']; $injuries = $_POST['injuries']; $duties = $_POST['duties']; $Wherepain = $_POST['Wherepain']; $pain = $_POST['pain']; $aggravates = $_POST['aggravates']; $eases = $_POST['eases']; $Movement = $_POST['Movement']; $neural = $_POST['neural']; $UnderstandNPRS = $_POST['UnderstandNPRS']; $NPRSassessment = $_POST['NPRSassessment']; $yourhobbies = $_POST['yourhobbies']; $hobbiesaffected = $_POST['hobbiesaffected']; $social = $_POST['social']; $activities = $_POST['activities']; $lifestyle = $_POST['lifestyle']; $avoiddriving = $_POST['avoiddriving']; $grip = $_POST['grip']; $flashbacks = $_POST['flashbacks']; $braking = $_POST['braking']; $past = $_POST['past']; $psychologically = $_POST['psychologically']; $stomach = $_POST['stomach']; $dental = $_POST['dental']; $organs = $_POST['organs']; $genitals = $_POST['genitals']; $memory = $_POST['memory']; $scaring = $_POST['scaring']; $deformity = $_POST['deformity']; $eyes = $_POST['eyes']; $burns = $_POST['burns']; $head = $_POST['head']; $symptoms = $_POST['symptoms']; $otherchanges = $_POST['otherchanges']; $receivingtreatment = $_POST['receivingtreatment']; $surgery = $_POST['surgery']; $Impression = $_POST['Impression']; $management = $_POST['management']; $ifyes = $_POST['ifyes']; $Rehabilitation = $_POST['Rehabilitation']; $Number = $_POST['Number']; $Psychological = $_POST['Psychological']; $diagnostic = $_POST['diagnostic']; $notrequiretreatment = $_POST['notrequiretreatment']; $house = $_POST['house']; $recommendations = $_POST['recommendations']; $Prognosis = $_POST['Prognosis']; $CV = $_POST['CV']; $cervical = $_POST['cervical']; $heat = $_POST['heat']; $ice = $_POST['ice']; $lumbar = $_POST['lumbar']; $medication = $_POST['medication']; $posture = $_POST['posture']; $sport = $_POST['sport']; $given = $_POST['given']; $sceneaccident = $_POST['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 (!$_POST['sceneaccident'] || !$_POST['notrequiretreatment'] || !$_POST['house'] || !$_POST['recommendations'] || !$_POST['Prognosis'] || !$_POST['CV'] || !$_POST['cervical'] || !$_POST['heat'] || !$_POST['ice'] || !$_POST['lumbar'] || !$_POST['medication'] || !$_POST['posture'] || !$_POST['sport'] || !$_POST['given'] || !$_POST['organs'] || !$_POST['deformity'] || !$_POST['otherchanges'] || !$_POST['receivingtreatment'] || !$_POST['surgery'] || !$_POST['Impression'] || !$_POST['management'] || !$_POST['ifyes'] || !$_POST['Rehabilitation'] || !$_POST['Number'] || !$_POST['Psychological'] || !$_POST['diagnostic'] || !$_POST['eyes'] || !$_POST['burns'] || !$_POST['head'] || !$_POST['symptoms'] || !$_POST['memory'] || !$_POST['scaring'] || !$_POST['genitals'] || !$_POST['dental'] || !$_POST['stomach'] || !$_POST['directly'] || !$_POST['behalfclient'] || !$_POST['investigations'] || !$_POST['injuries'] || !$_POST['duties'] || !$_POST['Wherepain'] || !$_POST['pain'] || !$_POST['aggravates'] || !$_POST['eases'] || !$_POST['Movement'] || !$_POST['neural'] || !$_POST['UnderstandNPRS'] || !$_POST['NPRSassessment'] || !$_POST['yourhobbies'] || !$_POST['hobbiesaffected'] || !$_POST['social'] || !$_POST['activities'] || !$_POST['lifestyle'] || !$_POST['avoiddriving'] || !$_POST['grip'] || !$_POST['flashbacks'] || !$_POST['braking'] || !$_POST['past'] || !$_POST['psychologically'] ) { echo ('You did not complete all of the required fields'); echo "&lt;BR&gt;"; echo '&lt;a href="update.php?Reference='. $rows['Reference'].' "&gt;update&lt;/a&gt;'; } else { echo "Successful"; echo "&lt;BR&gt;"; echo "&lt;a href='list_records.php'&gt;View result&lt;/a&gt;"; } ?&gt; </code></pre> <p>UPDATE 2</p> <pre><code>// 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); // test by Fred start while($rows=mysql_fetch_array($result)){ echo '&lt;a href="update.php?Reference='. $rows['Reference'].' "&gt;update test&lt;/a&gt;'; } // test by Fred end 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 "&lt;BR&gt;"; echo '&lt;a href="update.php?Reference='. $rows['Reference'].' "&gt;update&lt;/a&gt;'; } else { echo "Successful"; echo "&lt;BR&gt;"; echo "&lt;a href='list_records.php'&gt;View result&lt;/a&gt;"; } ?&gt; </code></pre> <p>UPDATE 3</p> <pre><code>{ echo ('You did not complete all of the required fields'); echo "&lt;BR&gt;"; while($rows=mysql_fetch_array($result)){ echo '&lt;a href="update.php?Reference='. $rows['Reference'].' "&gt;update&lt;/a&gt;'; }} else { echo "Successful"; echo "&lt;BR&gt;"; echo "&lt;a href='list_records.php'&gt;View result&lt;/a&gt;"; } </code></pre> <p>UPDATE 4</p> <pre><code> { echo ('You did not complete all of the required fields'); echo "&lt;BR&gt;"; while($rows=mysql_fetch_array($result)){ echo '&lt;a href="update.php?Reference= "&gt;update&lt;/a&gt;'; }} else { echo "Successful"; echo "&lt;BR&gt;"; echo "&lt;a href='list_records.php'&gt;View result&lt;/a&gt;"; } </code></pre> <p>UPDATE 5</p> <pre><code>{ echo ('You did not complete all of the required fields'); echo "&lt;BR&gt;"; while($rows=mysql_fetch_array($result)){ echo '&lt;a href="update.php?Reference='. $rows['Reference'].' "&gt;update&lt;/a&gt;'; } } // end of while loop else { echo "Successful"; echo "&lt;BR&gt;"; echo "&lt;a href='list_records.php'&gt;View result&lt;/a&gt;"; } </code></pre> <p>Update 6</p> <pre><code>&lt;?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"); // get value of Reference that sent from address bar $Reference=$_GET['Reference']; // Retrieve data from database $sql="SELECT * FROM $tbl_name WHERE Reference='$Reference'"; $result=mysql_query($sql); $rows=mysql_fetch_array($result); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload