[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

PHP - MYSQL bug - Works in Mozilla not IE6

Asked by GTsafas in PHP Scripting Language, Internet Explorer Web Browser, PHP and Databases

I have a script that posts to another which then checks mysql database and returns the results.

If it finds a result there is no problem page is displayed.

If there is none then the page does not display. However if you refresh it it loads.

This does not occur in mozilla.

Please let me know if you guys see anything. (Other than the first error being that im using IE)

Thanks ahead of time.


1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
Asearch.php
<form id=areasearch action=http://andimproudofit.com/searcharea.php method=post target=_blank>
Search By Area Code:<br>
<table><tr><td align=left width=50>
<input type=text name=asearch value="" size="3" class="required validate-number"></td><td align=right size=50><input type=submit value=GO! class="button_login"></input></td></tr></table>
</form> 
 
searcharea.php: 
<?php 
if (strlen($_POST['asearch']) == "3"){ 
	$mystring = $_POST["asearch"];
} else {
	$mystring = "0";
} 
include('header.php'); 
if($_POST['submit']){
    if(!isset($_SESSION['user']['username'])) $username = "Anonymous";
    else $username = $_SESSION['user']['username'];
    @$query = mysql_query("INSERT INTO `comps`(time,message,accepted,votes1,votes2,via,user,cat,numcoms,subcat) VALUES ('". time() ."', '". clean($_POST['comp']) ."', 'No', 0, 0, 'internet', '". $username ."', '". clean($_POST['cat']) ."', '0', '0')") or die(mysql_error());
    
    echo "<strong>Your submission has been received!</strong>
    <script type=\"text/javascript\"><!--
setTimeout('Redirect()',1000);
function Redirect()
{
    opener.location.href='./';
    window.close();
}
// --></script>";
} else { 

} 
$cnt = '<form action="submitCompliment.php" class="submit_form" method="POST" target="sendCommentIFrame">
    <table id="submissionform">
    <tr><td class="input" colspan=5>
    <textarea onfocus="javascript:document.getElementById(\'commbox\').value=\'\';" name="comp" rows="13" height="75" cols="20" id="commbox">'. $names[4] .'</textarea>
    </td></tr>
    <tr><td>
    <input name="cat" type="hidden" value="'. key($catlist) .'" >'; 
$cnt .= '
</select></td></tr> <tr><td><input type="submit" name="Ok" value="Submit!" class="button_login2"/>
</td></tr>
<tr><td>
<div id="loadingsubmit_article" style="display:none;"><img src="images/loader.gif"/></div>
<div id="resultsubmit_article" style="display:none;"></div>
</td></tr>
</table>
       </form><iframe name="sendCommentIFrame" style="display:none"></iframe>'; 
//$maincontent = "<h1><a href=\"javascript:submitToggle();\" class=\"submit\" style=\"font-weight: bold;\">" . $submitpop . "</a></h1><div style=\"display: none;\" id=\"submit\" class=\"post\"><div id=\"result2\" class=\"result\">" . $cnt . "</div></div>"; 
$maincontent .= "<div id=\"mainresultlist\">\n";
$comp = $_GET['comp'];
if(!$comp){
	$page = $_GET['page'];
    if(!$page) $page = 1;
    $npage = $page - 1;
	$c = mysql_real_escape_string($_GET['c']);
    if($c){
        $addsql = " AND `cat` = (SELECT id FROM cats WHERE cat='". $c ."')";
        $addhtml = "&c=". $c;
    } 

    $limit1 = $npage * 10;
    $limit2 = $npage + 10; 
	$q = "SELECT * FROM `comps` WHERE `area` = $mystring". $addsql ." ORDER BY `time` DESC LIMIT ". $limit1 .", ". $limit2; 
    $r = mysql_query($q);
	
    $voting_array = mysql_fetch_array(mysql_query("SELECT * FROM `votes` WHERE `ip`='$ip'")); 
    $vote_explode = explode(',', $voting_array['comp_id']); 
    foreach($vote_explode as $vote_ex){ 
        $vote_ex = explode(":", $vote_ex); 
        $compnum = $vote_ex[0];
        $compvote = $vote_ex[1];
        $compvotearray[$compnum] = $compvote;
    } 

     
    if(mysql_num_rows($r) > 0)
    {
        while($row = mysql_fetch_array($r, MYSQL_ASSOC)){
            
        	// count the comments
            $commentsCountQuery = "select * from comments where comp_id=" . $row['id'];
            $commentsCountResult = mysql_query($commentsCountQuery);
            $commentsCount = mysql_num_rows($commentsCountResult); 
            $maincontent .= "<br />\n<div id=\"result". $row['id'] ."\" class=\"result\">\n"; 
            $maincontent .= '<div class="areacodee">This A#$ Hole is from area code:&nbsp;<span>'. "(" . $row['area'] . ")" . '</span></div><br>';
            
            $maincontent .= '<a href="comment/'. $row['id'] .'" class="commlink">';
            $maincontent .= stripslashes($row['message']) ."\n<br /><br />\n";
            $maincontent .= '</a>';
            $maincontent .= '<span class="sentBy"><span class="lside"><a href="comment/'. $row['id'] .'" class="commlink">read comments ('. $commentsCount .') <br><table><tr><td>ShareThis!&nbsp;&nbsp;&nbsp;</td><td><img src="images/share10.png"/></td></tr></table></a></span>';
            if(!$compvotearray[$row['id']]){ 
                $maincontent .= '<span id="vote_buttons'. $row['id'] .'" class="vote_buttons">
                <span id="a1votes_count'. $row['id'] .'">
                <a id=":'. $row['id'] .':1:'. $row['votes1'] .':'. $row['votes2'] .':" class="vote_up" title="'. $phrase1 .':'. $phrase2 .'" href="javascript:;">
                '. $phrase1 .' ('. $row['votes1'] .')</a></span>';
                $maincontent .= '   -   <span id="a2votes_count'. $row['id'] .'">
                <a id=":'. $row['id'] .':2:'. $row['votes1'] .':'. $row['votes2'] .':" class="vote_down" title="'. $phrase1 .':'. $phrase2 .'" href="javascript:;">
                '. $phrase2 .' ('. $row['votes2'] .')</a>
                </span></span><br />';
            } else { 
                $maincontent .= '<span id="vote_buttons'. $row['id'] .'" class="vote_buttons voted">
                <span id="a1votes_count'. $row['id'] .'">
                '. $phrase1 .' ('. $row['votes1'] .')</span>';
                $maincontent .= '   -   <span id="a2votes_count'. $row['id'] .'" class="vote_buttons voted">
                '. $phrase2 .' ('. $row['votes2'] .')
                </span></span><br />'; 
            }
            $maincontent .= '<span class="mesdetail">'. date('F j, Y \a\t g:i a ', $row['time']) .'by <a href="'.linkbasepath.'user/' . $row['user'] .'">'.$row['user'].'</a>
        </span>';
            $maincontent .= '<span class="mesdetail"> <a href="'.linkbasepath.''. $catlist[$row['cat']] .'">'. $catlist[$row['cat']] .'</a></span>';
            $maincontent .= "</span>";
            if($sharelinks == 'yes') $maincontent .= '<span id="addslider'. $row['id'] .'">
<a class="addslide" onclick="Slide(\'result'. $row['id'] .'\',\'down\');" href="javascript:;" style="">[+]</a>
</span>
<div id="sharelinks'. $row['id'] .'" class="sharelinks">'. $sharelinkscode .'</div>';
            $maincontent .= "</div>";
        }
    } else {
        $maincontent .= "<strong>There are no results in this category.</strong>";
    } 
    $q = "SELECT COUNT(*) FROM `comps` WHERE `accepted` = 'Yes'". $addsql;
    $r = mysql_query($q);
    $num = mysql_fetch_array($r);
    $nbrPages = ceil($num[0] / 10); 
    $i = 1; 
    $maincontent .= "<br />"; 
    // Pagination links.
    $nbrPages = $nbrPages;
    $thisPage = "";
    include("pagination.php");
    $maincontent .= $paginationLinks;
//    while($i <= $nbrPages){
//        if($i == 1) $maincontent .= "Pages: ";
//        if($i != $page) $maincontent .= "<a href=\"?page=". $i . $addhtml ."\">". $i ."</a>\n ";
//        else $maincontent .= $i ." ";
//        $i++;
//    }
} elseif ($comp){
    include('comment.php');
} 
$maincontent .= "\n</div>";
$layout = str_replace("[[main-content]]", $maincontent, $layout);
echo $layout; 
?>
 
Related Solutions
Keywords: PHP - MYSQL bug - Works in Mozilla …
 
Loading Advertisement...
 
[+][-]11/08/09 04:01 AM, ID: 25770217Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 07:53 AM, ID: 25770803Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 01:08 PM, ID: 25771910Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 01:13 PM, ID: 25771940Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 01:17 PM, ID: 25771964Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 01:48 PM, ID: 25772088Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 01:51 PM, ID: 25772103Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/09 04:35 AM, ID: 25775293Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/09/09 04:52 AM, ID: 25775408Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/09/09 08:19 AM, ID: 25777278Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625