What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » php/mysql review database

Pages: (2): « First [ 1 ] 2 » Last »
php/mysql review database
Author: Message:
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
O.P. Huh?  php/mysql review database
as u may know im making a site that has reviews, previews, screenshots and other stuff to do with games (including a forum)
problem is i dont know php ot mysql :P
so i need somebody to help me code it or give me places with code examples/tutorials
anyone?
08-07-2004 02:30 PM
Profile PM Find Quote Report
Concord Dawn
Veteran Member
*****

Avatar
This is a loopy fruit.

Posts: 1203
Reputation: 16
34 / Male / –
Joined: Feb 2004
RE: php/mysql review database
or try W3schools.com.
[Image: 7.png]
08-07-2004 03:40 PM
Profile E-Mail PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
O.P. RE: php/mysql review database
well i learnt how 2 upload files (quite easy) but now i need to know how 2 limit the file type using php if this is possible
08-08-2004 09:00 AM
Profile PM Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: php/mysql review database
quote:
Originally posted by leejeffery
well i learnt how 2 upload files (quite easy) but now i need to know how 2 limit the file type using php if this is possible
I assume you want to limit files based on their extensions? Here's some simple example code...

code:
<?php

$filename = "uploaded.txt";

$extension = substr(strrchr($filename, "."), 1);

if($extension == "php" || $extension == "php3") {
    die("That file type is banned!");
}

?>

Or if you want to allow only certain types...

code:
if($extension != "jpg" && $extension != "gif") {
    die("Only .jpg and .gif files are allowed!");
}

Of course, the $filename line has to be removed, and then on the line below that, you need to replace $filename with whatever variable your script uses.
08-08-2004 09:17 AM
Profile PM Web Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
O.P. RE: php/mysql review database
thanx WDZ ;)
just what i needed
but im also lookin for a way to not have 2 upload a file to the same database but to have input boxes like game name, reviewer name, review, rating etc. on a page and a button that says submit which adds all the info in the text boxes to a new row in the db
is this possibe?
08-08-2004 09:39 AM
Profile PM Find Quote Report
musicalmidget
Elite Member
*****

Avatar
Hmm, randomness...

Posts: 1663
Reputation: 12
37 / Male / Flag
Joined: Dec 2002
RE: php/mysql review database
Yes, this is possible, but you would need to write the input form in HTML.

What are your HTML skills like?
08-08-2004 10:39 AM
Profile E-Mail PM Web Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
O.P. RE: php/mysql review database
quote:
Originally posted by musicalmidget
What are your HTML skills like?
basic
i didnt think i really needed to learn b4 because i use dreamwever
08-08-2004 12:20 PM
Profile PM Find Quote Report
bach_m
Veteran Member
*****

Avatar
4837 :P

Posts: 2863
Reputation: 7
37 / Male / –
Joined: Feb 2003
RE: php/mysql review database
quote:
Originally posted by leejeffery
do i need to learn html or can i do it in dreamweaver?
well, it depends on what you are doing. HTML and CSS skills are very important tools. otherrwise, your code can be filled with wiered empty cells and ones with just spaces in them if you use the dreamweaver "Design" tab to deal with the layout and everything.

I use Dreamweaver at work and at home, but mostly in the coding section, as it provides useful tools like the CSS refernece and the little popup menus etc. But to make the whole site in the design section will make it very confusing code (i know from experience).

That being said, XHTML isn't very hard. its baisically HTML with a few tweaks so ur code doesn't look like a 2 year olds. and CSs is rather simple. C|Net has some great info on CSS here(for a list), and specifically here, here, here,
here. here, and here. i used all of those, and they provided alot of help.

In a nutshell, (X)HTML and CSS=GOOD, dreamweaver design tab=not horrible
08-08-2004 03:20 PM
Profile E-Mail PM Web Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
O.P. RE: php/mysql review database
here is the code i have but its not actually submitting anything to the database (ive excluded names of db and password for security reasons)
[/code]<?
//initilize PHP

if($_POST['submit']) //If submit is hit
{
   //then connect as user
   //change user and password to your mySQL name and password
   mysql_connect("localhost","******_*****","********");

   //select which database you want to edit
   mysql_select_db("******_reviews");

   //convert all the posts to variables:
   $Title = $_POST['Title'];
   $Platform = $_POST['Platform'];
   $Review = $_POST['Review'];
   $Reviewer = $_POST['Reviewer'];
   $Rating = $_POST['Rating'];
   $Date = $_POST['Date'];
   
   //Insert the values into the correct database with the right fields
   //mysql table = database
   //table columns = Title, Platform, Review, Reviewer, Rating, Date
   //post variables = $Title, $Platform, '$Review, $Reviewer, $Rating, $Date
   $result=MYSQL_QUERY("INSERT INTO database (Title,Platform,Review,Reviewer,Rating,Date)".
      "VALUES ('$Title', '$Platform', '$Review', '$Reviewer', '$Rating', '$date')");

    //confirm
   echo "Review uploaded succesfully!";
}

else
{
// close php so we can put in our code
?><title>GameSmart - Write your own game reviews!!</title>
<style type="text/css">
<!--
.style1 {color: #666666}
-->
</style>

<form action="uploadreview.php" method="post" class="style1">
<TABLE>
<TR>
   <TD align="center" valign="top">Title:</TD>
   <TD><INPUT TYPE='TEXT' NAME='Title' VALUE='' size=60></TD>
</TR>
<TR>
   <TD align="center" valign="top">Platform:</TD>
   <TD>
    <SELECT NAME='Platform'>
    <OPTION VALUE='PS2'>PS2
    <OPTION VALUE='Gamecube'>Gamecube
    <OPTION VALUE='XBOX'>XBOX
    <OPTION VALUE='PC'>PC
    <OPTION VALUE='GBA'>GBA
    </SELECT></TD>
</TR><br>
<TR>
   <TD align="center" valign="top">Review:</TD>
   <TD><textarea name="Review" cols="60" rows="20"></textarea></TD>
</TR>
<TR>
  <TD align="center" valign="top">Rating:</TD>
  <TD><input name='Rating' type='TEXT' size=3 maxlength="2">
    /10</TD>
</TR>
<TR>
  <TD align="center" valign="top">Reviewer:</TD>
  <TD><INPUT NAME='Reviewer' TYPE='TEXT' size=60 maxlength="30"></TD>
</TR>
<TR>
   <TD align="center" valign="top">Date:</TD>
   <TD><INPUT TYPE='text' NAME='Date' VALUE='<? echo date("M.j.y"); ?>' size=60></TD>
</TR>
<TR>
   <TD></TD><br>
   <TD><INPUT TYPE="submit" name="submit" value="submit"></TD>
</TR>
</TABLE>
</form>

<?
} //close the else statement
?>[/code]
can anybody see whats wrong with this code?

This post was edited on 08-08-2004 at 04:07 PM by Eljay.
08-08-2004 04:02 PM
Profile PM Find Quote Report
bach_m
Veteran Member
*****

Avatar
4837 :P

Posts: 2863
Reputation: 7
37 / Male / –
Joined: Feb 2003
RE: php/mysql review database
quote:
Originally posted by leejeffery

$Date
   $result=MYSQL_QUERY("INSERT INTO database (Title,Platform,Review,Reviewer,Rating,Date)".
      "VALUES ('$Title', '$Platform', '$Review', '$Reviewer', '$Rating', '$date')");
variable names are case-sensitive.

what error do u get?
08-08-2004 05:36 PM
Profile E-Mail PM Web Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On