Link to home
Create AccountLog in
Avatar of taverny
taverny

asked on

PHP Notice: Use of undefined constant recordset

Hi,

I have a code that works fine but at the bottom of the page I keep getting an error message.
what am I missing?
here is hte error:
PHP Notice: Use of undefined constant recordset - assumed 'recordset' in C:\Inetpub\wwwroot\final3.php on line 116 PHP Notice: Use of undefined constant recordset - assumed 'recordset' in C:\Inetpub\wwwroot\final3.php on line 117

what is odd , is that the same code on another computer works with no error

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> PSH Rush Jobs </TITLE>
  <meta http-equiv="refresh" content="90">
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="David Pelerin" CONTENT="">
  <META NAME="Display Type Airport" CONTENT="">
  <META NAME="This Code will display the Rush Job from our Access Database" CONTENT="">
 
 
	
 </HEAD>
 
 <BODY>
 
 
	<TABLE>
		 <TR>
			<TD width="623">
				<p>
					<img border="0" src="file://pshdc1/Public/MSOFFICE/ACCESS/DATABASEBACKUP/Logo-Horizontal.jpg" width="218" height="58">
				</p>
			</TD>
			<TD>
				<H1><center>			
					<div>
						 <b><span id=tick2></span></b>
					</div>
					</center>
				</H1>
			</TD>
			<TD></TD>
		 </TR>
	</TABLE>
 
	<script>
		// list of functions that will be executed when the page finishes loading
		// should be initialized with empty array and addLoadHandler(..) should be used to add handlers
		var win_load_handlers = [];
		// actual onload handler
		window.onload = function ()
		{
			// cycle through win_load_handlers and call them
			for(var i = 0; i < win_load_handlers.length; ++i)
			{
				win_load_handlers[i]();
			}
		}
		// add another handler to the list
		function addLoadHandler(func)
		{
			win_load_handlers[win_load_handlers.length] = func;
		}
	 </script>
	<script>
		<!--
		/*
		By George Chiang (WA's JavaScript tutorial) 
		http://wsabstract.com
		*/
 
		function show2(){
		  if (!document.all)
			return
 
		  var Digital=new Date()
		  var hours=Digital.getHours()
		  var minutes=Digital.getMinutes()
		  var seconds=Digital.getSeconds()
		  var dn="AM" 
 
		  if (hours>12){
		   dn="PM"
		   hours=hours-12
		  }
 
		  if (hours==0)
		   hours=12
 
		  if (minutes<=9)
		   minutes="0"+minutes
 
		  if (seconds<=9)
		   seconds="0"+seconds
		   var ctime=hours+":"+minutes+":"+seconds+" "+dn
		   tick2.innerHTML="<b style='font-size:32;color:black;'>"+ctime+"</b>"
		   setTimeout("show2()",1000)
		}
 
		addLoadHandler(show2)
		//-->
	</script>
 
	<TABLE >
		<TR>
			<?php
			
			////connection for 2007
			//
			//	$conn = new COM('ADODB.Connection') or die('Cannot start ADO'); 
			//	$conn->Open('Provider=Microsoft.ACE.OLEDB.12.0; Data Source=C:\inetpub\wwwroot\share\PshincNew2.accdb; Persist Security Info=False;');
			////
 
			////Connection for 97
			//
			//	$db="C:\Inetpub\wwwroot\Share\pshinc.mdb";
				$db="\\\\pshdc1\\Public\\MSOFFICE\\ACCESS\\Pshinc.mdb";
				$conn = new COM('ADODB.Connection'); 
				$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db");
			////	
 
 
				// SQL statement to build recordset.$rsElec for Electronic $rsHydr for Hydraulic
				$rsElec = recordset;
				$rsHydr = recordset;
				$rsElec = $conn->Execute("SELECT [JOB #],CUSTOMER FROM [JOB FOLDER] WHERE (([Rush] = TRUE) AND ([STATUS] ='A')) ORDER BY CUSTOMER");
				$rsHydr = $conn->Execute("SELECT [JOB #],[CUSTOMER NAME] FROM [SERVOHYDRAULICS] WHERE (([PRIORITY] = 'RUSH') AND ([STATUS] ='APPROVED'))order by [CUSTOMER NAME]");
						 
				//--variables initialized:
				$NumberOfJobsElec=0;
				$NumberPagesElec=0;
				$counterElec=0;
 
				$NumberOfJobsHydr=0;
				$NumberPagesHydr=0;
				$counterHydr=0;
						
				//calculate the number of Rush in the records set for electronics
				while (!$rsElec->EOF) 
				{ 
					$rsElec->MoveNext(); 
					$NumberOfJobsElec = $NumberOfJobsElec+1;
				}
 
				//calculate the number of Rush in the records set for electronics
				while (!$rsHydr->EOF) 
				{ 
					$rsHydr->MoveNext(); 
					$NumberOfJobsHydr = $NumberOfJobsHydr+1;
				}
		 
				//Calculate the number of Items per page
				//Ceil Returns the next highest integer value by rounding up value if necessary
				$NumberPagesElec = $NumberOfJobsElec/20;
				$NumberPagesElec = ceil($NumberPagesElec); 
				$NumberPagesHydr = $NumberOfJobsHydr/20;
				$NumberPagesHydr = ceil($NumberPagesHydr); 
			?>
			<TD>
				<b><u><font size="17" color=" #6600FF"><?php echo $NumberOfJobsElec." Electronic";?></font><font size="17" color="Red"> Rush</font><font size="17" color=" #6600FF"> Jobs</font></u></b>
			</TD>
			<TD>
				<b><u><font size="17" color=" #6600FF"><?php echo $NumberOfJobsHydr." Hydraulic";?></font><font size="17" color="Red"> Rush</font><font size="17" color=" #6600FF"> Jobs</font></u></b>
			</TD>
		</TR>
		<TR>
			<TD>
				<?php
					//echo $NumberPagesElec." Pages  with 20 job per page</p>";
					
					//echo $NumberPagesHydr." Pages  with 20 job per page</p>";
 
					//--ack to the beginning of the recordset
					$rsElec->MoveFirst(); 
					$rsHydr->MoveFirst();
 
					//Counter is to display the record number
					$counterElec=1;
					$counterHydr=1;
			 
					//re-populate the recorset because we are at the EOF 
					$rsElec->MoveFirst();
					$rsHydr->MoveFirst();
				?>
 
				<script type="text/javascript">
				/*
<!--------------------->
<!--------------------->
<!--------------------->
<!--------------------->
<!--------------------->
				*/				 
					/***********************************************
					* Fading Scroller- ? Dynamic Drive DHTML code library (www.dynamicdrive.com)
					* This notice MUST stay intact for legal use
					* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
					***********************************************/
					 
					var delay = 3000; //set delay between message change (in miliseconds)
					var maxsteps=40; // number of steps to take to change from start color to endcolor
					var stepdelay=50; // time in miliseconds of a single step
					//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
					var startcolor= new Array(255,255,255); // start color (red, green, blue)
					var endcolor=new Array(0,0,0); // end color (red, green, blue)
					var fcontent=new Array();
 
 
					begintag='<div style="font: normal 40px Arial; padding: 5px;">'; //set opening tag, such as font declarations
				 
				 
					<?php 
						$counterElec=1;
						while(!$rsElec->EOF)
						{
							echo 'fcontent[ fcontent.length ] = "' .$counterElec.')&nbsp;&nbsp;&nbsp;'. '<u><b>' .  str_replace('"','&#34;',preg_replace('/\r?\n/U',"<br/>",$rsElec->Fields("JOB #")->Value)) .'</b></u><br/><i>&nbsp;&nbsp;'.str_replace('"','&#34;',preg_replace('/\r?\n/U',"<br/>",$rsElec->Fields("CUSTOMER")->Value)).'</i><br/>'. '<br/>\n' ."\";\n";
							++$counterElec;
							$rsElec->MoveNext();
						}
						$rsElec->Close();
					?> 
					closetag='</div>';
												 
					var fwidth='690px'; //set scroller width
					var fheight='660px'; //set scroller height
					var fadelinks=0;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.
					var ie4=document.all&&!document.getElementById;
					var DOM2=document.getElementById;
					var faderdelay=0;
					var index=0;
									 
					/*Rafael Raposo edited function*/
					//function to change content
					var RECORDS_PER_SCREEN=4;
					function changecontent()
					{
						if (index>=fcontent.length)
							index=0;
						var data = "";
						for( var i=0; i < RECORDS_PER_SCREEN && typeof(fcontent[i+index])!="undefined"; ++i)
						{
							  data+=fcontent[index + i];
						}
						if (DOM2)
						{
							document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")";
							document.getElementById("fscroller").innerHTML=begintag+data+closetag
							if (fadelinks)
								linkcolorchange(1);
								colorfade(1, 15);
						}
						else if (ie4)
							document.all.fscroller.innerHTML=begintag+data+closetag;
						index+=RECORDS_PER_SCREEN;
					}
				 
					// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
					// Modified by Dynamicdrive.com
					 
					function linkcolorchange(step)
					{
						var obj=document.getElementById("fscroller").getElementsByTagName("A");
						if (obj.length>0)
						{
							for (i=0;i<obj.length;i++)
							obj[i].style.color=getstepcolor(step);
						}
					}
				 
					/*Rafael Raposo edited function*/
					var fadecounter;
					function colorfade(step) 
					{
						if(step<=maxsteps) 
						{      
							document.getElementById("fscroller").style.color=getstepcolor(step);
							if (fadelinks)
								linkcolorchange(step);
							step++;
							fadecounter=setTimeout("colorfade("+step+")",stepdelay);
						}
						else
						{
							clearTimeout(fadecounter);
							document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
							setTimeout("changecontent()", delay);
						  
						}   
					}
				 
					/*Rafael Raposo's new function*/
					function getstepcolor(step) 
					{
						var diff
						var newcolor=new Array(3);
						for(var i=0;i<3;i++) 
						{
							diff = (startcolor[i]-endcolor[i]);
							if(diff > 0) 
							{
							  newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
							} 
							else 
							{
							  newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
							}
						 }
						 return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
					}
				 
					if (ie4||DOM2)
					  document.write('<div id="fscroller" style="border:0px solid black;width:'+fwidth+';height:'+fheight+'"></div>');
					 
					if (window.addEventListener)
						window.addEventListener("load", changecontent, false)
					else if (window.attachEvent)
						window.attachEvent("onload", changecontent)
					else if (document.getElementById)
						addLoadHandler(onload=changecontent)
				 
				</script>
			</TD>
			<TD>
				<script type="text/javascript">
				/*
<!--------------------->
<!--------------------->
<!--------------------->
<!--------------------->
<!--------------------->
				*/
					/***********************************************
					* Fading Scroller- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
					* This notice MUST stay intact for legal use
					* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
					***********************************************/
 
					var delay1 = 3000; //set delay1 between message change (in miliseconds)
					var maxsteps1=40; // number of steps to take to change from start color to endcolor1
					var stepdelay1=50; // time in miliseconds of a single step
					//**Note: maxsteps1*stepdelay1 will be total time in miliseconds of fading effect
					var startcolor1= new Array(255,255,255); // start color (red, green, blue)
					var endcolor1=new Array(0,0,0); // end color (red, green, blue)
 
					var fcontent1=new Array();
					begintag1='<div style="font: normal 40px Arial; padding: 5px;">'; //set opening tag, such as font declarations
					<?php 
						$counterHydr=1;
						while(!$rsHydr->EOF)
						{
							echo 'fcontent1[ fcontent1.length ] = "' .$counterHydr.')&nbsp;&nbsp;&nbsp;'. '<u><b>' . str_replace('"','&#34;',preg_replace('/\r?\n/U',"<br/>",$rsHydr->Fields("JOB #")->Value)) . '</b></u><br/><i>&nbsp;&nbsp;' .str_replace('"','&#34;',preg_replace('/\r?\n/U',"<br/>",$rsHydr->Fields("CUSTOMER NAME")->Value)).'</i><br/>'. '<br/>\n' ."\";\n";
							++$counterHydr;
							$rsHydr->MoveNext();
						}
						$rsHydr->Close();
					?> 
					closetag1='</div>';
 
					var fwidth1='690px'; //set scroller width
					var fheight1='660px'; //set scroller height
					var fadelinks1=0;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.
					var ie14=document.all&&!document.getElementById;
					var DOM21=document.getElementById;
					var faderdelay1=0;
					var index1=0;
 
					/*Rafael Raposo edited function*/
					//function to change content
					var RECORDS_PER_SCREEN1=7;
					function changecontent1()
					{
						if (index1>=fcontent1.length)
							index1=0;
						var data1 = "";
						for( var i2=0; i2 < RECORDS_PER_SCREEN1 && typeof(fcontent1[i2+index1])!="undefined"; ++i2)
						{
							  data1+=fcontent1[index1 + i2];
						}
 
 
						if (DOM21)
						{
							document.getElementById("fscroller1").style.color="rgb("+startcolor1[0]+", "+startcolor1[1]+", "+startcolor1[2]+")";
							document.getElementById("fscroller1").innerHTML=begintag1+data1+closetag1
							if (fadelinks1)
								linkcolorchange1(1);
								colorfade1(1, 15);
						}
						else if (ie14)
							document.all.fscroller1.innerHTML=begintag1+data1+closetag1;
							index1+=RECORDS_PER_SCREEN1;
					}
 
					/*Rafael Raposo edited function*/
					var fadecounter1;
					function colorfade1(step) 
					{
					if(step<=maxsteps1) 
						{	
							document.getElementById("fscroller1").style.color=getstepcolor1(step);
							if (fadelinks1)
								linkcolorchange1(step);
							step++;
							fadecounter1=setTimeout("colorfade1("+step+")",stepdelay1);
						}
						else
						{
							clearTimeout(fadecounter1);
							document.getElementById("fscroller1").style.color="rgb("+endcolor1[0]+", "+endcolor1[1]+", "+endcolor1[2]+")";
							setTimeout("changecontent1()", delay1);
					
						}   
					}
 
					/*Rafael Raposo's new function*/
					function getstepcolor1(step) 
					{
						var diff;
						var newcolor=new Array(3);
						for(var i=0;i<3;i++) 
						{
							diff = (startcolor1[i]-endcolor1[i]);
							if(diff > 0) 
							{
								newcolor[i] = startcolor1[i]-(Math.round((diff/maxsteps1))*step);
							} 
							else 
							{
								newcolor[i] = startcolor1[i]+(Math.round((Math.abs(diff)/maxsteps1))*step);
							}
						}
						return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
					}
 
					if (ie14||DOM21)
					  document.write('<div id="fscroller1" style="border:0px solid black;width:'+fwidth+';height:'+fheight1+'"></div>');
 
					if (window.addEventListener)
						window.addEventListener("load", changecontent1, false)
					else if (window.attachEvent)
						window.attachEvent("onload", changecontent1)
					else if (document.getElementById)
						addLoadHandler(changecontent1)
 
				</script>
			</TD>
		</TR>
	</TABLE>
 
 
 
 
 
<!--------------------->
<!--------------------->
<!--------------------->
<!--------------------->
<!--------------------->
	<!-- Scrolling Marque on the bottom of the page -->
	<script language="JavaScript1.2">
 
		/*
		Cross browser Marquee script- © Dynamic Drive (www.dynamicdrive.com)
		For full source code, 100's more DHTML scripts, and Terms Of Use, visit http://www.dynamicdrive.com
		Credit MUST stay intact
		*/
 
		//Specify the marquee's width (in pixels)
		var marqueewidth="1400px"
		//Specify the marquee's height
		var marqueeheight="70px"
		//Specify the marquee's marquee speed (larger is faster 1-10)
		var marqueespeed=2
		//configure background color:
		var marqueebgcolor="#ffffcc"
		//Pause marquee onMousever (0=no. 1=yes)?
		var pauseit=0
 
		//Specify the marquee's content (don't delete <nobr> tag)
		//Keep all content on ONE line, and backslash any single quotations (ie: that\'s great):
		<?php $file_name='\\\pshdc1\\Public\\MSOFFICE\\ACCESS\\DATABASEBACKUP\\Marquee.txt'; $marq_text = htmlspecialchars(str_replace('\r', '', str_replace("\n", ' * * * ', file_get_contents($file_name))), ENT_QUOTES); // replace \n with *, remove \r and encode for html ?>
		var marqueecontent='<nobr><font size ="12" face="Arial"><?php echo $marq_text; ?></font></nobr>'
 
 
 
 
		////NO NEED TO EDIT BELOW THIS LINE////////////
		marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS
		var copyspeed=marqueespeed  //+1 added to speed the text
		var pausespeed=(pauseit==0)? copyspeed: 0
		var iedom=document.all||document.getElementById
		if (iedom)
		document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+marqueecontent+'</span>')
		var actualwidth=''
		var cross_marquee, ns_marquee
 
		function populate()
		{
			if (iedom)
			{
				cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
				cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
				cross_marquee.innerHTML=marqueecontent
				actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth
			}
			else if (document.layers)
			{
				ns_marquee=document.ns_marquee.document.ns_marquee2
				ns_marquee.left=parseInt(marqueewidth)+8
				ns_marquee.document.write(marqueecontent)
				ns_marquee.document.close()
				actualwidth=ns_marquee.document.width
			}
			lefttime=setInterval("scrollmarquee()",10)
		}
		addLoadHandler(populate)
 
		function scrollmarquee()
		{
			if (iedom)
			{
				if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
				cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px"
				else
				cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
 
			}
			else if (document.layers)
			{
				if (ns_marquee.left>(actualwidth*(-1)+8))
				ns_marquee.left-=copyspeed
				else
				ns_marquee.left=parseInt(marqueewidth)+8
			}
		}
 
		if (iedom||document.layers)
		{
			with (document)
			{
				document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
				if (iedom)
				{
					write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
					write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
					write('<div id="iemarquee" style="position:absolute;left:0px;top:0px"></div>')
					write('</div></div>')
				}
				else if (document.layers)
				{
					write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
					write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
					write('</ilayer>')
				}
				document.write('</td></table>')
			}
		}
	</script>
 
 
 </BODY>
</HTML>

Open in new window

Avatar of ncoo
ncoo

It looks like you've got error reporting setup to show warnings on one machine.

You can change it in php.ini if you have access or use the function below, choose the level of error reporting you require.

http://uk3.php.net/error_reporting
<?php
 
// Turn off all error reporting
error_reporting(0);
 
// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);
 
// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
 
// Report all errors except E_NOTICE
// This is the default value set in php.ini
error_reporting(E_ALL ^ E_NOTICE);
 
// Report all PHP errors
error_reporting(E_ALL);
 
// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
 
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of hernst42
hernst42
Flag of Germany image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of taverny

ASKER

Thanks ,
It was a typo. I put the quote around recordset and it worked.