Hi there
I have some SQL warnings in my project:
Warning: mysql_query() [function.mysql-query]: Unable to save result set in /mnt/w0505/www/data/index.php on line 673
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /mnt/w0505/www/data/index.php on line 675
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /mnt/w0505/www/img/bd.php on line 32
Problematic parts of code:
Last file (bd.php)
if ($SESSION["usid"]) {
$usid = htmlspecialchars($SESSION["usid"], ENT_QUOTES);
$result = mysql_query("SELECT * FROM work_user WHERE us_id = '$usid' LIMIT 1");
while ($row = mysql_fetch_assoc($result)) {
$ty_pe = $row["us_type"];
$us_er = $row["us_name"]." ".$row["us_surn"];
;}
$text_logg = "<div class='logon'><form method='post'><input name='a_exit' type='hidden' value='us_er'>
and part for first 2 warnings:
$result = mysql_query("SELECT co_id, co_full_name, co_phone, co_fax, (SELECT ad_city FROM work_home WHERE ad_firm = co_id ORDER BY ad_data LIMIT 1) AS city, (SELECT ad_province FROM work_home WHERE ad_firm = co_id ORDER BY ad_data LIMIT 1) AS prov, (SELECT AVG(da_date) FROM work_date WHERE da_firm = co_id) AS avda FROM work_firm $sql $sql_order");
$count = $total = 1;
while ($row = mysql_fetch_assoc($result)) {
$co_id = $row["co_id"];
$co_full_name = $row["co_full_name"];
$co_city = $row["city"];
$co_province = $row["prov"];
$co_phone = $row["co_phone"];
$co_fax = $row["co_fax"];
$total = round($row["avda"]);
if ($total == 0) {$total = "none";}
$text_s = "<tr><td class=\"r\">$count<td><b><a href=\"?look=$co_id\" title=\"Look company’s information\">$co_full_name</a></b><br>Phone: $co_phone Fax:$co_fax<td class=\"r1\">$total<td>$co_city ($co_province)\n";
if ($avda && ($total == "none")) {$total = "none";}
elseif ($avda == 1) {
if ($total > 0 && $total <=40) {$text_1.=$text_s; $count++;}
;}
elseif ($avda == 2) {
if ($total > 40 && $total <=50) {$text_1.=$text_s; $count++;}
;}
elseif ($avda == 3) {
if ($total > 50 && $total <=60) {$text_1.=$text_s; $count++;}
;}
elseif ($avda == 4) {
if ($total > 60 && $total <=90) {$text_1.=$text_s; $count++;}
;}
elseif ($avda == 5) {
if ($total > 90) {$text_1.=$text_s; $count++;}
;}
else {$text_1.=$text_s; $count++;}
;}
More about problem:
Basically my scripts provide names of companies and range of days associated with them(more 5000 companies in database).
I get those warnings running search for amount of days and blank company name.
If provided parts of code are not sufficient for solution for my problem, let me know and I will paste more or the whole source.
Thank You