Skip to content

Instantly share code, notes, and snippets.

@ethnt
Created January 1, 2010 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethnt/267144 to your computer and use it in GitHub Desktop.
Save ethnt/267144 to your computer and use it in GitHub Desktop.
<?php
/* Finito
* A social lifestreaming application.
* Revision 0.1.1
*
* system/includes/models.php
*/
# This file prepares all the database interaction for the views (/system/views/.).
// Connect to MySQL
$connect = mysql_connect($host, $user, $pass) or die($error = 'Could not connect to MySQL database.');
$select = mysql_select_db($name) or die($error = 'Could not select MySQL database.');
// Get the updates
$updateQuery = mysql_query("SELECT * FROM updates");
while($updateArray = mysql_fetch_array($updateQuery)){
$updateID = $updateArray['id'];
$updateNetworkID = $updateArray['networkID'];
$updateDate = $updateArray['date'];
$updateContent = $updateArray['content'];
$updatePermalink = $updateArray['permalink'];
}
// Get the networks
$networkQuery = mysql_query("SELECT * FROM networks");
while($networkArray = mysql_fetch_array($networkQuery)){
$networkID = $networkArray['id'];
$networkName = $networkArray['name'];
$networkUser = $networkArray['username'];
$networkFeed = $networkArray['feedURI'];
$networkProfile = $networkArray['profileURI'];
}
/*
This is giving the following error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/finito/system/includes/models.php on line 29
What is the problem here?
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment