Jump to content

Help with a Review script i made!


lancey10

Recommended Posts

Ok so i made a a script with 2 files, db.php, and index.php...... here is my script:

db.php:
[code]<?php
// Database variables
$host = 'db304.perfora.net';
$user = 'dbo154983898';
$pass = 'Q439a.gw';
$dbname = 'db1549838989';

// Connect to Mysql Database
$mysql = mysql_connect($host,$user,$pass);
$db = mysql_select_db($dbname,$mysql);

//grab rveiews vars
function reviews($reviews) {
    
    $get_reviews = mysql_fetch_array(mysql_query("select * from reviews"));
    $reviews = $get_reviews[$reviews];
    return $reviews;
}
?>[/code]


index.php:
[code]<?php
include("db.php");

access();

echo ('<h4>Submit a Review</h4>');


if($_POST['options']){
    

    $title  = $_POST['title'];
    $posted = $_POST['posted'];
    $story = $_POST['story'];
    $picturepath = $_POST['picturepath'];
    $quality = $_POST['quality'];
    $effect = $_POST['effect'];
    $overall = $_POST['overall'];

    
    $options = "UPDATE reviews SET title='$title',posted='$posted',story='$story',picturepath='$picturepath',quality='$quality',effect='$effect',overall='$overall'";
    $update_options = mysql_query($options);
    
        echo("Reviews Submited.<br /><br />");
    
}

    
    
$config = mysql_fetch_array(mysql_query("select * from reviews"));
    $title  = $config['title'];
    $posted = $config['posted'];
    $story = $config['story'];
    $picturepath = $config['picturepath'];
    $quality = $config['quality'];
    $effect = $config['effect'];
    $overall = $config['overall'];;

            
?>
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">

<table cellspacing="1" cellpadding="4" border="0" bgcolor="#f2f2f2">

<tr>
  <td width="95">Title: </td><td width="352" style="border-right: 10px solid <? echo $bg1; ?>;"><input type="text" name="bg1" value="<? echo $title; ?>" size="20" /></td></tr>
<tr>
  <td>Posted By : </td><td style="border-right: 10px solid <? echo $bg2; ?>;"><input type="text" name="bg2" value="<? echo $posted; ?>" size="20" /></td></tr>
<tr>
  <td valign="top">Story: </td><td style="border-right: 10px solid <? echo $text; ?>;"><textarea name="text" cols="50" rows="8"><? echo $story; ?></textarea></td></tr>
<tr>
  <td>Picture Url: </td><td><input type="text" name="size" value="<? echo $picturepath; ?>" size="20" /></td></tr>
<tr>
  <td>&nbsp;</td>
  <td><b>Ratings:</b></td>
</tr>
<tr>
  <td>Picture Quality: </td>
  <td><label>
    <select name="select">
      <option value="<? echo $quality; ?>">1</option>
      <option value="<? echo $quality; ?>">2</option>
      <option value="<? echo $quality; ?>">3</option>
      <option value="<? echo $quality; ?>">4</option>
      <option value="<? echo $quality; ?>">5</option>
    </select>
  </label></td>
</tr>
<tr>
  <td>Effects:</td>
  <td><select name="select2">
    <option value="<? echo $effect; ?>">1</option>
    <option value="<? echo $effect; ?>">2</option>
    <option value="<? echo $effect; ?>">3</option>
    <option value="<? echo $effect; ?>">4</option>
    <option value="<? echo $effect; ?>">5</option>
    </select></td>
</tr>
<tr>
  <td>Overall:</td>
  <td><select name="select3">
    <option value="<? echo $overall; ?>">1</option>
    <option value="<? echo $overall; ?>">2</option>
    <option value="<? echo $overall; ?>">3</option>
    <option value="<? echo $overall; ?>">4</option>
    <option value="<? echo $overall; ?>">5</option>
    </select></td>
</tr>
</table>
<br /><br />







<input type="submit" name="options" value="Submit" />
</form>[/code]


now everytime i clciiksubmit, it isnt updating the mysql database, how do i go by fixing that? is there a problem wuith my code?
Link to comment
https://forums.phpfreaks.com/topic/3496-help-with-a-review-script-i-made/
Share on other sites

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.