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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.