Hello,
I have apache running locally and my website works fine, however, on the remote server it is not working….
I get the error
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in //user.php on line 225
I am not sure why I am getting this error, can someone please help?
[code]
<?php
session_start();
$connection = mysql_connect(‘localhost’, ‘root’, ”);
//Let us know if something is wrong with the connection
if(!$connection){
die(‘Could not connect: ‘ . mysql_error());
}
//Puts Session values into variables
$email=$_SESSION[’email’];
$password=$_SESSION[‘password’];
$userId=$_SESSION[‘userId’];
$username=$_SESSION[‘username’];
//ensures session credentials have been entered./
if(!isset($_SESSION[’email’]) || !isset($_SESSION[‘password’])){
header(“Location: ./login.html”);
}
//Let us know if something is wrong with the connection
if(!$connection){
die(‘Could not connect: ‘ . mysql_error());
}
?>
<?php
mysql_select_db(“winelist”,$connection);
//select all the wines user has rated
$userRatings=”SELECT image,wineName,wineYear,varietal,appearance, aroma, body, taste, finish, ratings, wineId FROM wines
WHERE userId=’$userId'”;
$userQuery = mysql_query($userRatings);
//display the wines
//Gets us the number of ratings
$numberOfRatings = “SELECT wineName FROM wines WHERE userid=’$userId'”;
$ratingResult = mysql_query($numberOfRatings);
$totalRatings = mysql_num_rows($ratingResult);
echo (“<p> Number of Ratings: ” . $totalRatings . “</p>”);
?><table>
<tr>
<td>image</td>
<td>Wine Name</td>
<td>Wine Year</td>
<td>Varietal</td>
<td>Aroma</td>
<td>Appearance</td>
<td>Body</td>
<td>Taste</td>
<td>Finish</td>
</tr>
<?php
for($i=0;$i < $totalRatings; $i++){
echo(“<form name=’edit’ action=’editwine.php’ method=’post’>”);
echo(“<input type=’hidden’ value='” . mysql_result($userQuery,$i,’wineId’) . “‘ name=’wineId’>”);
echo(“<tr>” . “<td>”);
echo(“<img src ='” . mysql_result($userQuery,$i,’image’) . “‘width=60 height=180>”);
echo(“<td>”);
echo(mysql_result($userQuery,$i,’wineName’));
echo(“<td>”);
echo(mysql_result($userQuery,$i,’wineYear’));
echo(“<td>”);
echo(mysql_result($userQuery,$i,’varietal’));
echo(“<td>”);
echo(mysql_result($userQuery,$i,’aroma’));
echo(“<td>”);
echo(mysql_result($userQuery,$i,’appearance’));
echo(“<td>”);
echo(mysql_result($userQuery,$i,’body’));
echo(“<td>”);
echo(mysql_result($userQuery,$i,’taste’));
echo(“<td>”);
echo(mysql_result($userQuery,$i,’finish’));
echo(“<div id=’edit’><td>”);
echo(“<input type = ‘submit’ value=’edit’ style=’width:50px;’>”);
echo(“</form> </tr> </td>”);
}
echo(“</table>”)
?>
[CODE]