Hello i am getting a error of Class MySQLDB not found on few php validators. The exact line is $myDB = new MySQLDB(); $nav = 1; and also some undefined index error is showing before some lines of this error. the exact line of that is <?php if($_GET['catg'] != '') i.e is very first line of code. I am giving code for ready reference. I have tried and given up. Waiting for reply for the error from some good heart and brain member of this site. <?php if($_GET['catg'] != '') { //if($_GET['grou'] != 'pers' || (isset($_GET['app']) && $_GET['app'] == 1)){ $myDB = new MySQLDB(); // echo 'In category'; $sql = "SELECT scateno, cateno, scatename FROM hl_subcategory WHERE cateno = (SELECT cateno FROM hl_category WHERE catename = '".resetEscapeChar($_GET['catg'])."')"; //$tarr = array(); $tcount = 0; $cateno = 0; $scateno = 0; //echo $sql."<br>"; if(isset($_GET['country'])) $country = $_GET['country']; else $country = ''; $result = $myDB->executeSQL($sql) or die("could not execute stored proc <br>".mysql_error()); while ($result_row = mysql_fetch_array($result, MYSQL_ASSOC)){ //$tarr[$tcount++] = '<a class="link" href="subcategory.php?sub='.$result_row['scatename'].'&catg='.$_GET['catg'].'&country='.$country.'&city='.$_GET['city'].'&grou='.$_GET['grou'].'">'.$result_row['scatename'].'(#)</a><br><br>'; $cateno = $result_row['cateno']; //echo $result_row['scatename'] ." ".strcmp($result_row['scatename'],resetEscapeChar($_GET['sub']))." ".resetEscapeChar($_GET['sub'])."<br/>"; if(strcmp(trim($result_row['scatename']),trim(resetEscapeChar($_GET['sub'])))==0) { $scateno = $result_row['scateno']; } // break; } mysql_free_result($result) or die("could not close result set <br>".mysql_error()); $myDB->close(); $temstr = ''; $countryname = 'World'; $myDB = new MySQLDB(); $nav = 2; $sql = "SELECT artidesc FROM hl_articles"; if($_GET['country'] != ''){ $countryname = $_GET['country']; if($_GET['city'] != '') $countryname = $_GET['city']; $nav = 2; } $sql .= " WHERE groupid = ".$gid." AND cateno = ".$cateno." AND scateno = ".$scateno." AND navigation = ".$nav; //echo $sql; $result = $myDB->executeSQL($sql) or die("could not execute stored proc <br>".mysql_error()); while ($result_row = mysql_fetch_array($result, MYSQL_ASSOC)){ $temstr = str_replace("|", $countryname, $result_row['artidesc']); } mysql_free_result($result) or die("could not close result set <br>".mysql_error()); $myDB->close(); echo "<div class='message'>".$temstr."</div>"; } else { $myDB = new MySQLDB(); $nav = 1; if($_GET['country'] != '') $countryname = $_GET['country']; $sql = "SELECT artidesc FROM hl_articles WHERE navigation = ".$nav; $result = $myDB->executeSQL($sql) or die("could not execute stored proc <br>".mysql_error()); while ($result_row = mysql_fetch_array($result, MYSQL_ASSOC)) { $temstr = str_replace("|",$countryname,$result_row['artidesc']); } //echo $sql; echo "<div class='message'>".$temstr."</div>"; mysql_free_result($result) or die("could not close result set <br>".mysql_error()); $myDB->close(); } ?>
Thank you. you said it right and my doubt is where exactly should i include the file and also shall i include it through href .
include it right at the top using php <?php require_once('MySQLDB.php') //or where the file resides ?>
Thankyou for your help and it has worked the most but Now after implementing what you said, now the error is gone but now it is showing as Can't connect to MySQL server on 'hindlist.db.********.hostedresource.com' (nnnnn) in E:\db.php on line 10. Why is it coming this way now after solving the error. Any more ideas pls
Is this your db server? are trying to connect to a remote db server? check your database connection config.