Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am creating a website in codeigniter and i wants to give a functionality of following other user account. How can I refresh the code using ajax after some specified time? So can somebody give me some easy suggestion to do that with ajax?
You can create a table notification. When a user followed by another user. You add data in notification table. Table structure is as follows
id int
image text if you need to show image with notification.
title text Eg. Ram followed you.
link text Link on which you want to redirect.
notification_for text user_id of user (sometimes notification is for multiple users)
login_type text I use this table for admin/front panel. So I've to use this
created_date datetime
created_by int
updated_date datetime
updated_by int
status int
jQuery Code
$(document).ready(function(e){ getnotification();});
function getnotification(){
$.ajax({
url : path/to/post,
type : 'POST',
data : {'id':id},
success : function(e) {
window.setInterval(function(){getnotification();}, 5000);//run after 5 seconds
},
});
}
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a question about developing a webapi. I want to send someone an email with an confirmation Link and If he clicks on it he should be redirected to a thanks page and get a second email with a pdf.
Unfortunatly I have no idea how to create the confirmation link. I can use every web language as php and node js.
One way to do this is to generate a long and random id and then pass that id as a url parameter.
var key = '25f56c64ee724e15b1b83688e9785a38'; /* Generated Key. */
var link = `https://some-url.com/example/${key}`;
In your database you would have a lookup table that maps the key to the userId.
The route for /example/{key} would then perform a fetch of the user information and generate the page and could also send the email with the pdf.
Note that the security here is is based on the randomness and length of your key. Adding an expiration would be good practice.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to prompt user to update his profile on logon, if he has not updated some of his data using bootstrap modal. I check for null values for the given user in database and then if the values are null the user must be prompted to update the data
So as I understood, you want to let the user update data if there are null values inside the database. You can do it like this, you let the user log in, direct him to the page where you intend to send them after logon. Keep in mind that you need to know inside PHP that does the user have the null values inside database (you can add that data to a session for example). After that, you just check it, if there are null values, show him the modal.
<?php
if ($_SESSION['update_user'] !== FALSE) {
?>
<!-- modal html code -->
<?php } ?>
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a table called invoice_details consisting of :
id
invoice_id
product_id
product_name
quantity
price
I have a form field that allows input of the product name,qty,etc.
I want to add a column that will be called "room". The script I have now auto generates more form fields as I need them, in which I could add "room" and specify within the form field, but I want to have the following workflow :
Page loads Rooms(or lack of)
click a button to add a room(or
multiples)
ability to search products, and click and drag products
to specific rooms
have all data saved correspondingly in sql
database
What web technologies do I need to research to be able to achieve the above result?
JavaScript/jQuery to handle the front end clicking dragging
PHP (I assume you're already using it) to handle the database queries
PDO - a function in PHP for writing to databases
AJAX - a way of getting data from your JavaScript front end to the PHP backend
Incidentally - you might want to look at InteractJS which is designed to handle the drag and drop your're looking for - you just have to then AJAX the data back to your PHP server for processing.
Good luck!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am running an apache2 webserver and want to run a database off of it using phpmyadmin. I am making an android app that needs to connec to make http requests. The app is a simple app where there are 2 buttons and the user can click on the buttons as many times as they want to vote on each person. I was thinking of creating one table with 2 columns in it with the name as "person1" and "perosn2" but according to my research, that won't work. Could anybody give me a simple run through of how i would get this to work. i hve confused myself.
You probably want 2 tables something like this.
People:
id | name
Votes:
id | person_id | timestamp
When someone votes for someone, create a new record on the votes table using the correct person ID. The id could be stored on the android device if it doesn't need to be dynamic.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
but did not understand
The concept of generating a link &
more importantly how they save the data in database,do they save it like id of poll & yes/no click or done with other logic.
what will happen to the polls which are expired? will they remain in database or somewhere else?
please help
To handle URL you can use cURL.
But I have an easy method. You can use the concept of Query Strings.
To Create New Question
Store the new question in database.Give Each Question a unique ID.
Then After user submits the questions show him a link like:
http://do-survey.com?question=xzxsa
To store polls
Get question like:
if(isset($_GET['question']))
{
$question = $_GET['question'];
// Now you have the question unique id manipulate the database using this
}
this is not the place to ask such questions, but to make my answer at least remotely useful:
they're not generating a link. That link doesn't exist under the form of a file on the server. Take for example a database containing 'id' 'poll' 'var1' 'var2'.
You can make a php page that gets a param from the link, have it like mysite.com/poll?id=1
The php script will get the '1' as a param, then you SELECT * FROM table WHERE id=1 and you generate the contents via php with the data from the DB.