joliemoc's Recent Forum Activity

  • Hi all,

    Really need some help here. I dont know ajax myself, Iv been researching through the topics here on the site and youtube to get some help. I have created a php file for database connection and variables set up to hold the POST values from construct. The event page of construct is sending a name called 'lance' and the users input into my textbox called 'chatinput'. It all looks ok, but yet nothing is being inserted into the databse when I run the game no matter what Iv tried. There is a connection being made from the php file to my database as Iv tested that, but it seems to be an issue with the ajax part of either sending the values to the php file properly, or the php file isnt picking them up properly??

    I am so lost and this game is part of a project Im trying to do for college so Im very stuck at the moment.

    Any help would be very appreciated.

    Code is below:

    gameconnect.php file

    <?php

    header('Access-Control-Allow-Origin: *');

    require("db_connect.php"); // call to connection file

    include("functions.php");// include funtions file

    $db_link = db_connect("game"); //select database

    connect($db_link); //call to connect to db function

    $fn=$_POST['fname']; //variable for holding fname' lance' from consrtruct2

    $answer =$_POST['input']; // variable for user input text

    mysql_query("INSERT INTO useranswers(pps, text) VALUES ('$fn', '$answer')");

    ?> //******end of php file******

    ***CONSTRUCT2***

    parameters for AJAX POST to url section, in the data field this is the instruction I have:

    "fname='lance'&input='" & chatinput.text & "'"

  • Tutorial called : Sending info to a mysql database

    Hi ,

    If someone could take a look at this tutorial please.

    I am trying to carry out a similiar activity for sending info in a text box to my sql database existing on my own laptop. Where the url is requested by ajax, it just says "phpfiledirectorylisting?fname='lance'&testy='" & chatinput.Text & "'"

    This doesnt work as it is.

    The php page would be saved in the root folder of phpmyadmin as index.php for example , so is the url something like:

    localhost8080/index.php etc ?

    Other people have asked in the comments of the tutorial since,

    Please if someone can answer this question I have been unable to access my database and find a similiar way of doing it using my local phpmyadmin and sql database.

    Thanks very much

  • Hi Guys,

    I really need some help with this question. I have researched the tutorials, and looked on youtube.

    I need to take a users text input from a text box , and send it to store in my sql database. I have found a tutorial on this site that briefly gave an example of sending data to an sql database from a textbox using ajax. However, the tutorial isnt very clear on when you create a php file containing the database connection and the GET requests, it didnt say where this file should be saved. In the root folder of php my admin, or on construct 2 project file, or as a url??

    Im very lost with that.

    Any suggestions on this I would be very greatful as I cannot figure this out and get this idea of storing users text stored in my local database. My sql database is also on my laptop so its just locally stored on my laptop and not a database online.

    Thanks

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi,

    Im new to Construct 2, and Im creating a game where there will be questions asked and provided with 3 answers to choose from. The answers will just be "Always" "Never" "Sometimes".

    The user will choose one of these for each question asked.

    I want whatever answer the user clicks on, to save to my phpmyadmin database.

    How do I pass this? As in, Iv watched tutorials and read up on games that are quiz like, but they use the game feature of having a predefined correct answer that displays for example " Correct!" or "Wrong" but it doesnt save the clicked answer to a database. I need the selected answer to save to database so that the answers selected can be later viewed and pulled from the database.

    Is this possible to create an event for each button/Answer to just save to database and move onto the next question?

    Thanks very much. Finding it very difficult to find a similar working example.

  • Hi,

    My name is Maria and I just downloaded this program. I have to create a game as part of my uni thesis so hoping the forum will be helpful as Iv never created a game before so this should be interesting ha

joliemoc's avatar

joliemoc

Member since 18 Jul, 2017

None one is following joliemoc yet!

Trophy Case

  • 7-Year Club
  • Email Verified

Progress

8/44
How to earn trophies