comparison php/read/updateTierLink.php @ 15:385ddd7c4b55 testing

use test_db.php to get mysqld_test instance
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Sun, 19 Feb 2017 16:17:53 +0000
parents 077b0a0a3e6d
children
comparison
equal deleted inserted replaced
14:1477b5e6dd16 15:385ddd7c4b55
10 $userID=$_GET['userID']; 10 $userID=$_GET['userID'];
11 } 11 }
12 $loc = strval($_GET['loc']); 12 $loc = strval($_GET['loc']);
13 echo $loc; 13 echo $loc;
14 14
15 include "../../../private/db.php"; 15 include "../../../../private/db_test.php";
16 //$addState = 0; 16 //$addState = 0;
17 17
18 $query1 = "CALL b_getLinkID('$isbn1', '$isbn2', $loc)"; // "select LinkID from scoretable where BookID1 = '$isbn1' and BookID2 = '$isbn2' and LocID = $loc"; 18 $query1 = "CALL b_getLinkID('$isbn1', '$isbn2', $loc)"; // "select LinkID from scoretable where BookID1 = '$isbn1' and BookID2 = '$isbn2' and LocID = $loc";
19 //echo $query1; 19 //echo $query1;
20 $data1 = mysqli_query($link, $query1) or exit( mysqli_error( $link )); 20 $data1 = mysqli_query($link, $query1) or exit( mysqli_error( $link ));
21 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop 21 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop
22 include "../../../private/db.php"; 22 include "../../../../private/db_test.php";
23 23
24 if ( mysqli_num_rows( $data1 ) < 1 ) //does the link exist 24 if ( mysqli_num_rows( $data1 ) < 1 ) //does the link exist
25 { 25 {
26 if($state == 7) 26 if($state == 7)
27 $queryL = "CALL b_addNewSearchLink('$isbn1','$isbn2',0, $loc)"; 27 $queryL = "CALL b_addNewSearchLink('$isbn1','$isbn2',0, $loc)";
33 $rows=mysqli_fetch_array($results, MYSQLI_ASSOC); 33 $rows=mysqli_fetch_array($results, MYSQLI_ASSOC);
34 $linkid=$rows['LinkID']; 34 $linkid=$rows['LinkID'];
35 35
36 //reset connection 36 //reset connection
37 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop 37 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop
38 include "../../../private/db.php"; 38 include "../../../../private/db_test.php";
39 39
40 40
41 //if(isset($userID)) 41 //if(isset($userID))
42 // $addState = 1; 42 // $addState = 1;
43 } 43 }
51 //echo $query3; 51 //echo $query3;
52 $data = mysqli_query($link, $query3) or exit( mysqli_error( $link )); 52 $data = mysqli_query($link, $query3) or exit( mysqli_error( $link ));
53 53
54 //reset connection 54 //reset connection
55 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop 55 mysqli_close($link); //do not remove. reset is needed otherwise mysqli_fetch_array doesn't work after first loop
56 include "../../../private/db.php"; 56 include "../../../../private/db_test.php";
57 57
58 while($line = mysqli_fetch_assoc($data)) 58 while($line = mysqli_fetch_assoc($data))
59 { 59 {
60 $linkID = $line["LinkID"]; 60 $linkID = $line["LinkID"];
61 $pos = $line["Positive"]; 61 $pos = $line["Positive"];