Page do not work, when adding php code

Joined
Sep 16, 2022
Messages
3
Reaction score
0
I have a page that when I run it, it is working (whiteout css and js ), but when I add my php code, it is just hangs and do not go further
When run php (api.php), it then use this php file (header.php)

PHP:
<?php include_once 'header.php'?>

<?php
    $mes="";
       
    if(isset($_GET['mes'])){
       
        $mes=$_GET["mes"];
    }

    $sql = mysqli_query($pdo,"SELECT * FROM api_currency ");

    $row = mysqli_fetch_array($sql);

    do{

        $nomics_api  = $row['nomics_api']; 
        $coingecko_api  = $row['coingecko_api'];
        $coinmarketcap_api  = $row['coinmarketcap_api'];
        $currency_api  = $row['currency_api'];
        $convert_to  = $row['convert_to'];

    }while($row = mysqli_fetch_array($sql));

  
    if (isset($_POST['submit'])) {
       
       $nomics_api  = $_post['nomics_api'];
        $coingecko_api  = $_post['coingecko_api'];
        $coinmarketcap_api  = $_post['coinmarketcap_api'];
        $currency_api  = $_post['currency_api'];
        $convert_to  = $_post['convert_to'];

        $sql = mysqli_query($pdo,"UPDATE api_currency set nomics_api ='$nomics_api', coingecko_api ='$coingecko_api',
        coinmarketcap_api ='$coinmarketcap_api', currency_api ='$currency_api', convert_to ='$convert_to' WHERE id = '1' ");
   
        header("location: api&currency.php?mes=2");

    }
   
    function do_alert($msg){
        echo '<script type="text/javascript">alert("' . $msg . '"); </script>';
    }

    if($mes==2){
        do_alert("Suksesvol bygevoeg");
    }

   
?>

HTML:
 <html>
  <body>
<section class="content">        
    <div class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <span class="info-box-icon bg-info elevation-1">
                    <iconify-icon icon="wpf:administrator" height="48" style="color: #FF0000"></span>
                        <div class="col-sm-6">
                            <h1 class="mb-2">API & Geldeenheid Opstelling</h1>
                                <p>Verskaf asseblief Vereiste veld (*)</p>
                        </div><!-- /.col -->
         
            </div><!-- /.row -->
        </div><!-- /.container-fluid -->
    </div>
       
    <div class="card-body">      
        <div class="form-group">
            <label for="exampleInputRounded0">Nomics API </label>
                <input type="text" name="NOMICS_API" class="form-control rounded-0" id="exampleInputBorder" placeholder=".rounded-0" value="<?php echo $NOMICS_API; ?>" required />
        </div>
        <div class="form-group">
            <label for="exampleInputRounded0">Coingrecko API </label>
                <input type="text" name="COINGECKO_API" class="form-control rounded-0" id="exampleInputBorder" placeholder=".rounded-0" value="<?php echo $COINGECKO_API; ?>" required />
        </div>
        <div class="form-group">
            <label for="exampleInputRounded0">CoinMarketCap API </label>
                <input type="text" name="COINMARKETCAP_API" class="form-control rounded-0" id="exampleInputBorder" placeholder=".rounded-0" value="<?php echo $COINMARKETCAP_API; ?>" required />
        </div>
        <div class="form-group">
            <label for="exampleInputRounded0">Wisselkoers API(Geldeenheid)</label>
                <input type="text" name="CURRENCY_API" class="form-control rounded-0" id="exampleInputBorder" placeholder=".rounded-0" value="<?php echo $CURRENCY_API; ?>" required />
        </div>
        <div class="form-group">
            <label for="exampleInputRounded0">Skakel om na</label>
                <input type="text" name="CONVERT_TO" class="form-control rounded-0" id="exampleInputBorder" placeholder=".rounded-0" value="<?php echo $CONVERT_TO; ?>" required />
        </div>
    </div>      
        <div class="row mb-2">
            <div class="user-panel mt-3 pb-3 mb-3 d-flex">
                <button type="button" class="btn btn-block btn-outline-primary">Dien in</button>
                <button type="button" class="btn btn-block btn-outline-success">Herstel</button>
            </div>
        </div>
    </div>
    <section>

Header php
PHP:
<?php
ob_start();

    session_start();
    require_once 'connection.php';


    if ($_SESSION['user_name_ecom']) {
        $myusername = $_SESSION['user_name_ecom'];
        $user_id = $_SESSION['user_id'];
    } else {
        header("location: indexnew.php");
        die();
    //    exit(header("Location: indexnew.php"));
    }


    if ($_SESSION['user_id'])
    {
        $user_id = $_SESSION['user_id'];
        $loggedin_state = 1;
        $_SESSION['loggedin_state'] = 1;
        $a_unique_id = 181050300;
        $_SESSION['a_unique_id'] = $a_unique_id;
       
    } else
    {
        session_destroy();
        header("location: indexnew.php");
        die();
        //exit(header("Location: indexnew.php"));
    }


    $sql119 = mysqli_query($pdo, "SELECT * FROM  admin where admin_id  ='$user_id'  ");
    $productCount119 = mysqli_num_rows($sql119); // count the output amount
    if ($productCount119 > 0)
    {
        while ($row = mysqli_fetch_array($sql119))
        {
            $admin_name = $row["admin_name"];
            $admin_user = $row["admin_user"];
            $admin_pass = $row["admin_pass"];
        }
    }
?>
 
Joined
Nov 13, 2020
Messages
302
Reaction score
38
We don't have any of your files that you are calling on our computers so we can not run your code.
I do not see any mistakes in the coding, maybe someone else will take a look.

Add this to the php files
Code:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

And run the errors down.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top