Query will not get complete data

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
SalS
Forum Newbie
Posts: 4
Joined: Wed Nov 19, 2003 2:43 pm

Query will not get complete data

Post by SalS »

I have a Windows 2000 server running IIS6, the latest version of MySQL and the latest version of PHP.This machine is the Database Server I have 2 other boxes I am using as Web Servers, one is a Linux machine running Mandrake 9.1, Mysql, Apache and PHP. When I use this machine as the webserver, I can run a php script and access the MySQL database on the W2K server and have it display a nice neat table with all the information on it. On the other machine I have W2k, PHP, MySQL and IIS6. When I use this box as the webserver and run the same script to hit the same server that the linux machine is hitting it will not bring up all the data. Refreshing the page will bring up varying amounts of data from the table. I am going back and forth and am thinking it is a problem with IIS and not the Database server.
Does anyone have any ideas on this one?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Seems like timeout problem.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

i was thinking more on the lines that he didn't configure his sever that is messing this data up correctly, or he is using different code since it will work on one server but not the other.

could be a number of things such as incorrect database structure on one server, but correct on the other.

without code, it's kind of hard to accurately determine though :-\
SalS
Forum Newbie
Posts: 4
Joined: Wed Nov 19, 2003 2:43 pm

Post by SalS »

The database is on one server. A w2k server with MYSQL and PHP and IIS. The other 2 boxes are the linux and another w2k server acting as webservers. Both these boxes connect to the Database server and use the exact same code to retrieve the data. I agree the one seems like a time out function, but I have set every time function I could find on the webservers and the database server. Why does the Linux box not time out and the windows box does. Is there some settings on the Windows webserver (IIS) that I am missing? The Linux box is using Apache.
I even moved the database to the one Windows webserver and had it query itself and still got the timeout??????
Thanks for the replies.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

see, i dunno. it's hard to follow what you mean. is there any way we can get an example of the problem ( like you post what it looks like when it works, and what it looks like when it messes up ). also, if you have ANY ERROR CODES at all, be SURE to post the error code along with the line(s) of code that it refers to. Other than those things, it won't be anything with php or mysql, rather it would be something wrong with your network configuration on one of the boxes.

but if you are getting partial information as you say you are, it sounds more like to me a coding issue.
SalS
Forum Newbie
Posts: 4
Joined: Wed Nov 19, 2003 2:43 pm

Post by SalS »

there are no error messages, when it works I get a nice table with all the data, when it doesn't I only get part of a table. If the query comes back with smaller results then everything works fine. I can post the code used for the query and the table but the results would be way to much to post.

<?
$sDB = "Database";
$db_link = mysql_connect('SERVER, 'usr', 'pw');

if($db_link<1) {
echo "Database unavailable !<br>";
exit;
}

$query="SELECT distinct courseNo, courseDesc from fileInfo" ;
$res=mysql_db_query($sDB,$query,$db_link);
if($res<1) {
echo "Select failed !<br>";
}
?>
<span style="font-size:20px;font-weight:bold;">All Course Comments<br><br></span>
<table border="1" width="100%">
<?

while ($row = mysql_fetch_array ($res)) {

echo "<tr><th colspan=\"3\" align=\"left\" style=\"font-size:16px;font-weight:bold;\">".$row[0]."--".$row[1]."</th></tr>";


$query2 = "SELECT distinct firstName,lastName,comment from fileInfo where courseNo='".$row[0]."'and comment<>'!' and comment<>' '";
$res2=mysql_db_query($sDB,$query2,$db_link);
$num_rows = mysql_num_rows($res2);
if($res2<1) {
echo "count failed !<br>";
}
while ($row2 = mysql_fetch_array ($res2)) {
?>
<tr><td style="font-size:12px"><?=$row2[0];?></td><td style="font-size:12px"><?=$row2[1];?></td><td style="font-size:12px"><?=$row2[2];?></td></tr>
<?
}
?>
<tr><td style="font-size:14px;font-weight:bold;" colspan="3">Total: <?=$num_rows;?></td></tr>
<?
}

?>
</table>


Any help you can give would be appreciated.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

hmm... try [php_man]set_time_limit[/php_man] to a, say, 180 seconds....
SalS
Forum Newbie
Posts: 4
Joined: Wed Nov 19, 2003 2:43 pm

Post by SalS »

nope that did not do it. I have been looking at the CGI portion of the php.ini, it is a little confusing but if it is running on IIS should "cgi.force_redirect =" be set to 1 or 0.? Mine is set to 1.
Post Reply