Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am a new user of php.
I have one table in mysql database. I have a form which the users use to query the mysql database. I am testing my html form page on my linux laptop which has APACHE server.
I am able to make a connection to the mysql database and display results in the browser.
I am not sure how to capture the results from the variable which has query results which has several rows of data and be able to write the results to a text file in /var/www/
Thank you
I noticed every time you check if the POST variable is set you use something like
if(isset($POST["submit"])){
Was that a typo in this post or are you forgetting the underscore?
if(isset($_POST["submit"])){
Also try to use mysql_fetch_assoc instead of mysql_fetch_array.
And always prepare the variabes for usage in a query if you do not want to get hacked instantly.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to be able to have my main page (index.php) check every 10 seconds for a change in the mysql database table 'refresh'. If the 'refresh' value is 1 it needs to refresh the page in its entirety. If the value is zero it does nothing. I would use meta-refresh but I cannot have the page always refreshing as the page has a slider and it would mess up the rotation. Please let me know what you think of! Thanks in advance!
Use AJAX to check if an update is required.
http://api.jquery.com/jQuery.ajax/
You should learn the basic how to's of AJAX before using something like jQuery when you don't even know what's going on.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have to display data consisting of approx. 1000 character.
Right now, I am using a text file and fetching it from there line by line till end of file and displaying it through AJAX.
But its quite slow.
I wanted to know if i store that data in database as text would it make difference ?
Yes. It does depend on how many lines there are tho. If there aren't many lines, it won't make much of a difference.
I would recommend (for something small) a txt file on the server and directly getting it directly with AJAX, without the addition step of php and sql.
You shouldn't need to read line by line. You can read the full string with:
file_get_contents('/path/to/file')
I cannot foresee storing the text in a single database row/field will improve efficiency at all.
actually storing text in database can slowdown performance, looks like your problem is in line-by-line reading, read about file_get_contents or file or the best way readfile
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I got it from MaxMind
And this is how the data looks like:
Country,City,AccentCity,Region,Population,Latitude,Longitude
ad,aixas,AixĂ s,06,,42.4833333,1.4666667
ad,aixirivali,Aixirivali,06,,42.4666667,1.5
ad,aixirivall,Aixirivall,06,,42.4666667,1.5
ad,aixirvall,Aixirvall,06,,42.4666667,1.5
ad,aixovall,Aixovall,06,,42.4666667,1.4833333
ad,andorra,Andorra,07,,42.5,1.5166667
I want to convert the structure of this unknown type data into MySQL query language so that I can insert it into my MySQL database. Is it possible?
The data is about 145 MB!! I can paste the whole data code if required.
Alternative required solution: What should I do to insert it in my database?
that looks like a regular CSV to me, and PHPMyAdmin is capable of handling such format in the import menu
The problem I see there is that you've got a large file to upload and most php configurations won't allow you such big upload. Why not try it with, say, the first 1000 lines of your file?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have got two php forms - question.php and marks.php. I want that each time question.php submits its values to marks.php , the variable $total in the form marks.php be incremented. I have tried using static variable but still am not able to get it done!
Nothing "inside PHP" itself will persist anything across different page loads. You need to store the value somewhere "external", e.g.:
write it to a file
write it to a database
store it in a memcache or other kind of cache
send it to yourself in an email
burn it into the screen of the computer and use an elaborate video camera and OCR setup to read it back
...
maybe: sessions
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
This is something I need help on.
Im going to allow a user from my database to "share" a record which gets sent from the database into a solid html file.
So I'm looking at ways to create a html file from data in a database which is passed through php and stored in a location on the server. with no interaction from the user at all other than pressing 'share'. They would be sent the url to look at it upon success.
I'm looking for any functions or tuts on how to best make a html file from php. any help is appreciated. I think I may be looking into this too much, and the answer may be staring me in the face
As it got clear, you want static html files, created dynamically via PHP and written on the server.
The steps you need to follow are clear too:
You need the database and as you said you have it
You need to connect to it via PHP
Then do the respective queries
Fetch the data from them
Use it in the HTML
Open a file
Send the used data to it
Write the file with the relevant name
The querying should start after the button share is clicked (you can track this via isset() function)