Jump to content

[SOLVED] lil PHP script...


shyish

Recommended Posts

Well Im making a reviews website with someone.. I'm wondering how to make it easy for someone with no skill in web development to change...

 

The PHP it uses is:

<?php
$host="localhost";
$username="root";
$password="GB%(*Mb9vmdt6SERSGBFSYRTY%^Y######";
$database="vd";

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

$num=mysql_numrows($result);

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

$title=mysql_result($result,$i,"title");
$album=mysql_result($result,$i,"album");
$artist=mysql_result($result,$i,"artist");
$body=mysql_result($result,$i,"body");
$id=mysql_result($result,$i,"id");
$image=mysql_result($result,$i,"image");
$tags=mysql_result($result,$i,"tags");
$bear=mysql_result($result,$i,"bear");
$buzz=mysql_result($result,$i,"buzz");
$public=mysql_result($result,$i,"publicr");
$genre=mysql_result($result,$i,"genre");
$song=mysql_result($result,$i,"song");
$author=mysql_result($result,$i,"author");

?>

 

and then

<?php
$i++;
}
?> 

at the end

 

Now then this is similar to code I use on my website for the news but what I want is for it to do instead on this site is so that where it selects the info in the database to be able to select which row to make it so you don't need to change anything else, just change what row it selects and it will get the right information. The other thing I want is for it not to loop like this script does.

 

Also the other thing is for how I use this to dispaly news - how would I make it display the news in reverse order, currently it displays oldest to newest, not very useful.

Link to comment
https://forums.phpfreaks.com/topic/172418-solved-lil-php-script/
Share on other sites

I'm wondering how to make it easy for someone with no skill in web development to change...

 

What do you mean by that? are you talking about the end-user? or a co-developer?

 

Now then this is similar to code I use on my website for the news but what I want is for it to do instead on this site is so that where it selects the info in the database to be able to select which row to make it so you don't need to change anything else, just change what row it selects and it will get the right information. The other thing I want is for it not to loop like this script does.

 

$row = mysql_fetch_assoc($result);//selects one row

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.