Click here to Skip to main content
14,455,338 members

JavaScript

 
GeneralRe: Regular Expression for min of 4 characters in TypeScript Pin
Richard MacCutchan12-Mar-19 9:38
communityengineerRichard MacCutchan12-Mar-19 9:38 
GeneralRe: Regular Expression for min of 4 characters in TypeScript Pin
simpledeveloper12-Mar-19 9:49
Membersimpledeveloper12-Mar-19 9:49 
GeneralRe: Regular Expression for min of 4 characters in TypeScript Pin
Richard MacCutchan12-Mar-19 10:51
communityengineerRichard MacCutchan12-Mar-19 10:51 
GeneralRe: Regular Expression for min of 4 characters in TypeScript Pin
simpledeveloper13-Mar-19 7:29
Membersimpledeveloper13-Mar-19 7:29 
GeneralRe: Regular Expression for min of 4 characters in TypeScript Pin
Richard MacCutchan13-Mar-19 7:38
communityengineerRichard MacCutchan13-Mar-19 7:38 
GeneralRe: Regular Expression for min of 4 characters in TypeScript Pin
simpledeveloper13-Mar-19 13:25
Membersimpledeveloper13-Mar-19 13:25 
GeneralRe: Regular Expression for min of 4 characters in TypeScript Pin
Richard MacCutchan13-Mar-19 23:16
communityengineerRichard MacCutchan13-Mar-19 23:16 
Questionhow can use php code in java? Pin
Member 1417801711-Mar-19 1:45
MemberMember 1417801711-Mar-19 1:45 
Hi !

i want creat qustion script with php and jquery. but I can't fetch in database!

file quiz.php
html><pre><html>
<head>
    <script>
    var quiztitle = "Number";
    var quiz = [
    {
            "question"      :   "$x",
            "image"         :   "",
            "choices"       :   ["1", "2", "3", "4"],
            "correct"       :   "2",
            "explanation"   :   "",
        }
    ];
</script>
</head>
<body>
<div id="frame" role="content"></div><br/><br/>
</body>
</html>


file style.js
<pre><html>

<head>
<meta charset="utf-8">
    <title>Quiz</title>
    <!-- jquery for maximum compatibility -->
    <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
    <meta name="viewport" content="width=device-width" />

    <!-- Bootstrap core CSS     -->
    <link href="assets/css/bootstrap.min.css" rel="stylesheet" />
    <link href="assets/css/paper-kit.css?v=2.1.0" rel="stylesheet" />

    <!--  CSS for Demo Purpose, don't include it in your project     -->
    <link href="assets/css/demo.css" rel="stylesheet" />
    <link href="assets/css/style.css" rel="stylesheet" />
    <script src="assets/js/style.js"></script>


    <!--     Fonts and icons     -->
    <link href='http://fonts.googleapis.com/css?family=Montserrat:400,300,700' rel='stylesheet' type='text/css'>
    <link href="http://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" rel="stylesheet">
    <link href="assets/css/nucleo-icons.css" rel="stylesheet" />




    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <link href="assets/css/style.css" rel="stylesheet" />
    <script src="assets/js/style.js"></script>
    

    <?php

$con = mysqli_connect('localhost','root','','kelidestan');
if (!$con) {
    die('Could not connect: ' . mysqli_error($con));
}

mysqli_select_db($con,"ajax_demo");
$sql="SELECT * FROM `question`";
$result = mysqli_query($con,$sql);

echo "<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
<th>Hometown</th>
<th>Job</th>
</tr>";
while($row = mysqli_fetch_array($result)) {
    echo "<tr>";
    echo "<td>" . $row['a1'] . "</td>";
    echo "<td>" . $row['a2'] . "</td>";
    echo "<td>" . $row['a3'] . "</td>";
    echo "<td>" . $row['a4'] . "</td>";
    echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
    <script>
  var x = "<?php echo $row['a1'];?>"
    var quiztitle = "Number";
    var quiz = [
	{
            "question"      :   "$x",
            "image"         :   "",
            "choices"		:	["1", "2", "3", "4"],
            "correct"       :   "2",
            "explanation"   :   "",
        }


    ];
</script>

<style>
table {
    width: 100%;
    border-collapse: collapse;
}

table, td, th {
    border: 1px solid black;
    padding: 5px;
}

th {text-align: left;}
</style>
</head>

<body>
<nav class="navbar navbar-expand-md fixed-top">
        <div class="container">
            <div class="navbar-translate">
                <button class="navbar-toggler navbar-toggler-right navbar-burger" type="button" data-toggle="collapse"
                    data-target="#navbarToggler" aria-controls="navbarTogglerDemo02" aria-expanded="false"
                    aria-label="Toggle navigation">
                    <span class="navbar-toggler-bar"></span>
                    <span class="navbar-toggler-bar"></span>
                    <span class="navbar-toggler-bar"></span>
                </button>
                <a class="navbar-brand" href="index.php">2ZB.IR</a>
            </div>
            <div class="collapse navbar-collapse" id="navbarToggler">
                <ul class="navbar-nav ml-auto">
                    <li class="nav-item">
                        <a class="nav-link" rel="tooltip" title="Follow us on Twitter" data-placement="bottom"
                            href="https://twitter.com/CreativeTim" target="_blank">
                            class="fa fa-twitter">
                            <p class="d-lg-none">Twitter</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" rel="tooltip" title="Like us on Facebook" data-placement="bottom"
                            href="https://www.facebook.com/CreativeTim" target="_blank">
                            class="fa fa-facebook-square">
                            <p class="d-lg-none">Facebook</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" rel="tooltip" title="Follow us on Instagram" data-placement="bottom"
                            href="https://www.instagram.com/CreativeTimOfficial" target="_blank">
                            class="fa fa-instagram">
                            <p class="d-lg-none">Instagram</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" rel="tooltip" title="Star on GitHub" data-placement="bottom"
                            href="https://www.github.com/CreativeTimOfficial/paper-kit" target="_blank">
                            class="fa fa-github">
                            <p class="d-lg-none">GitHub</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a href="send.php" target="_blank" class="btn btn-danger btn-round">Send Question</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <br/><br/>    <br/><br/>    <br/><br/>
    <div id="frame" role="content"></div><br/><br/>
<?php include 'footer.php'; ?>

</body>
<!-- Core JS Files -->
<script src="assets/js/jquery-3.2.1.js" type="text/javascript"></script>
<script src="assets/js/jquery-ui-1.12.1.custom.min.js" type="text/javascript"></script>
<script src="assets/js/popper.js" type="text/javascript"></script>
<script src="assets/js/bootstrap.min.js" type="text/javascript"></script>

<!-- Switches -->
<script src="assets/js/bootstrap-switch.min.js"></script>

<!--  Plugins for Slider -->
<script src="assets/js/nouislider.js"></script>

<!--  Plugins for DateTimePicker -->
<script src="assets/js/moment.min.js"></script>
<script src="assets/js/bootstrap-datetimepicker.min.js"></script>

<!--  Paper Kit Initialization and functons -->
<script src="assets/js/paper-kit.js?v=2.1.0"></script>
</html>



i want fetching automatically by database table
AnswerRe: how can use php code in java? Pin
Nathan Minier11-Mar-19 3:51
professionalNathan Minier11-Mar-19 3:51 
QuestionRedirecting to the URL after Submit Pin
simpledeveloper6-Mar-19 13:37
Membersimpledeveloper6-Mar-19 13:37 
AnswerRe: Redirecting to the URL after Submit Pin
Nathan Minier7-Mar-19 2:39
professionalNathan Minier7-Mar-19 2:39 
GeneralRe: Redirecting to the URL after Submit Pin
simpledeveloper7-Mar-19 9:29
Membersimpledeveloper7-Mar-19 9:29 
GeneralRe: Redirecting to the URL after Submit Pin
simpledeveloper7-Mar-19 11:52
Membersimpledeveloper7-Mar-19 11:52 
GeneralRe: Redirecting to the URL after Submit Pin
Nathan Minier11-Mar-19 2:15
professionalNathan Minier11-Mar-19 2:15 
GeneralRe: Redirecting to the URL after Submit Pin
simpledeveloper12-Mar-19 7:32
Membersimpledeveloper12-Mar-19 7:32 
GeneralRe: Redirecting to the URL after Submit Pin
simpledeveloper13-Mar-19 7:24
Membersimpledeveloper13-Mar-19 7:24 
QuestionToggling two Radio buttons depending upon enum values in Angular 2.0 Pin
simpledeveloper27-Feb-19 14:38
Membersimpledeveloper27-Feb-19 14:38 
QuestionAJAX,how to get more values from $.ajax({}) function in a Zend Controller Pin
serenimus25-Feb-19 9:49
Memberserenimus25-Feb-19 9:49 
QuestionHow to identify if string is a phone number, Email address or a web address in Javascript? Pin
Member 1397526717-Feb-19 15:51
MemberMember 1397526717-Feb-19 15:51 
SuggestionRe: How to identify if string is a phone number, Email address or a web address in Javascript? Pin
Richard MacCutchan17-Feb-19 23:05
communityengineerRichard MacCutchan17-Feb-19 23:05 
AnswerRe: How to identify if string is a phone number, Email address or a web address in Javascript? Pin
Blikkies27-Feb-19 3:28
professionalBlikkies27-Feb-19 3:28 
QuestionAssignment help? Pin
Member 141452369-Feb-19 13:49
MemberMember 141452369-Feb-19 13:49 
AnswerRe: Assignment help? Pin
Richard MacCutchan9-Feb-19 23:51
communityengineerRichard MacCutchan9-Feb-19 23:51 
AnswerRe: Assignment help? Pin
ZurdoDev27-Feb-19 4:50
mveZurdoDev27-Feb-19 4:50 
QuestionJavaScript Environment Pin
Member 141438347-Feb-19 22:44
MemberMember 141438347-Feb-19 22:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.