LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 03-24-2010, 03:12 PM   #1
MTAS
LQ Newbie
 
Registered: Mar 2010
Posts: 28

Rep: Reputation: 0
Apache2, PHP5, or MYSQL issue: Unable to jump to row 0 on MySQL .....


The error:
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 4 in /var/www/player.php on line 8

line 8 = $path = mysql_result(mysql_query("select fpointer from flist where `uuid` = '$uuid' limit 1;"),0,0);

flist is an existing table, fpointer and uuid are existing fields in the table.

They are close to half a million rows in the table so there is data.

Version Information:

Debian
5.0.4

MYSQL
+-------------------------+-------------------+
| Variable_name | Value |
+-------------------------+-------------------+
| protocol_version | 10 |
| version | 5.0.51a-24+lenny3 |
| version_comment | (Debian) |
| version_compile_machine | i486 |
| version_compile_os | debian-linux-gnu |
+-------------------------+-------------------+

PHP5
PHP 5.2.6-1+lenny8 with Suhosin-Patch 0.9.6.2 (cli) (built: Mar 14 2010 08:14:04)


I'm not sure what other information you might want.
 
Old 03-24-2010, 08:31 PM   #2
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
well, so? does that cause an error in application? if not, then make it silent with @ before function call.
 
Old 03-24-2010, 08:42 PM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,311

Rep: Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040
Sounds like you're getting a null result; possible bad value for uuid:
http://www.ozzu.com/programming-foru...lt-t74864.html
http://www.phpfreaks.com/forums/inde...topic=246992.0
 
Old 03-25-2010, 11:39 AM   #4
MTAS
LQ Newbie
 
Registered: Mar 2010
Posts: 28

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Web31337 View Post
well, so? does that cause an error in application? if not, then make it silent with @ before function call.
Sorry posted this several other places and just didn't select everything when I was copying and pasteing.

Quote:
Originally Posted by chrism01 View Post
Sounds like you're getting a null result; possible bad value for uuid:
http://www.ozzu.com/programming-foru...lt-t74864.html
http://www.phpfreaks.com/forums/inde...topic=246992.0
That is what I'm sure is happening. I think what is happening is this script is executing before another that actually provides the UUID.

This page allows to search for files, play them in a media player in the webpage, and download them. The search script is one script, and the player and download are another script.

I think what is happening is that the player script is executing when the page loads. instead of after a file has been selected via the main search script. Since nothing has been selected there is no UUID present so the search comes back null.

At least that is what I suspect, but I honestly am not sure.

After selecting a field though the player/downloader still does not work though so I am not entirely sure what is wrong
 
Old 03-25-2010, 11:42 AM   #5
MTAS
LQ Newbie
 
Registered: Mar 2010
Posts: 28

Original Poster
Rep: Reputation: 0
Index.php
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Audio Archiver [Monroe Telephone, Inc]</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" media="all" href="/jscalendar-1.0/calendar-win2k-cold-1.css" title="win2k-cold-1" />
</head>
<?
include("globals.php");
?>
<body>

<script language="javascript" src="/ajax.js"></script>
<script type="text/javascript" src="/jscalendar-1.0/calendar.js"></script>
<script type="text/javascript" src="/jscalendar-1.0/lang/calendar-en.js"></script>  
<script type="text/javascript" src="/jscalendar-1.0/calendar-setup.js"></script>
Total Number of Calls Recorded <?=total_records();?>
<table>
<tr>
<form name="search">
	<td>
	<table border="0">
	<tr>
		<td>Date</td>
		<td>Dialed Number/ANI</td>
		<td></td>
	</tr>
	<tr>
		<td>
<!-- /* parseDate(this, '%Y-%m-%d %H:%M');*/ -->
	<input tabindex='4' name='date_time' id='date_time'  onblur=""  size='15' maxlength='10' type="text" value="">
	<img src="/jscalendar-1.0/img.gif" alt=""  id="date_time_trigger" align="absmiddle" onMouseOver="this.style.cursor='hand';" onMouseOut="this.style.cursor='default';">
		</td>
		<td>
			 <input type="text" size="10" name="dialednumber">
		</td>
		<td>
	<input type="submit" value=" Query " onClick="query(document.search.date_time.value,document.search.dialednumber.value); return false;">
		</td>
	</tr>
	</table>
	</td>
	<td>
</form>
<form name="test" action="download.php" target="download" method="POST">
<div id="player"></div>
</form>
	</td>
</tr>

<tr>
	<td class="20">
<div id="results">Results.......</div>
	</td>
</tr>
</table>
<script language="javascript">
var ao = new AjaxObject();
function query(date_time,dialednumber){
	var d = new Date(); 
	var mytime = d.getTime() - d.getMilliseconds() /1000;
	ao.sndReq('get','search.php','query=true&date_time='+date_time+'&dialednumber='+dialednumber+'&tsmark='+mytime);
	return true;
}
ao.sndReq('get','player.php','query=<?=time()?>');
Calendar.setup ({
        inputField : "date_time", ifFormat : "%Y-%m-%d %H:%M", showsTime : true, button : "date_time_trigger", singleClick : true, step : 1
});
</script>
<IFRAME STYLE="display:none" NAME="download"></IFRAME>
</body>
</html>
globals.php
Code:
<?
$dbhostname = "localhost"; 
$dbusername = "XXXX";
$dbpassword = "XXXX"; 
MYSQL_PCONNECT($dbhostname, $dbusername, $dbpassword) OR die("Unable to connect to database server ($dbhostname)");
@mysql_select_db("austoe") or die ( "Unable to select database austoe."); 

function total_records(){
 return number_format((mysql_result(mysql_query("select count(*) from flist;"),0,0)),0);
}
?>
search.php
Code:
results=>
Results...<br>
<?
include("globals.php");
$date = substr($_REQUEST['date_time'],0,13);
$dialed = $_REQUEST['dialednumber'];
$rs = mysql_query("select * from flist where call_date like '".$date."%' and (caller_id like '%".$dialed."%' or dial_number like '%".$dialed."%') order by call_date limit 250");
if(mysql_num_rows($rs)>0){
?>
<table border="1" cellspacing="0" bordercolordark="#efefef">
<?
	while($r = mysql_fetch_assoc($rs)){
if(!$r['caller_id']){$r['caller_id']='0000000000';}
if(!$r['dial_number']){$r['dial_number']='0000000000';}
		?>
<tr>
<!-- <td><?=$r['uuid'];?><br></td> -->
<td><a href="javascript: ao.sndReq('get','player.php','play=<?=$r['uuid'];?>');"><?=$r['call_date'];?></a></td>
<td><?=$r['dial_number'];?><br></td>
<td><?=$r['caller_id'];?><br></td>
</tr>

		<?
	}
?>
</table>
<?
}else{
?>No results

<?
}
?>
player.php
Code:
player=>
<table>
	<tr>
<td>
<? 
include("globals.php");
$uuid = $_REQUEST['play'];
$path = mysql_result(mysql_query("select fpointer from flist where `uuid` = '$uuid' limit 1;"),0,0);
$path = substr($path,2,strlen($path)-2);
// print 'path'.$path;
?>
<OBJECT
ID="mediaPlayer" width=220 height=45
CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
STANDBY="Loading Microsoft Windows Media Player components..."
TYPE="application/x-oleobject">
<PARAM NAME="fileName" VALUE="/media/<?=$path;?>">
<PARAM NAME="animationatStart" VALUE="true">
<PARAM NAME="transparentatStart" VALUE="true">
<PARAM NAME="autoStart" VALUE="true">
<PARAM NAME="uiMode" VALUE="mini">
<PARAM NAME="showControls" VALUE="true">
</OBJECT>

</td>
<td valign="middle">
<input type="hidden" name="uuid" value="<? echo $_REQUEST['play'];?>">
<input type="submit" value=" Download Audio ">
</td>
	</tr>
</table>
|
Download.php
Code:
<?
include("globals.php");
header("TTP/1.1 200 OK\r\n");
header("Status: 200 OK\r\n");
$file_id = $_REQUEST['uuid'];
$rs = mysql_query("select fpointer from flist where `uuid` = '$file_id' limit 1;");
$rel = mysql_result($rs,0,0);
$rel = substr($rel,1,strlen($rel)-1);
$friendly=substr($rel,1,strlen($rel)-1);
$type = substr($rel, strlen($rel) -3,3);
header("Content-Disposition: attachment; filename=$friendly");
header("Content-Type: Audio/$type;\r\n");
$path="/var/store".$rel;
$size = filesize($path);
//print $rel;
$handle = fopen($path, "r");
//header("Content-Type: Binary");
//header("Accept-Ranges: bytes");
// header("Content-Length: ".$size);
$da = fread($handle, $size + 2);
fclose($handle);
print $da;
?>

Last edited by MTAS; 03-25-2010 at 11:47 AM.
 
Old 03-26-2010, 10:13 AM   #6
MTAS
LQ Newbie
 
Registered: Mar 2010
Posts: 28

Original Poster
Rep: Reputation: 0
No one have any ideas whats causing it?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Installing Apache2 With PHP5 And MySQL Support On Fedora 11 (LAMP) LXer Syndicated Linux News 0 11-13-2009 10:00 AM
LXer: Installing Apache2 With PHP5 And MySQL Support On CentOS 5.3 (LAMP) LXer Syndicated Linux News 0 08-18-2009 10:30 AM
LXer: Installing Apache2 With PHP5 And MySQL Support On Ubuntu 9.04 (LAMP) LXer Syndicated Linux News 0 07-28-2009 03:40 PM
Apache2, PHP5, MySQL and charset issue lenanu Linux - Software 2 06-26-2006 05:30 AM
MySQL - Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 9 jasontn Linux - Software 0 02-09-2005 01:17 PM


All times are GMT -5. The time now is 07:24 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration