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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:58:15+00:00 2026-06-11T08:58:15+00:00

I am running this php script from an ajax call: <?php require_once(‘myConnectDB.inc.php’); //add beer

  • 0

I am running this php script from an ajax call:

<?php

    require_once('myConnectDB.inc.php');

    //add beer to database code
    $uID = $_GET['uID'];
    $uName = $_GET['uName'];
    $fID = $_GET['fID'];
    $fName = $_GET['fName'];

    //data from ajax call: "uID="+reqID+"&uName="+reqName+"&fName="+frID+"&fID="+frName,

    //add above data to database
    $db = new myConnectDB();
    error_log("Successfully created DB");                       


    error_log("uid" . $uID);    
    error_log("uName" . $uName);    
    error_log("fID" . $fID);    
    error_log("fName" . $fName);    

    $query3 = "INSERT INTO friends (userID,userName, friendID, friendName, friend) VALUES ($uID, '$uName' ,  $fID , '$fName' , 1 )";
    $result = $db->query($query3);

    error_log("Ran query [$query3] and got result: " . print_r($result, true));

    ?>

I inserted error_log to try and figure out why my query was not inserting into my database. Here is the output of my log:

[10-Sep-2012 20:36:54] Successfully created DB
[10-Sep-2012 20:36:54] uid6
[10-Sep-2012 20:36:54] uNametest
[10-Sep-2012 20:36:54] fIDmike
[10-Sep-2012 20:36:54] fName3
[10-Sep-2012 20:36:54] Ran query [INSERT INTO friends (userID,userName, friendID, friendName, friend) VALUES (6, 'test' ,  mike , '3' , 1 )] and got result: 

What I find odd here while looking at the error log is it seems some place in my php it switches the values oof fname and fID there values should be swapped.

Is this screwy or am I over looking something obviousness?

  • 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-11T08:58:17+00:00Added an answer on June 11, 2026 at 8:58 am

    Look at your AJAX call:

    "uID="+reqID+"&uName="+reqName+"&fName="+frID+"&fID="+frName,
    

    this indeed does look as if fID would carry frName, while fname would carry frID!

    On a side note: You surely appreciate, that a fName of something like

    ',1); DROP TABLE friends; -- 
    

    would be quite funny?

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

Sidebar

Related Questions

I'm running this php script at my database verbatim from a tutorial, yet I'm
I have a php script http://example.com/myapp/myscript.php running on an Apache server. I call this
I have ajax call which pulls from the processing script 'getajax.php'. Call is made
I have a PHP script with infinite loop. I need this script running forever.
After running this query statement with my database: select * from articles where content
We are currently running an ajax auto complete script through mySQL, as such: <?php
I'm running a PHP script from CLI that user the DirectoryIterator::getExtension() method in PHP.
Suppose I make an AJAX HTTP Request from jQuery to a backend PHP script.
Running this query takes a long time: SELECT host,ip FROM arecords WHERE ip IN
When running this XNA application it should display a rotated rectangle that moves from

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.