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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:35:02+00:00 2026-06-15T12:35:02+00:00

Here are my codes: app.get(‘/index/:name’,function(req, res){ connection.query(‘SELECT * FROM deneme’,function(err, rows, fields){ if (err)

  • 0

Here are my codes:

app.get('/index/:name',function(req, res){
    connection.query('SELECT * FROM deneme',function(err, rows, fields){
        if (err) throw err;
        var paragraf = rows;
    });

    res.render('index', {
        title: req.params.name,
        para: paragraf
    });
});

But node can’t reach ‘paragraf’ variable from inside of ‘res.render’. Node returns

ReferenceError: paragraf is not defined

How can i reach paragraf variable from outside of asynchronous functio?

  • 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-15T12:35:03+00:00Added an answer on June 15, 2026 at 12:35 pm

    This is not how an asynchronous method result is supposed to be used, because the rows will not be available until the query callback is called.

    Try instead:

    app.get('/index/:name', function(req, res){
        connection.query('SELECT * FROM deneme', function(err, rows, fields){
            ...
    
            res.render('index', {
                title: req.params.name,
                para: rows
            });
        });
    });
    

    This way you access and render the results (rows) once they are available.

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

Sidebar

Related Questions

Here are my codes: app.get('/index/:name',function(req, res){ data = connection.query('SELECT * FROM deneme', function(err, rows,
Here's the relevant code: app.get('/all', function(req,res) { Party.find({},[],function(p) { console.log(p); }); res.redirect('/'); }); should
Here's the line from App.Config: <add key=CheckFileFormatString value=P{0}\t&quot;{1}, {2}&quot;\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}/> Here's the code that puts
I'm trying to add controller to my Todo list app. Here's the code. $(function(){
I have Backbone App Here are codes : This is Main.coffee : require [App/app,backbone]
I use the following codes to log users out from a web app. while
Ive been trying to get my app to change from one scene to another.
I integrate Devise to my app and here my current codes that I see
Here's the error code: The app you are using is not responding. Please try
Here is my code (seen on Google App Engine) public void doGet(HttpServletRequest request, HttpServletResponse

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.