Okay, I fixed that problem I think. But created a new one. I was told by someone that "now you just have an object that isnt correctly instantiated on line 7"
Because I got this error
PHP Code:
Fatal error: Call to a member function query() on a non-object in /home/dominic/domains/ohio-host.com/public_html/home/index.php on line 7
Line 1 to 13:
PHP Code:
<?php include './u&ainclude/mainlayout.php';
function displayNews(){ global $database; $q = "SELECT name,subname,date,type,content FROM ".TBL_NEWS." ORDER BY date DESC,date"; $result = $database->query($q); /* Error occurred, return given name by default */ $num_rows = mysql_query($result); if(!$result || ($num_rows < 0)){ echo "Error displaying info"; return; }
What it means is that somewhere in your code before that function gets called you need to have a line that looks something like...
$database = new DatabaseClassName('param1', 'param2', 'etc');
The database class name would be whatever class is your database class, and the parameters may or may not be required. Basically you are not initializing/instantiating the $database variable before calling that function.
// Check to see if we have been sent from update.php // If so, alert that an update was successful if(isset($_GET['message'])){ echo "<p><font color='red'>Wijzigingen opgeslagen</font></p>"; }
require("connection.php"); // Load in the content of the current viewing page from the MySQL database $page = (isset($_GET['page'])) ? $_GET['page'] : "1"; $sql = "SELECT id, content FROM pages WHERE id='$page'"; $result = $conn->query($sql) or die(mysqli_error()); if($result){ $row = $result->fetch_object(); echo '<form method="post" action="update.php">'; echo '<input type"hidden" name="id" value="' . $row->id . '" />'; echo '<textarea name="content" cols="70" rows="20">'; echo $row->content; echo '</textarea>'; echo '<input type="submit" name="editContent" value="Opslaan" />'; echo '</form>'; }
?> </div><!--editor--> <div id="webpag"> <ul> <?php // Display all the pages that we can edit $sql = "SELECT id, name FROM nav"; $result = $conn->query($sql) or die(mysqli_error()); if($result){ while($row = $result->fetch_object()){ echo "<li><a href='webpag_updaten.php?page={$row->id}'>{$row->name}</a></li>"; } } ?>
« Reply to Fatal error: Call to a member function addActiveGuest() on a non-object in