Queries not working fully..

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
zangief
Forum Newbie
Posts: 5
Joined: Thu Feb 02, 2006 8:46 pm

Queries not working fully..

Post 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
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post 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 ?
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post 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.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: Queries not working fully..

Post 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.
zangief
Forum Newbie
Posts: 5
Joined: Thu Feb 02, 2006 8:46 pm

Post 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?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post 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.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post 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);
Post Reply