Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7434977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:58:59+00:00 2026-05-29T09:58:59+00:00

I am trying to use mysqli for the first time because i have some

  • 0

I am trying to use mysqli for the first time because i have some problems with multiple Query’s in one php file. for start im just trying to retrieve data from the stored procedure and print it. but it looks like the code get’s stuck somewhere it printed ‘succesfull localhost’ but it never get’s to the code under it. The data never get printed neither the failed.

    <?php
$link = mysqli_init();
if (!$link) {
    die('mysqli_init failed');
}

if (!mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
    die('Setting MYSQLI_INIT_COMMAND failed');
}

if (!mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 5)) {
    die('Setting MYSQLI_OPT_CONNECT_TIMEOUT failed');
}

if (!mysqli_real_connect($link, 'localhost', 'root', '', 'fabiola')) {
    die('Connect Error (' . mysqli_connect_errno() . ') '
            . mysqli_connect_error());
}

echo 'Success... ' . mysqli_get_host_info($link) . "\n";


//require 'header.php';

$resID = mysqli_real_escape_string($_REQUEST['resID']);
$materialen_id = mysqli_real_escape_string($_REQUEST['materialen_id']);
$aantal = mysqli_real_escape_string($_REQUEST['aantal']);
$effectief_gebruikt = mysqli_real_escape_string($_REQUEST['effectief_gebruikt']);
$opmerking = mysqli_real_escape_string($_REQUEST['opmerking']);
$datum_van = $_REQUEST['datum_van'];
$datum_tot = $_REQUEST['datum_tot'];


$sqm = "CALL aantal_besch_mat_van_tot($datum_van,$datum_tot,$materialen_id,$resID)";
//$result = $mysqli->query($sqm) or die('Query Failed!');

/* Select queries return a resultset */
if ($result = $mysqli->query($sqm)) {
    printf("Select returned %d rows.\n", mysqli_num_rows($result));
    /* free result set */
    mysqli_free_result($result);
}else{
    echo 'failed';
}


mysqli_close($link);

?>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:59:00+00:00Added an answer on May 29, 2026 at 9:59 am

    Where is $mysqli set or initialized?

    There should be something like:

    $mysqli = new mysqli("localhost", "my_user", "my_password", "world");
    

    but I can’t see it.

    btw it’s weird that you’re mixing the function calling convention ‘mysqli_real_escape_string(…)’ with the object-orientated functions ‘$mysqli->query(…)’ I’m not sure it’s safe to do both.

    Also, you will save yourself a lot of heartache by using the MySQLi prepared statements rather than trying to make all your input safe by hand e.g.

    $query = "CALL aantal_besch_mat_van_tot(?, ?, ?, ?);";
    $statement = $mysqli->prepareStatement($query);
    $statement->bind_param('iiii', $datum_van, $datum_tot, $materialen_id, $resID);
    $statement->execute();
    //get the results.
    $statement->close();
    $mysqli->close();
    

    It’s just so much easier, and more secure to use prepared statements (at the cost of a few percent of performance) that really you should almost always use them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I am trying to use dbexpress component first time to connect to mysql i
I'm trying to use the PHP json_encode function to encode some JSON to send
I am trying to use AJAX for the first time, and I am having
I'm trying to use a MERGE INTO statement in my php file to update
i'm trying to create a cursor for the first time. I have looked at
I've trying to learn PHP OOP and have made some research on how to
I'm just trying to use aspx for the first time and I'm getting a
I am trying to use this MySQL query: SET @a:=0; UPDATE tbl SET sortId=@a:=@a+1
I don't use php or mysql but I am trying to upgrade a phpbb

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.