NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page news system

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 08-10-2005, 05:50 AM THREAD STARTER               #1 (permalink)
Munky Designs
Join Date: May 2005
Posts: 996
Albino is a jewel in the roughAlbino is a jewel in the roughAlbino is a jewel in the rough
 



news system


ok, im using this tut (http://localhost/news_system/index.php) to make a news system. I have edited it so i have a php file to make the tables, and they are created fine.

I have also changed the connect settings so it connects to my mysql.

I have mysql 4.1, and php 4.

however, whenever I run the index, i get this error:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Group\Apache2\test\news_system\index.php on line 10

I cant figure out how to fix it.

Can anyone help?
Thanks
Albino is offline  
Old 08-10-2005, 07:18 AM   #2 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
It's not connecting to the database properly or the query is not right. Post your code, please!
mholt is offline  
Old 08-10-2005, 07:33 AM   #3 (permalink)
Pro Coder & Designer
 
aween's Avatar
Join Date: Apr 2005
Location: Netherlands
Posts: 967
aween is just really niceaween is just really niceaween is just really niceaween is just really niceaween is just really niceaween is just really niceaween is just really niceaween is just really nice
 



link XP said, you sure have rights to make an database with full permission ? also edited the config file inside the files.

aswell you checked the documentation. ?
__________________
aween web development
aween is offline  
Old 08-10-2005, 03:35 PM THREAD STARTER               #4 (permalink)
Munky Designs
Join Date: May 2005
Posts: 996
Albino is a jewel in the roughAlbino is a jewel in the roughAlbino is a jewel in the rough
 



ok, bit more info for ya

here is how i make my tables:

Code:
<?php

$dbhost="localhost";
$dbusername="root";
$dbpassword="pass";
$dbname="bombibiza";

$connect = mysql_connect($dbhost, $dbusername, $dbpassword);

mysql_create_db("bombibiza") or die (mysql_error());

mysql_select_db("bombibiza");


$Main = "CREATE TABLE `news` (
  `newsid` int(11) NOT NULL auto_increment;
  `dtime` datetime default NULL;
  `title` varchar(255) default NULL;
  `text1` text;
  `text2` text;
  PRIMARY KEY  (`newsid`)
) TYPE=MyISAM AUTO_INCREMENT=1  "  ;

echo "tables are complete"
?>
obviously I have changed my password.

here is the code for the index, the higlighted line is the one that is having the error.


Code:
<?php
// load the configuration file.
include("config.php");
        //load all news from the database and then OREDER them by newsid
        //you will notice that newlly added news will appeare first.
        //also you can OREDER by (dtime) instaed of (news id)
        $result = mysql_query("SELECT * FROM news ORDER BY newsid DESC",$connect);
        //lets make a loop and get all news from the database
        *****while($myrow = mysql_fetch_row($result))*****
             {//begin of loop
               //now print the results:
               echo "<b>Title: ";
               echo $myrow[2];
               echo "</b><br>On: <i>";
               echo $myrow[1];
               echo "</i><hr align=left width=160>";
               echo $myrow[3];
               // Now print the options to (Read,Edit & Delete the news)
               echo "<br><a href=\"read_more.php?newsid=$myrow[newsid]\">Read More...</a>
                || <a href=\"edit_news.php?newsid=$myrow[newsid]\">Edit</a>
                 || <a href=\"delete_news.php?newsid=$myrow[newsid]\">Delete</a><br><hr>";
             }//end of loop
?>
in the config, all i have is my connection to the database:

Code:
<?php
// Set Mysql Variables
//Change the following
$dbhost="localhost";
$dbusername="root";
$dbpassword="pass";
$dbname="bombibiza";

// Don't touch here anything.
// Connect to Mysql
$connect = mysql_connect($dbhost, $dbusername, $dbpassword);
//Select the correct database.
mysql_select_db($dbname,$connect) or die ("Could not select database");
?>
also, ive realised i posted the wrong link to the tutorial, here is the real link:
????: NamePros.com http://www.namepros.com/programming/114337-news-system.html

http://www.maaking.com/index.php?loadpage=tutorials

cheers if anyone can help me
Albino is offline  
Old 08-10-2005, 03:43 PM   #5 (permalink)
Eating Pie
 
iNod's Avatar
Join Date: Nov 2004
Location: Canada
Posts: 2,272
iNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud of
 


Special Olympics AIDS/HIV Cystic Fibrosis Save The Children Baby Health Cystic Fibrosis
In the create mysql db there shouldn't be a ; there should only be commas..

Fixed:
PHP Code:
$Main "CREATE TABLE `news` (
  `newsid` int(11) NOT NULL auto_increment,
  `dtime` datetime default NULL,
  `title` varchar(255) default NULL,
  `text1` text,
  `text2` text,
  PRIMARY KEY  (`newsid`)
) TYPE=MyISAM AUTO_INCREMENT=1  "  

As well the last entry shouldn't have any ; or ,

This should work. Due to this fact the db may not be created which would cause that error.

Try check phpMyAdmin to see if the db was created.

Regards,
__________________
I feel old.
iNod is offline  
Old 08-10-2005, 03:59 PM THREAD STARTER               #6 (permalink)
Munky Designs
Join Date: May 2005
Posts: 996
Albino is a jewel in the roughAlbino is a jewel in the roughAlbino is a jewel in the rough
 



ooo

good point, didnt notice that!


thanks, i shall try that in a moment
Albino is offline  
Old 08-10-2005, 04:14 PM   #7 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Also, when posting PHP code at all, use [ PHP ], not [ CODE ].
mholt is offline  
Old 08-10-2005, 06:41 PM   #8 (permalink)
Eating Pie
 
iNod's Avatar
Join Date: Nov 2004
Location: Canada
Posts: 2,272
iNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud of
 


Special Olympics AIDS/HIV Cystic Fibrosis Save The Children Baby Health Cystic Fibrosis
As well I like the fact you used comments in your coding.. This is a great thing which many programs leave out. It allows you to easly scan through to fix bugs, errors without any real trouble.

If you have any problems please post them one fo the talented programmers here will help you very fast.

iNod
__________________
I feel old.
iNod is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
WHMCompleteSolution Client Management, Billing & Support System for cPanel & WHM Host thewishbone For Sale / Advertising Board 0 08-08-2005 11:10 AM
Domain Name System in Need of Upgrade Cheapquality Industry News 0 04-06-2005 05:38 PM
News Manager System Needing Coded! norbx Programming 5 04-05-2005 04:11 PM
News Manager System Needing Coded! norbx Website Development 0 04-05-2005 11:29 AM
Over 100 News & Media Domains ON SALE - Info Biz US Duke Domains For Sale - Make Offer 0 04-26-2004 01:58 PM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 07:22 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger