FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


news system with login for more than 1 user.





ranzon
Hi

i wonder how i can make a newsscript and a login script in php and mysql.
i have tryed it before but i can't make to finish it. ill just find something else to make instead, then i don't make the news\login system.
are there a system for this, wich i can configure manualy, in design?
and easy to install, and easy to modify stuf in the design off including pages and more.
it just have to bee easy.
xorcist
You can use cutenews you can add more users to post on it and it is easy to configurate. Go to http://cutephp.com/cutenews/ and scroll it download it.
ranzon
xorcist wrote:
You can use cutenews you can add more users to post on it and it is easy to configurate. Go to http://cutephp.com/cutenews/ and scroll it download it.


and it's easy to hack...
thats why i want mysql.. mysql is a lot harder to hack, than flatfiles..

i have now camed up with an code, witch i put in the file: hentdata.php

Code:
<?
$username="news";
$password="password";
$database="news";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM news";
$result=mysql_query($query);

$num = mysql_numrows($result);

mysql_close();

echo "<b><center>Nyheter</center></b><br><br>";

$i=0;
while ($i < $num) {

$navn=mysql_result($result,$i,"navn");
$emne=mysql_result($result,$i,"emne");
$nyhet=mysql_result($result,$i,"nyhet");

echo "
<b>The news is writed by: $navn </b>
<br>
topic: $emne <br>
news:<br>
$nyhet
<br><hr><br>";

$i++;
}

?>


but when i run the code i get: Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /folder/hentdata.php on line 11

and i don't know what it means..
mustaq
try to make rss feed disply news its really good and work well and include with comment for each news which is displayed via rss so user can write comment for the news
yjwong
Does the table "news" even exists in the MySQL database "news"?

From the information provided, I see your database structure:
MySQL Server -> MySQL Database/Schema ("news") -> MySQL Table ("news")

Am I right?

FYI, if your database doesn't exist or the MySQL host could not be connected, all MySQL functions that uses result resources will fail.

By the way, all arguments in mysql_connect should be strings, that means they should be enclosed in quotes.
ranzon
yjwong wrote:
Does the table "news" even exists in the MySQL database "news"?



yes the database exists, i have made a write form wich works, and i can acsess it in phpmyadmin, and see that it exists, and see information in it.

yjwong wrote:

From the information provided, I see your database structure:
MySQL Server -> MySQL Database/Schema ("news") -> MySQL Table ("news")


You are totally right there..

yjwong wrote:


FYI, if your database doesn't exist or the MySQL host could not be connected, all MySQL functions that uses result resources will fail.



you know, that i would het an errormessage if it can't connect database, or find the tables or anything.

yjwong wrote:

By the way, all arguments in mysql_connect should be strings, that means they should be enclosed in quotes.

i don't know what you mean. i'm not the best in world... but I made that script, with a little help from a friend.. but now he, or I don't know how to fix it
BlackSkad
try using mysql_num_rows instead of mysql_numrows. The second one is designed to work with mysql 4.1, which is not available on frihost.
ranzon
BlackSkad wrote:
try using mysql_num_rows instead of mysql_numrows. The second one is designed to work with mysql 4.1, which is not available on frihost.

then it's just turns me the errormessage:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in folder/hentdata.php on line 11
ranzon
ive got it working:
Code:

<?php
$username="news";
$password="password";
$database="news";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM nyheter";
$result=mysql_query($query) or die(mysql_error());
$num = mysql_num_rows($result);
mysql_close();
echo "<b><center>Nyheter</center></b><br><br>";

$i=0;
while ($i < $num) {

$navn=mysql_result($result,$i,"navn");
$emne=mysql_result($result,$i,"emne");
$nyhet=mysql_result($result,$i,"nyhet");
$tid=mysql_result($result,$i,"tid");
$dato=mysql_result($result,$i,"dato");

?>
<center>
<table width="532" border="1">
<tr><td width="522" height="95" valign="top">
<table width="532">
<tr>
<td height="21" colspan="2" valign="top">Topic: <? echo("". $emne ."");?><hr /></td>
</tr>
<tr>
<td height="39" colspan="2" valign="top">News:<br>      <? echo("". $nyhet ."");?><hr /></td>
</tr>
<tr>
<td width="328" height="21" valign="top">This news entry is by: <? echo("". $navn .""); ?></td>
<td width="250" valign="top">Clock: <? echo("". $tid .""); ?> Date: <? echo("". $dato .""); ?></td>
</tr>
</table>
</td>
</tr></table>
  <br /><br />
</center>
<?

$i++;
}

?>


the problem: i just had writed wrong table to get the data from..
but i did not see it.. but anyway: thanks for all help..
Related topics
How To : Secure Your PHP Website
Azkabanweb.tk
Want a news script which doesnt use MySQL?
Coranto - News system
[news].[tecg]Últimas Vulnerabilidades
News system with mySQL database.
Problem installing a news system
[Community Project] Easy Simple Content Management System
Next\previous button on news system
javascript/ajax only to have login/user editor
News system
News script
I need a open source news system .
Session Management - Comments Required
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.