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 9 years ago.
Improve this question
I am working in codeigniter php. I want to search from database when it match some or one keywords.
But i don't know how to do it. When it match some keywords in database, in user panel it show some keyword related content.
Can anyone tell me how to do it ?
Here: http://goo.gl/yvwKi3
First 3 results tell you how to do it with full source code.
1) input field
2) onkeyup event
3) XMLHttpRequest
4) param "searchkey"
4) php script
5) db connection
6) query "SELECT * FROM table WHERE textfield LIKE '%".$searchkey."%'"
and the whole way back again...
You can use the Jquery "post()" method to post your search input to a php file which in turn runs a mysql query to look for the data in the database.
The php file should "echo" the results back in json format. Use "json_encode()" function for this.
Back in the jquery post() function, parse the json result and display it to the user.
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
Please forgive me if this has been asked and answered before, but I couldn't find it in the search.
As stated in the title, I have a form built in HTML. I need the user inputted data to be displayed in an HTML table. I know the easiest way to accomplish this is probably to do so using SQL to store and then retrieve the data and PHP to output it in the table itself. For the life of me I cannot get this to actually work. Google is absolutely my friend but literally nothing I've tried actually works. Examples would be wonderful and I seriously appreciate the help! Thanks!
This link could help you: https://stackoverflow.com/a/15251402/4149985
Basically, you need a web server, either locally or via a hosting provider with access to a database.
Your database needs to have a table, which contains records.
You need to use PHP to connect to the database, retrieve the records and then output them as a HTML table.
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'm working on project that some people can make post
and this post can have a code like php css html javascript ect
how can i insert php and another programming code to my database without any effect
(i mean by safety )
for me i'm using pdo with mysql database
i tried to upload the code to my database and when i fetch the information my html and css page changed to something else like what i upload from css
and i dont know if there was any php effect for this.
again what i mean is something like what stack-overflow use for to secure his database when we insert code to our post
is there is any library or something that i don't know ?
thank you soo much :)
for php code there is no problem after fetching the code if you are using pdo prepared it wana be just like any value you echo it
for the other hand you can use echo htmlspecialchars()
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.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a PHP page that retrieves a list from the DB, and I want to display it on a loaded page using Ajax.
Should I format it on the PHP side (HTML formatting), and just retrieve the data, or pass it to JS like dataA:dataB:dataC and format it client-side?
there won't be a lot of people using it, but I would like to know which is better (if there is a better method without taking the amount of users into account)
Both will work fine. However in my opinion if you're gonna use ajax - and transfer information - a better practice will be to wrap the data in JSON format and parse it on the client's machine.
Example of the php output:
{
"row1":{"field1":"value11", "field2":"value12"}
"row2":{"field2":"value21", "field2":"value22"}
...
}
Exmaple of parsing:
$.ajax(...).done(function(result){
$.each(result, function(index,value){
$('#conatiner').append('<div>'+index+': field1='+value.field1+', field2='+value.field2+'</div>')
})
});
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am updating 100,000 records. So the page looks blank while the update query process runs on the backend. Can someone tell me how to display the text "Please wait blah blah" until the update ends?
Well depending on your script and the structure, the easiest way would be to change a div's css property called display. When a user clicks on a link that starts the php script, you could add a javascript code like :
$(#+THEIDOFYOURDIV).show("slow");
});
and once its done, you can call another js function to close it like :
$(#+THEIDOFYOURDIV).hide("slow");
});
*NOTE I am using jquery functions, so you would need to include jquery in your pages.
There is another way you could do this using php ONLY, I had the same issue so take a look at this: how to show results while a php script is still running