Page 1 of 1
Queries not working fully..
Posted: Tue Jul 24, 2007 5:50 am
by zangief
here's my problem:
We have a page wherein it loads very slowly (probably because of the complexities of the formulas in the back end), and sometimes the queries return more than 20 rows. the problem is that whenever i input values on the textbox and continue inputting on that one textbox (the page only has 1 inputtable textbox) till you get 15 or more rows with an inputted textbox, only around 7-12 values are saved into the database.
My questions are:
1) How can i make my page work in a way that all of the rows are saved into the database? and
2) If i include variables(ex. sum, etc) on my sql queries instead of making dozens of variables, would it help decrease the server lag time?
We've been dealing with this problem for a week now and sad to say, I'm getting way behind schedule
Thanks for the help
J-Rem
Posted: Tue Jul 24, 2007 8:39 am
by anjanesh
the problem is that whenever i input values on the textbox and continue inputting on that one textbox (the page only has 1 inputtable textbox) till you get 15 or more rows with an inputted textbox, only around 7-12 values are saved into the database.
Can you make this clearer ?
Posted: Tue Jul 24, 2007 9:24 am
by Ollie Saunders
Run the code with "display_errors" set to "on" and "error_reporting" set to E_ALL if that doesn't shed any light on the issue post the code here.
Re: Queries not working fully..
Posted: Tue Jul 24, 2007 10:34 am
by superdezign
zangief wrote:2) If i include variables(ex. sum, etc) on my sql queries instead of making dozens of variables, would it help decrease the server lag time?
SQL usually takes more time than PHP, depending on how many records you're dealing with. The built-in MySQL functions are meant to be user sparingly, as they must be performed for each and every row that you retrieve.
Posted: Tue Jul 24, 2007 8:01 pm
by zangief
anjanesh wrote:the problem is that whenever i input values on the textbox and continue inputting on that one textbox (the page only has 1 inputtable textbox) till you get 15 or more rows with an inputted textbox, only around 7-12 values are saved into the database.
Can you make this clearer ?
what i meant was every row only has 1 textbox, the rest are static values, but every row loads very slowly because there're tons of code in the backend. now if i put values on all the textboxes, it'll only work on the 1st row until the7th-12th row, then after that the database doesnt save the rest, or it saves a totally different value.
im assuming that it has something to do with the database timing out or something, because the 1st-12th row seems to be working according to the code. but of course, i could be wrong.
Run the code with "display_errors" set to "on" and "error_reporting" set to E_ALL if that doesn't shed any light on the issue post the code here.
sadly, i have no control of our phpmyadmin. id definitely request our tech support to do so though. thanks for the suggestion
SQL usually takes more time than PHP, depending on how many records you're dealing with. The built-in MySQL functions are meant to be user sparingly, as they must be performed for each and every row that you retrieve.
so php variables loads faster than sql variables?
Posted: Tue Jul 24, 2007 10:52 pm
by superdezign
zangief wrote:SQL usually takes more time than PHP, depending on how many records you're dealing with. The built-in MySQL functions are meant to be user sparingly, as they must be performed for each and every row that you retrieve.
so php variables loads faster than sql variables?
No, PHP variables would only need to be created once, while SQL would need to perform the operations for each row.
Posted: Wed Jul 25, 2007 2:54 am
by Ollie Saunders
Well if it's a production server you don't want display_errors turned on ordinarily because it's a security risk. And for the times that you do, like this one, you can do this:
Code: Select all
ini_set('display_errors', true);
error_reporting(E_ALL | E_STRICT);