 |
|
|
|
07-01-2004, 03:17 PM
|
readdir help
|
Posts: 101
|
ok basically ive got loads of folders with reviews in, that i want to dispaly like a normal review wesbite, like a, b, c,d. when i use readdir to get the contents of the directory the names of the firles come up. I would like to make it so that the names of reviews come up. Is this possible to do in php or will i need to us a mysql databse. please help!
|
|
|
|
07-01-2004, 03:24 PM
|
|
Posts: 1,693
|
Think you would have to use MySQL
-James 
|
|
|
|
07-01-2004, 03:26 PM
|
|
Posts: 101
|
ok then how coudl i use my sql then any suggestions? im not very gud with it just used it to set up my forums. could i set it so that it just contained the title and web address?
how would i fill a table with it? and also how could i set it so it added the information to the databse from a form that also creates the page of the review?
if it is possible to give the title in php it would be much eaiser for me but i guess its not!
|
|
|
|
07-02-2004, 08:14 AM
|
|
Posts: 175
Location: Wiltshire, England
|
Hi there,
This is quite a huge "ask" with no simple or straightforward answer if you are not familiar with MySQL.
It would be helpful if you could post what type of review site this is, ie movie reviews, product reviews etc and also what headings and sub-headings each review is likely to have.
The chance to view one of the pages you have already produced would also be good. Once we have that, we will have a better idea of what is actually required of the database and the website.
The creation of simple database tables is straightforward enough, as is accessing the data contained within them, providing there is not a complex relationship between various data strings.
Let us see something and I'm sure we can help a little more.
Regards
Ian.
|
|
|
|
07-02-2004, 12:54 PM
|
here you go
|
Posts: 101
|
First off this is a site for game reivews and preivews alike.
Ok then well i can give you several pages.
First off here is the form that is required to generate the page. this form is for generating reviews, where the game title beings with A. enter all the details and hit enter and it will show you the generated form.
http://www.scottsgameroom.co.uk/reviews/a/form.html
Next here is what a completed review looks like:
please note this is an earlier edition so is missing 3 screen shots at the bottom. hopefully this isnt an issue!
http://www.scottsgameroom.co.uk/test...to%20test.html
Hopefully this will help you and you wil be able to help me generate this.
Thanks a lot for you help in advance!
|
|
|
|
07-02-2004, 01:05 PM
|
|
Posts: 1,693
|
You could set it so all the information is stored in the database and you only need one php file...
So E.g.
You could type.. http://yoursite.com/review.php?id=Gta3
Therefore you can change the ID (Which would be the game name) and then the whole content will be pulled from the database..
If you want some help with this just ask
-James 
|
|
|
|
07-02-2004, 01:25 PM
|
|
Posts: 101
|
alright well if possible i would like alot of help with this, i havent really used much php before or mysql...i just really used the baics of php to create this. so if you culd give me a step by step i would be really grateful! also will i be able to pull stuff down from the database into a table that showed say all review begginning with A? and then give the links to the appropriate page?
Last edited by scottsgameroom; 07-02-2004 at 01:29 PM..
|
|
|
|
07-02-2004, 03:42 PM
|
|
Posts: 1,693
|
Ill have a go at it and post some step by step instructions later
-James 
|
|
|
|
07-02-2004, 04:14 PM
|
|
Posts: 1,693
|
STEP 1 - Creating the Tables
In PHPMyAdin... Goto the main screen where you will see a list of tabels (IF you have any)..Now at the Top click 'SQL'
Insert the following into the query box..
Code:
CREATE TABLE `reviews` (
`id` varchar(20) NOT NULL default '',
`writer` varchar(30) NOT NULL default '',
`date` varchar(20) NOT NULL default '',
`title` varchar(30) NOT NULL default '',
`publisher` varchar(30) NOT NULL default '',
`developer` varchar(30) NOT NULL default '',
`release` varchar(30) NOT NULL default '',
`box_shot` varchar(100) NOT NULL default '',
`review1` text NOT NULL,
`review2` text NOT NULL,
`quote` text NOT NULL,
`gameplay` tinyint(4) NOT NULL default '0',
`graphics` tinyint(4) NOT NULL default '0',
`sound` tinyint(4) NOT NULL default '0',
`value` tinyint(4) NOT NULL default '0',
`overall` tinyint(4) NOT NULL default '0',
`summary` text NOT NULL,
`small1` varchar(100) NOT NULL default '',
`small2` varchar(100) NOT NULL default '',
`small3` varchar(100) NOT NULL default '',
`small4` varchar(100) NOT NULL default '',
`small5` varchar(100) NOT NULL default '',
`small6` varchar(100) NOT NULL default '',
`big1` varchar(100) NOT NULL default '',
`big2` varchar(100) NOT NULL default '',
`big3` varchar(100) NOT NULL default '',
`big4` varchar(100) NOT NULL default '',
`big5` varchar(100) NOT NULL default '',
`big6` varchar(100) NOT NULL default ''
) TYPE=MyISAM;
Press GO and this will create your tables..
Step 2 - Connection Script db_connect.php
Open Notepad...and paste...
PHP Code:
<?php
$host ="localhost";
$mysql_user ="username";
$mysql_pass ="password";
$database_name ="Database Name";
$connection=mysql_connect($host,$mysql_user,$mysql_pass);
$db=mysql_select_db($database_name,$connection);
?>
You then need to add your username, password and database name..If you dont know these ask your host who should tell you
Save this file as db_connect.php
Step 3 - The form..
This is the coding for uploading the form.. You can change the layout..But do NOT rename the fields otherwise it will mess it all up
HTML Code:
<html>
<head>
<title>Review Form</title>
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<form name="form" method="post" action="savereview.php">
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Review ID<font size="2">
(The ID http://yoursite.com/review.php?id=</font><font size="2"><b>xxxxx</b></font><font
size="2">)</font></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><input type="text"
name="id"></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Writer Name</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><input type="text"
name="writer"></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Date <font size="2">(Todays
Date)</font></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><input type="text"
name="date"></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Game Name</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><input type="text"
name="title"></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Publisher</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><input type="text"
name="publisher"></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Developer</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><input type="text"
name="developer"></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Release</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><input type="text"
name="release"></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Box Shot</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><input type="text"
name="box_shot"></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Review Part 1</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><textarea name="review1"
rows="8" cols="67"></textarea></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Review Part 2</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><textarea name="review2"
rows="8" cols="67"></textarea></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Quote</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><input type="text"
name="quote" size="65"></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Gameplay</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><input type="text"
name="gameplay" size="10">%</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Graphics</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><input type="text"
name="graphics" size="10">%</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Sound</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><input type="text"
name="sound" size="10">%</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Value</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><input type="text"
name="value" size="10">%</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Overall</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><input type="text"
name="overall" size="10">%</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Summary</p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><textarea name="summary"
rows="4" cols="67"></textarea></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Picture 1 Small:
<input type="text" name="small1"> Big:<input type="text" name="big1"></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Picture 2 Small:
<input type="text" name="small2"> Big:<input type="text" name="big2"></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Picture 3 Small:
<input type="text" name="small3"> Big:<input type="text" name="big3"></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Picture 4 Small:
<input type="text" name="small4"> Big:<input type="text" name="big4"></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Picture 5 Small:
<input type="text" name="small5"> Big:<input type="text" name="big5"></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;">Picture 6 Small:
<input type="text" name="small6"> Big:<input type="text" name="big6"></p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"> </p>
<p style="line-height:100%; margin-top:0; margin-bottom:0;"><input type="submit"
value="Save"></p></form>
</body>
</html>
Save this as a HTML file
You will need to use this form instead of the one you already created
When you have done that tell me and i'll post more
-James 
Last edited by Dark-Skys99; 07-02-2004 at 06:26 PM..
|
|
|
|
07-04-2004, 02:22 PM
|
|
Posts: 101
|
ok cheers for that. I have done all of this. waiting for your next steps. if you dont reply today then i will be away till friday so if you could possibly reply today i would be greatful!
|
|
|
|
07-04-2004, 04:02 PM
|
|
Posts: 1,693
|
I will start on it..But i doubt i will get much done..
I have IT coursework to finish..so need to do that
I quess you want the design of the review page be like the one at..
http://www.scottsgameroom.co.uk/test...to%20test.html ??
-James 
|
|
|
|
07-09-2004, 01:26 PM
|
|
Posts: 101
|
yes i would like to have the layout like that if at all possible!
Just got back from geogrpahy field trip, looking forward to hearding from you!
|
|
|
|
07-09-2004, 01:31 PM
|
|
Posts: 1,693
|
Quote:
|
Originally Posted by scottsgameroom
yes i would like to have the layout like that if at all possible!
Just got back from geogrpahy field trip, looking forward to hearding from you!
|
I'll work on it tonight...I would have done it sooner but been so busy
Funny..Im going on a Geography Field trip next week
-James 
|
|
|
|
07-09-2004, 01:37 PM
|
|
Posts: 101
|
o right, kewl.
cheers man!
yea the geogrpahy trip was pretty [PROFANITY DELETED] actualy!
they make you do work till like 9 at night!
where u going?
Last edited by Kyrnt; 07-10-2004 at 11:34 AM..
Reason: Remove Profanity
|
|
|
|
07-09-2004, 02:54 PM
|
|
Posts: 1,693
|
Going Shrewsbury..
Probally gonna be quite crap...
Gotta work till 8 and got to be in bed @ 11
-James 
|
|
|
|
07-09-2004, 06:18 PM
|
|
Posts: 1,693
|
Step 5 - Upload the form to the database
Save this file as savereview.php
PHP Code:
<?php
include 'db_connect.php';
$sql = mysql_query("INSERT INTO reviews (id, writer, date, title, publisher, developer, release, box_shot,
review1, review2, quote, gameplay, graphics, sound, value, overall, summary, small1, small2, small3, small4,
small5, small6, big1, big2, big3, big4, big5, big6)
VALUES('$id', '$writer', '$date', '$title', '$publisher', '$developer', '$release', '$box_shot', '$review1',
'$review2', '$quote', '$gameplay', '$graphics', '$sound', '$value', '$overall', '$summary', '$small1', '$small2',
'$small3', '$small4', '$small5', '$small6', '$big1', '$big2', '$big3', '$big4', '$big5', '$big6')") or die (
mysql_error());
echo "<title>Review Added</title>";
echo "Review Created";
?>
It doesn't need changing at all..
This should work...Hopefully..Couldn't test it cause my MySQL aint working...So if you have any problems just ask
I'll post some more later
-James 
|
|
|
|
07-09-2004, 06:38 PM
|
|
Posts: 101
|
any luck as off yet?
|
|
|
|
07-09-2004, 07:02 PM
|
|
Posts: 1,693
|
Step 6 - Review.php
Save the following as review.php
PHP Code:
<?php
include 'db_connect.php';
if(!isset($_GET['id']))
header('Location: http://yoursite.com/errorpage.htm'); //Change this to your error page so if the user doesnt type an id
$id = $_GET['id'];
$sql = "SELECT * FROM reviews WHERE id='$id'";
$result = mysql_query($sql);
$results = mysql_fetch_array($result);
$writer = $results["writer"];
$date = $results["date"];
$title = $results["title"];
$publisher = $results["publisher"];
$developer = $results["developer"];
$release = $results["release"];
$box_shot = $results["box_shot"];
$review1 = $results["review1"];
$review2 = $results["review1"];
$quote = $results["quote"];
$gameplay = $results["gameplay"];
$graphics = $results["graphics"];
$sound = $results["sound"];
$value = $results["value"];
$overall = $results["overall"];
$summary = $results["summary"];
$small1 = $results["small1"];
$small2 = $results["small2"];
$small3 = $results["small3"];
$small4 = $results["small4"];
$small5 = $results["small5"];
$small6 = $results["small6"];
$big1 = $results["big1"];
$big2 = $results["big2"];
$big3 = $results["big3"];
$big4 = $results["big4"];
$big5 = $results["big5"];
$big6 = $results["big6"];
echo "
<html>
<head>
<title>Scotts Game Room Portal - Reviews - $title</title>
<style><!--a:hover{color:yellow; text-decoration:none; }--></style>
<style>a{text-decoration:none} </style>
</head>
<body bgcolor=white text=black topmargin=0 leftmargin=0 link=white alink=white vlink=white>
<center>
<P>
<table width=575 cellspacing=0 cellpadding=0 border=1 bordercolor=1>
<tr><td><font face=arial size=4><b>$title</b></tr></td>
</table>
<table width=575 cellspacing=0 cellpadding=0 border=1 bordercolor=1>
<tr><td width=400>
<table width=100% height=800 cellspacing=0 cellpadding=0>
<tr valign=top><td valign=top><font face=arial size=2>
$review1
<P><font size=4><center><B><I>'$quote'</b></i></center><font size=2>
<P>$review2
</td></tr>
</table>
</td>
<td width=170>
<table width=100% height=800 cellspacing=0 cellpadding=0 bgcolor=041A6E>
<tr valign=top><td><font face=arial size=1 color=cccccc>
Writer: $writer
<br>Date: $date
<br><center><img src='box_shot' border=1></center>
<br>Title: $title
<br>Publisher: $publisher
<br>Developer: $developer
<br>Release: $release
<P><font size=2><u><B><I>Verdict</I></B></u><font size=1>
<br>Gameplay:
<br><table width=100% cellspacing=0 cellpadding=0 border=1 bordercolor=black>
<tr><td>
<table width=$gameplay% cellspacing=0 cellpadding=0 bgcolor=red><tr><td><center><font face=arial size=1>$gameplay%</center></td></tr>
</table></td></tr></table>
Graphics:
<br><table width=100% cellspacing=0 cellpadding=0 border=1 bordercolor=black>
<tr><td>
<table width=$graphics% cellspacing=0 cellpadding=0 bgcolor=red><tr><td><center><font face=arial size=1>$graphics%</center></td></tr>
</table></td></tr></table>
Sounds:
<br><table width=100% cellspacing=0 cellpadding=0 border=1 bordercolor=black>
<tr><td>
<table width=$sound% cellspacing=0 cellpadding=0 bgcolor=red><tr><td><center><font face=arial size=1>$sound%</center></td></tr>
</table></td></tr></table>
Value:
<br><table width=100% cellspacing=0 cellpadding=0 border=1 bordercolor=black>
<tr><td>
<table width=$value% cellspacing=0 cellpadding=0 bgcolor=red><tr><td><center><font face=arial size=1>$value%</center></td></tr>
</table></td></tr></table>
<br><font size=2><b><i>Overall:</b></i><font size=1>
<br><table width=100% cellspacing=0 cellpadding=0 border=1 bordercolor=black>
<tr><td>
<table width=$overall% cellspacing=0 cellpadding=0 bgcolor=red><tr><td><center><font face=arial size=1><font size=2>$overall%</center></td></tr>
</table></td></tr></table>
<P>Summary:
<br><b><i>'$summary'</b></i>
<P>Screenshots:
<center>
<br><a href='$big1' target='screens'><img src='$small1' width=100 hieght=75 border=0></a>
<br>
<br><a href='$big2' target='screens'><img src='$small2' width=100 height=75 border=0></a>
<br>
<br><a href='$big3' target='screens'><img src='$small3' width=100 height=75 border=0></a>
<br>
<br><a href='#screens'>See All Screen Shots</a>
</td></tr>
</table>
</td></tr>
</table>
<P><a name='screens'></a>
<table width=500 height=350 cellspacing=0 cellpadding=0 border=1 bordercolor=black>
<tr><td><iframe src='' name='screens' width='500' height='350' frameborder='0' scrolling=no MARGINWIDTH='0' MARGINHEIGHT='0'></iframe></td></tr>
</table>
<P>
<table cellspacing=0 cellpadding=0 border=1 bordercolor=black>
<tr><td><a href='$big1' target='screens'><img src='$small1'></a></td>
<td><a href='$big2' target='screens'><img src='$small2'></a></td>
<td><a href='$big3' target='screens'><img src='$small3'></a></td>
<td><a href='$big4' target='screens'><img src='$small4'></a></td>
<td><a href='$big5' target='screens'><img src='$small5'></a></td>
<td><a href='$big6' target='screens'><img src='$small6'></a></td></tr>
</table>
";
?>
All you need to change is the address for the error page...
Tested it and it works fine
Thats it  ..But i was thinking do you want the page to add the review changed so that it can only be accessed by you by setting a username and password ??
-James 
Last edited by Dark-Skys99; 07-09-2004 at 08:21 PM..
|
|
|
|
07-12-2004, 11:49 AM
|
|
Posts: 101
|
could you now give me the code for a page that would display say all reviews beginning with a as links?
then b etc so that i could change it round?
|
|
|
|
07-14-2004, 12:35 PM
|
|
Posts: 1,693
|
Just got back off geog trip..
Now got IT coursework to do..
But i'll work on it tommorrow
-James 
|
|
|
|
|
« Reply to readdir help
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|