
June 19th, 2003, 09:39 PM
|
|
Contributing User
|
|
Join Date: Apr 2003
Posts: 187
Time spent in forums: < 1 sec
Reputation Power: 6
|
|
|
i solved it... somehow
well i decided to just comment out the connection code... and that seemed to work... but this page doesn't require info to be sent to the db, just retrieved.
Then I realized that I was having a similar problem with a page that requires a database connection in order to send info to it. With the conenction info, it will give me the error message like before. Without the connection info, the page loads and seems to work fine, but no data is put into the db. It is treated jsut as the page from before, as an include. Here is the code for that page, and the page before it. There are actually a lot of pages before these,
thanks so much!
PHP Code:
//page that is malfunctioning
<?php
ob_start();
require_once('Connections/movies.php'); ?>
<?php
mysql_select_db($database_movies, $movies);
$query_Recordset1 = "SELECT * FROM movieinfo, moviepics, poll";
$Recordset1 = mysql_query($query_Recordset1, $movies) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
if($_COOKIE['auth'] < 5)
{
echo 'Sorry, you do not have the Administrative capabilities required to perfrom this function.';
echo 'This may be due to restrictions on your account, or that you have not <a href="index.php?page=login">Logged In</a>.<br>';
echo '<a href="index.php">Home</a> || ';
echo '<a href="index.php?page=register">Join</a>';
exit;
}
if (isset($_COOKIE['auth']))
{ if($_COOKIE['auth'] < 5)
{
echo 'Sorry, you do not have the Administrative capabilities required to perfrom this function.';
echo 'This may be due to restrictions on your account, or that you have not <a href="index.php?page=login">Logged In</a>.<br>';
echo '<a href="index.php">Home</a> || ';
echo '<a href="index.php?page=register">Join</a>';
} else {
if($_POST['what'] == 'process')
{
$strQuery = "INSERT INTO movieinfo (";
$strQuery .= "`movieName`, `moviePicName`, `director`, `starring`, `runningTime`, `format`, `released`, `rating`, `officialSite`, `reviewtext`, `reviewRating`) VALUES (";
$strQuery .= "'{$_POST['strMovieTitle']}', '{$POST_['strMoviePicName']}', '{$_POST['strDirector']}', '{$_POST['strStarring']}', '{$_POST['strRunningTime']}', '{$_POST['strFormat']}', '{$_POST['strReleased']}', '{$_POST['strRating']}', '{$_POST['strOfficialSite']}', '{$_POST['strReviewText']}', '{$_POST['strReviewRating']}')";
mysql_query($strQuery);
?>
<tr><td width='100%' bgcolor='#66B4F4'>Review Added</td></tr>
<tr><td>You have successfully added your review into the Database
<a href="index.php">Continue</a></td></tr>
<?php
} else {
?>
<span class="title"><tr><td width='100%' bgcolor='#66B4F4'>Add Movie Review</td></tr></span>
<table width="97%" border="0">
<!--<a href="index.php?page=getfiles">*Upload a Picture*</a> -->
<form action="index.php?page=addmovie" method="post">
<input type="hidden" name="what" value="process">
<tr>
<td width="45%"><strong>Movie Title</strong></td>
<td width="55%"><input name="strMovieTitle" type="text" value=""></td>
</tr>
<tr>
<td width="45%"><strong>Movie Picture Name</strong></td>
<td width="55%"><input name="strMoviePicName" type="text" value=""></td>
</tr>
<tr>
<td width="45%"><strong>Director</strong></td>
<td><input type="text" name="strDirector" value=""></td>
</tr>
<tr>
<td width="45%" height="28"><strong>Starring</strong></td>
<td><textarea name="strStarring"></textarea></td>
</tr>
<tr>
<td width="45%"><strong>Running Time</strong></td>
<td><input type="text" name="strRunningTime" value="[## hrs, ## mins]"></td>
</tr>
<tr>
<td width="45%"><strong>Format</strong></td>
<td>
<select name="strFormat" size="1">
<option value="VHS">VHS</option>
<option value="DVDWS">DVD - WideScreen</option>
<option value="DVDFS">DVD - FullScreen</option>
</select></td>
</tr>
<tr>
<td width="45%"><strong>Released</strong></td>
<td><input type="text" name="strReleased" value="[mm/dd/yyyy]"></td>
</tr>
<tr>
<td width="45%" height="26"><strong>Rating</strong></td>
<td>
<select name="strRating">
<option value="G">G</option>
<option value="PG">PG</option>
<option value="PG13">PG-13</option>
<option value="R">R</option>
<option value="NC17">NC-17</option>
</select></td>
</tr>
<tr>
<td width="45%"><strong>Official Site</strong></td>
<td><input type="text" name="strOfficialSite" value=""></td>
</tr>
<tr>
<td width="45%" height="26"><strong>Review Rating</strong></td>
<td>
<select name="strReviewRating">
<option value="1 Stars">1 Stars</option>
<option value="2 Stars">2 Stars</option>
<option value="3 Stars">3 Stars</option>
<option value="4 Stars">4 Stars</option>
<option value="5 Stars">5 Stars</option>
</select></td>
</tr>
<tr>
<td width="45%"> </td>
<td>
<textarea name="strReviewText" cols="45" rows="08" id="ReviewText">[Paste or Write your movie review here]</textarea></td>
</tr>
<tr>
<td width="45%"></td>
<td><input name="submit" type="submit" value="Add"></td>
</tr>
</form>
</table>
<?php
}
}
}
?>
the page before it:
PHP Code:
<?php require_once('Connections/users.php'); ?>
<?php
mysql_select_db($database_users, $users);
$query_Recordset1 = "SELECT * FROM users";
$Recordset1 = mysql_query($query_Recordset1, $users) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
if($IsLoggedIn)
{
$levelName = @mysql_query("SELECT * FROM users WHERE username = '" . $details[1] . "'");
while ($levelRow = mysql_fetch_row($levelName))
{ $levelName2 = $levelRow[8]; }
if(isset($_COOKIE['auth']))
{ if($_COOKIE['auth'] == 5)
{ echo "<tr><td width='100%' bgcolor='#66B4F4'>
<center>Administrators Section</center></td></tr>";
} else {
echo "<tr><td width='100%' bgcolor='#66B4F4'>
<center>Members Section</center></td><tr>";
}
}
} else {
$levelName = "Guest";
echo "<tr><td width='100%' bgcolor='#66B4F4'>
<center>Guests' Section</center></td></tr>";
}
echo '<tr><td><center>
<a href="index.php?page=search">Search</a></center></td></tr>';
if($IsLoggedIn)
{ ?>
<tr><td width='100%' bgcolor='#66B4F4'>
<center>Status : <?php echo $levelName2; ?></center></td></tr>
<tr><td><center><?php echo '<a href="index.php?page=viewprofile&userid=' . $roomwithaview . '">View Profile</a> || <a href="index.php?page=editprofile&strMethod=' . $edit . '">Edit Profile</a> || <a href="index.php?page=login&strMethod=logout">Log Out</a>';?></td></tr>
<?php
if (isset($_COOKIE['auth']))
{ if ($_COOKIE['auth'] == 5)
{ ?><tr><td><center>
<a href="index.php?page=addmovie">Add Movie Review</a> || <a href="index.php?page=viewall">Edit Accounts</a>
</center></td></tr> <?php } } } else {
?> <tr><td width='100%' bgcolor='#66B4F4'>
<center>Status : <?php echo $levelName; ?></center></td></tr>
<tr><td><center><a href="index.php?page=registration">Join</a> || <a href="index.php?page=login">Login</a></center></td></tr>
<?php }
?>
</center></td></tr>
<tr><td width='100%' bgcolor='#66B4F4'>
<center>Recently Updated</center>
</td></tr>
Okay and I jsut tried commenting out the recently included files in my index.php page, becuase I know that this addmovie page was working shortly before those. In fact the other pages don't really make use of the database that addmovie does, along with the page I initially had problems with, movieupdate.php. I think that's the problem. I also checked the status of my conenctions and found that there were many sleeping due to having a mysql_pconnect() command in the file to use the movies database... I assumed this was the problem, the reason why it was having trouble grabbing info was that it was trying to use to dbs at once (hence table movies.online not exisitng). okay I hope this made sense and that you guys can help me out thanks!
|