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 8441415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:33:31+00:00 2026-06-10T08:33:31+00:00

I do not have any other option, but to ask here again… and problem

  • 0

I do not have any other option, but to ask here again… and problem is killing me for the past 5 hours. I got button that call javascript function, and then javascript opens another php page and does insert in MySQL database.

HTML code:

<ul>
<li id="ConfirmButton" name="Insert" onclick="GetAllIDs()"><a>Potvrdi</a></li>
</ul>

Javascript code:

var request_type;
var browser = navigator.appName;
if (browser == "Microsoft Internet Explorer") {
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}
else {
request_type = new XMLHttpRequest();
}

var http = request_type;
http.open('get', 'insert.php?MatchID='+MatchID+'&TipID='+TipID+'&UserID=' + 1,true);
http.send(null); 

PHP code:

include('config.php');
$matchID = $_GET['MatchID'];
$tipID = $_GET['TipID'];
$userID = $_GET['UserID'];

// Escape User Input to help prevent SQL Injection  
$MatchID = mysql_real_escape_string($matchID); 
$TipID = mysql_real_escape_string($tipID); 
$UserID = mysql_real_escape_string($userID); 

$insertTicket_sql = "INSERT INTO 
betslips(DateTime,MatchID,TipID,UserID)
VALUES(".$MatchID.",".$TipID.",'".date("Y-m-d H:i:s")."',".$UserID.")";
$insertTick= mysql_query($insertTicket_sql) or die(mysql_error());

So after I run this code and I use break point I see in my php code all parameters I sent over forms normally and it’s all there, but when I reach code $insertTick I get error
web server exited unexpectedly, restarting new instance.

Has anyone seen this problem before, and how can I deal with it?

Thanks

  • 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-06-10T08:33:32+00:00Added an answer on June 10, 2026 at 8:33 am

    did anyone seen this problem before?

    Not me, I dont use the mysql_* functions.

    Your INSERT query parameter and values dont match.

    So ive ported your example code to PDO perhaps its some interest:

    <?php 
    //PDO Connect
    try{
        $con = new PDO('mysql:host=127.0.0.1;dbname=yourDB','root','password');
        $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $con->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
        $con->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE,PDO::FETCH_ASSOC);
    }catch (Exception $e){
        die('Cannot connect to database. Details:'.$e->getMessage());
    }
    
    //Check that the variables are set
    if(isset($_GET['MatchID']) && isset($_GET['TipID']) && isset($_GET['UserID'])){
    
        //Prepare your query
        $query = $con->prepare("INSERT INTO betslips (DateTime,MatchID,TipID,UserID)
                                VALUES ('".date("Y-m-d H:i:s")."', :matchID, :tipID, :userID)");
    
        //Bind your values with the placeholders
        $query->bindParam(":matchID", $_GET['MatchID']);
        $query->bindParam(":tipID", $_GET['TipID']);
        $query->bindParam(":userID", $_GET['UserID']);
    
        //Execute
        $query->execute();
        die('Success!');
    }else{
        die('Error: Parameter not set.');
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know there have any other way that (by not using json_encode and
I have several textboxes in my aspx file (not nested in any other controls),
I am already familiar with Silverlight programming but not have any experience with GIS.
I have a Xaml file that does not have any code behind. I would
I have inherited couple of .Net (C#) application which does not have any tracing
datetime.datetime.utcnow() Why does this datetime not have any timezone info given that it is
I have a table with CreateDate datetime field default(getdate()) that does not have any
I have six tables, which unfortunately does not have any primary/foreign key-relations encoded. I've
Firstly, I do not have any malicious intent out of this question. I would
In a large WPF-project setting padding on buttons does not have any effect what

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.