Data Retrieval from sqlite3

20 views
Skip to first unread message

ruban bharath

unread,
Aug 16, 2018, 7:00:01 AM8/16/18
to Django users
Name             batch
a                      one
b                      two
c                      three
d                      four
e                      five

This is my  table

If i entered "d" in the front end (html)

my expected output must be like 

d      four

what is the django sqlite3 query to make run of it please do help me to come out from this ?

Thank you in advance

Jason

unread,
Aug 16, 2018, 7:11:07 AM8/16/18
to Django users
I would suggest you go through the django tutorial at https://docs.djangoproject.com/en/2.1/intro/tutorial01/

Your question suggests that you haven't done so, and it should help you find the answer to your question.

ruban bharath

unread,
Aug 16, 2018, 7:21:38 AM8/16/18
to Django users
cursor.execute('SELECT * FROM music_output WHERE username =?', t)
name2 = cursor.fetchall()
return render(request, "home.html", {'name3': name2})

This one suits me a error for using that "?" how can i pass parameter  to get dynamic input
thats my problem sir

Vikrant Gupta

unread,
Aug 16, 2018, 8:10:29 AM8/16/18
to django...@googlegroups.com
Hello Ruban,

Your code may be something like this 

var=‘d’ #input from HTML
Ans=models.objects.get(name=var)
Print(Ans.batch)

By,
Vikrant

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e102d8f6-bf73-4d37-b75b-95bc0254a551%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ruban bharath

unread,
Aug 20, 2018, 1:16:18 AM8/20/18
to Django users
Thank you sir , i got a solution for this 
Reply all
Reply to author
Forward
0 new messages