/    Sign up×
Community /Pin to ProfileBookmark

Javascript function to change the whole row of database value

[code=php]
<?php
include (“dbFunctions.php”);

session_start();
$query = “SELECT * FROM two_three”;

$result = mysqli_query($link, $query);

mysqli_close($link);
?>
[/code]

[code=html]

<html>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no”>
<link rel=”stylesheet” href=”CSS/main.css” type=”text/css”/>
<link rel=”stylesheet” href=”CSS/easy1.css” type=”text/css”/>

<title> Easy Game 1 </title>
<center>
<h1> Easy Game 1 </h1>
<h2> Click the image the number of times to get the answer! </h2>
<div class=”border_solid”>
<div id=”timer”></div>
</div>
<hr>
</center>
</head>
<body>
<center>
<div id=”display”><script type=”text/javascript”>document.write(count);</script></div>
<img src=”image/ufo.png” class=”ufo” onclick=”add()”><br>
<input type=”submit” class=”submit” value=”submit” name=”submit” onclick=”?”/>
</center>
<?php
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$questID = $row[‘two_three_id’];
$factor1 = $row[‘factor1’];
$factor2 = $row[‘factor2’];
?>
<div class=”image-container”>
<div class = “image-questionid”><u>Question <?php echo $questID; ?></u></div>
</div>
<div class=”image-questionfactor1″><?php echo $factor1; ?></div>
<div class=”image-betweenfactor”>X</div>
<div class=”image-questionfactor2″><?php echo $factor2; ?></div>
<div class=”image-questionequals”>= ?</div>

<?php break; }
}
?>
</body>
<script type=”text/javascript”>
var count = 0;
function add() {
count++;
document.getElementById(‘display’).innerHTML = count;
}

var myVar = setInterval(function() {
myTimer()
}, 1000);
var d = 0;

function myTimer() {
document.getElementById(“timer”).innerHTML = d++;
}

}
</script>
</html>[/code]

So basically the codes for

[code=html] <input type=”submit” class=”submit” value=”submit” name=”submit”/>
[/code]

is suppose to change the values of

[code=html]
<div class=”image-container”>
<div class = “image-questionid”><u>Question <?php echo $questID; ?></u></div>
</div>
<div class=”image-questionfactor1″><?php echo $factor1; ?></div>
<div class=”image-betweenfactor”>X</div>
<div class=”image-questionfactor2″><?php echo $factor2; ?></div>
<div class=”image-questionequals”>= ?</div>
[/code]

can someone please help me solve this code?? I have been trying to solve it for weeks… T_T

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @teejayteejay spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...