Thread: shared thinking
View Single Post
Old 11-17-2004, 12:36 PM   #10 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,532
sde is on a distinguished road
if you have time to figure out and write a flat file news article application .. then you have time to learn how to use php with mysql.

PHP Code:
function addarticle($title,$article,$time){
  
$result mysql_query("insert into article (title,article,time) values('$title','$article','$time')");
}

function 
editarticle($articleid,$title,$article){
  
$result mysql_query("update article set title='$title',article='$article' where articleid=$articleid");
}

function 
deletearticle($articleid){
  
$result mysql_query("delete from article where articleid=$articleid");
}

function 
printarticles($howmany){
  
$result mysql_query("select * from article order by time desc limit $howmany");
  while(
$row mysql_fetch_array($result)){
    echo 
"<b>".$row['title']."</b> ".$row['time']." <br>".$row['article']."<br><br>n";
  }

using file i/o functions, these functions would be much bigger, and you would have much less control over selecting and updating data.

just my $.02
__________________
Mike
sde is offline   Reply With Quote