jonka589 Posted August 8, 2010 Share Posted August 8, 2010 Hi, I am a web master/site administrator stuck with a PHP-page I haven't written and I don't know PHP well. I am a proficient java programmer but I haven't done any PHP coding (yet). However, the code has worked before but know it only displays a empty page and I don't know what's wrong. Can you please help me? In the live version of this code, I have checked that the MySQL configuration parameters are correct. Here is the code: <?php class DB { function DB() { if(0) { // database configuration $host = "mysql3...."; $user = "d17...; $pass = "TlH..."; $database = "d1..."; } else { // database configuration $host = "mysql3...."; $user = "d17...; $pass = "TlH..."; $database = "d1..."; } $this->host = $host; $this->db = $database; $this->user = $user; $this->pass = $pass; $this->link = mysql_connect($this->host, $this->user, $this->pass); mysql_select_db($this->db, $this->link) or die("Kunde inte ansluta mot databasen: " . mysql_error()); //register_shutdown_function($this->close); } function query($query) { $result = mysql_query($query, $this->link); return $result; } function close() { mysql_close($this->link); } } function binToHtml($text) { strip_tags($text); $text = nl2br($text); $text_old = array("[b]","[/b]","[i]","[/i]"); $text_new = array("<strong>","</strong>","<em>","</em>"); $text = str_replace($text_old, $text_new, $text); return $text; } function phpToHtml($text,$tag,$data) { $text_new = str_replace($tag, $data, $text); return $text_new; } function column($text) { if( $text_pos = strpos($text, '[c]') ) { $text_new = '<div id="col1"><div id="col1_padding"><p>' . substr( $text, 0, $text_pos ) . '</p></div></div>' . '<div id="col2"><div id="col2_padding"><p>' . substr( $text, $text_pos + 3 ) . '</p></div></div>'; } else { $text_new = '<div id="col1"><div id="col1_padding"><p>' . $text . '</p></div></div>'; } return $text_new; } setlocale(LC_TIME, "sv_SE"); $week_day[1] = "Måndag"; $week_day[2] = "Teisdag"; $week_day[3] = "Onsdag"; $week_day[4] = "Torsdag"; $week_day[5] = "Fredag"; $week_day[6] = "Laudag"; $week_day[7] = "Sundag"; $month[1] = "Januari"; $month[2] = "Fibbavari"; $month[3] = "Mass"; $month[4] = "Ápril"; $month[5] = "Mai"; $month[6] = "Juni"; $month[7] = "Juli"; $month[8] = "Agusti"; $month[9] = "Septembar"; $month[10] = "Åktobar"; $month[11] = "Nåvembar"; $month[12] = "Disembar"; $check = 0; /************ Startar klasser ************/ $DB_index = new DB(); /************ Hämta info om sidan i databasen ************/ $sql_index = "SELECT * FROM kalender WHERE Date=now()"; if($result = $DB_index->query($sql_index)) { if($rad = mysql_fetch_array($result)) { $check = 1; $description = $rad["Description"]; $word = $rad["word"]; $date_view = $week_day[date("N", strtotime($rad["Date"]))] . " " . date("j", strtotime($rad["Date"])) . " " . $month[date("n", strtotime($rad["Date"]))]; } else { } } else { $err = "&err=1"; } ?> <a href="http://www.gutamal.org/allnakku.php" target="_blank"><?if($check) { echo "Dagens ord: ". $word; }?><br/><?echo($date_view);?></a> Kind regards, Jonas Karlsson, Sweden Quote Link to comment https://forums.phpfreaks.com/topic/210160-whats-wrong-here/ Share on other sites More sharing options...
Alex Posted August 8, 2010 Share Posted August 8, 2010 You're missing a " on this line: $user = "d17...; Quote Link to comment https://forums.phpfreaks.com/topic/210160-whats-wrong-here/#findComment-1096755 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.