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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:45:51+00:00 2026-05-22T21:45:51+00:00

I have two MySQL tables named ‘nodes’ and ‘joinTable’ like shown below. I need

  • 0

I have two MySQL tables named ‘nodes’ and ‘joinTable’ like shown below. I need to make an AJAX/jQuery?/MySQL call based on one node ID (in first table) that returns the following and pushes or places data into two JavaScript arrays and some variables:

  1. returns ‘type’ and ‘text’ from
    Node table. These will be placed in
    a seperate variables along with id.
  2. SELECT to_ FROM joinTable WHERE
    from_=’$id’ and then… goes through
    the nodes table to get all the
    associated ‘type’ and ‘text’ for
    each of the ‘_from’ and places or
    pushes these into a javascript array
    called ‘pointsTo’ along with the
    nodeID.
  3. SELECT from_ FROM
    joinTable WHERE to_=’$id’ and
    then… goes through the nodes table
    to get all the associated ‘type’ and
    ‘text’ for each of the ‘_to’ and
    places or pushes these into a
    javascript array called ‘pointsFrom’
    along with the nodeID.

nodes:

nodeID    type  text  
0           1   Dr. Joelson  
1           1   Ms. Appletree 
2           1   Mr. Miller  
3           1   Dr. Wilson  
4           0   Pediatrician  
5           0   Teacher  
6           0   Waiter  
...

joinTable:

recordID    from_   to_   weight    type    typeText  
0              0    4        1        1      isa  
1              1    5        4        1      isa  
2              2    6        3        1      isa  
...  

This AJAX options are overwelming to me and I have not done a MySQL call this
complex before. I would not mind learning more about a jQuery methodology that is applicable but am open to different approaches.


Edit:
The server is running PHP.

  • 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-22T21:45:51+00:00Added an answer on May 22, 2026 at 9:45 pm

    You’ll need to start off by choosing a server-side language like PHP to query your database and send back a JSON response to the client. On the other end, use a javascript framework like jQuery to make an ajax call to said PHP script on the server from your javascript code:

    // Get your nodeId from the user
    var id = 2;
    
    $.post("/scripts/doTheQuery.php",{
      nodeId: id
    },function (result) {
      // when query finishes
      // do stuff with result
      console.log(result);
    }
    

    As far as your SQL question:
    1.
    SELECT type,text FROM nodes WHERE nodeID = {$nodeIDinQuestion}

    I’ll punt on the join queries and let you get that far first.

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

Sidebar

Related Questions

I have two tables like below, mysql> select * from Books ; +----+------+------------+----------+----------+ |
I need some help with a MySQL query. I have two tables, one with
I have two MySQL tables and I would like to know if there is
I have two tables in mysql: Results Table : 1046928 rows. Nodes Table :
I have two mysql tables, one containing details on cars and one containing all
I have two identical tables and need to copy rows from table to another.
I have two table in mysql named rootpath with only one field 'root' and
that´s my first question in stackoverflow . I have two MYSQL tables: categories and
I have two MySQL tables: product has id , title , price and some
I have two mysql tables: Item containing items that one can buy: CREATE TABLE

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.