i hope i can explain my problem and someone can help me.
i keep getting this error on some queries i have trough out my site, some of my queries are very complex and some are very simple as "select field1, field2 from table1".
so in my php files i have written my queries something like this:
- Code: Select all
$sql = "select t1.field1, t1. field2, t2.field1, t2.field2
from table1 as t1
join table2 as t2 on t2.id2 = t1.id1
where t1.field3 = 'Smith'";
and i do it in this form so the queries can be more understandable. i do some tests and it works like charm, the problem is that sometimes just out of the blue i get the error: "Lost connection to MySQL server during query" at first i spent hours trying to figure out what the problem was until i re-arrange the query to look like this
- Code: Select all
$sql = "select t1.field1, t1. field2, t2.field1, t2.field2 from table1 as t1
join table2 as t2 on t2.id2 = t1.id1
where t1.field3 = 'Smith'";
and voilà works like a charm again. but then days later i get the same error as before and i have to re-arrange the query again, and again, and again, sometime i just need to add an extra white space after/before any word and it works again. anybody has had the same issue or knows a solution for this
i have used set_time_limit(0) at the beginning of all my files i open/close all my connections correctly but i just can figure out what the problem is... can someone please help me with this its driving me crazy.
PS. the rows found can vary from 1-1000, so i think the amount of rows returned has nothing to do with my queries either.



