imes_bedo Posted May 21, 2007 Share Posted May 21, 2007 Hi. I've been assigned to handle the website of my org and the entire website is made in php which i have no idea of. Anyway, somehow, I managed to do some stuff but... on my file uploader, i keep getting this error Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 5 I really don't know what it means so... please help me! I need to finish this by tomorrow. Quote Link to comment https://forums.phpfreaks.com/topic/52285-need-help-php-newbie/ Share on other sites More sharing options...
kenrbnsn Posted May 21, 2007 Share Posted May 21, 2007 Please post the code that is causing the error between tags. Ken Quote Link to comment https://forums.phpfreaks.com/topic/52285-need-help-php-newbie/#findComment-257961 Share on other sites More sharing options...
imes_bedo Posted May 21, 2007 Author Share Posted May 21, 2007 first error code: <?php if($_SESSION["user_login"]=="yes"){ $file_id=$_REQUEST["file"]; $folder_id=$_REQUEST["folder"]; mysql_connect($host_name,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM file where file_id='$file_id';"; $result=mysql_query($query); $num=@mysql_numrows($result); mysql_close(); $temp_date = mysql_result($result,$i,"date_created"); ?> second error code: <form action="pro_picture_delete.php" method="post" name="form1"> <tr> <td colspan="2"> <table width="742" border="0" cellspacing="0" cellpadding="0" height="100%"> <tr> <td width="246"></td> <td colspan="2" class="v2" height="100%" valign="top"><br> <p align="center"> <font face="Verdana" size="2" color="#666666"><?php echo mysql_result($result,$i,"file_title"); ?></font></b> </p> <p align="center"> <a href="Uploads/<?php echo mysql_result($result,$i,"file_name");?>.doc"">Click Here to Download File</a> </p> <p align="center"> <font face="Verdana" size="1" color="#666666">posted - <?php echo monthNumToWholeName(getMonth($temp_date))." ".getDay($temp_date).", ".getYear($temp_date); ?> - </font><br> <br> </p> <p align="left"><b><a href="../imes_downloads.php"> <font face="Verdana" size="2" color="#666666">back to folders</font></b></a> <font face="Verdana" size="2" color="#666666">: </font><b> <a href="view_picture.php?folder=<?php echo $folder_id ?>"> <font face="Verdana" size="2" color="#666666">back to file</font></b></a> </p> </td> </tr> The lines that had the error is the $temp_date one and the $result,$i,"file_title" in the second one. I really need help. I need to finish this by tomorrow. Thanks. ^^ Quote Link to comment https://forums.phpfreaks.com/topic/52285-need-help-php-newbie/#findComment-258203 Share on other sites More sharing options...
kenrbnsn Posted May 21, 2007 Share Posted May 21, 2007 When you use the mysql_result() function, it needs to have the row number to retrieve the data from. You are passing it the variable $i, but that variable is not defined anywhere. Also the "@" character suppresses error messages, so you really don't know what is happening with your code. I suggest that for testing purposes, you do the following: <?php if($_SESSION["user_login"]=="yes"){ $file_id=$_REQUEST["file"]; $folder_id=$_REQUEST["folder"]; mysql_connect($host_name,$username,$password); mysql_select_db($database) or die( "Unable to select database<br>" . mysql_error()); $query="SELECT * FROM file where file_id='$file_id';"; $result=mysql_query($query) or die("Problem with the query:<pre>$query</pre><br>" . mysql_error()); $num=mysql_numrows($result) or die("Problem getting number of rows<br>" . mysql_error()); if (num > 0) { $rw = mysql_fetch_assoc($result); $temp_date = $rw["date_created"]; } ?> Do something similar in the second area. Ken Quote Link to comment https://forums.phpfreaks.com/topic/52285-need-help-php-newbie/#findComment-258245 Share on other sites More sharing options...
imes_bedo Posted May 21, 2007 Author Share Posted May 21, 2007 Hmm... I tried the code that you gave but it came back with Problem getting number of rows I hate to sound like a total newbie but I want to start throwing my laptop across the room already. >_< Quote Link to comment https://forums.phpfreaks.com/topic/52285-need-help-php-newbie/#findComment-258273 Share on other sites More sharing options...
imes_bedo Posted May 21, 2007 Author Share Posted May 21, 2007 What if I just define what $i is? Quote Link to comment https://forums.phpfreaks.com/topic/52285-need-help-php-newbie/#findComment-258276 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.