Jump to content

Hardwarez

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Everything posted by Hardwarez

  1. Ok, sorry. Stupid mistake in the while loop Thanks!
  2. There is no error. It returns a single result and will not return anything else.
  3. I am trying to select 3 different values from a table on the same row/entry. I am using this, but it does not seem to work. Can you tell me the correct way? SELECT * FROM techwork WHERE assignstatus = '3' OR assignstatus='1' OR assignstatus ='0' ORDER BY '' DESC
  4. I cought the mistake that was printing document.write("hello world"); NOT just hello world. The alert placed in the function does not come up when I defocus from the job number input box, so I know the script is not even being called.. WHY?
  5. Ok, new problem. I pasted some java script into my php page. The java script will not execute. I put is some obvious stuff that should execute, but it does not. At once the top I inserted document.write("hello world"); When I view the page I see document.write("hello world"); NOT just hello world. I suspect I have a misplaced character or something, I cant find. here the page code: <script language="LiveScript"> alert("java script"); document.write("Hello World!"); function createRequestObject() { var ro; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ ro = new ActiveXObject("Microsoft.XMLHTTP"); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); function sndReq(action) { http.open('get', 'dynamic.php?job='+action); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; /*document.myForm.email.value=response;*/ var varArray = response.split('|'); document.myForm.client.value=varArray[0]; document.myForm.descript.value=varArray[1];*/ } } function clientcheck(form) { /*.form.email.value document.myForm.email.value = varArray[0]; */ alert("Active"); if (form.jobnumber.value !=""){ sndReq(form.jobnumber.value); } } </script> <?php echo "<html><head><title>Stanger Surveying LLC Technician Management System</title> </head>"; // BEGIN PHP //**************************************************************************************************************** //JAVA NOTE: setTimeout(window.open("http://66.76.55.66/joblist/index.php"),5000); $user = "X; $password = "xxx"; $database = "G"; $host = "localhost"; $link = mysql_pconnect($host, $user, $password); mysql_select_db("stanger") or die(mysql_error()); //******************************************************************************************************** // INCLUDES //******************************************************************************************************** //********************************************************* // MAIN BODY //********************************************************* echo '<style type="text/css"> html, body { height: 100%; } #container { min-height: 100%; position: relative; } #header { margin:0; padding:0; background-color:gray; color:white; z-index: 3; } #nav { position: absolute; top:37px; float:left; width:100%; height: 400px; float:left; margin:0; padding:0; border-left:1px solid gray; z-index: 3; } #footer { height: 10px; width: 100%; position: absolute; top:59px; margin:0; padding:0; background-color:gray; color:white; z-index: 3; } #content { position: absolute; top:80px; } </style>'; //=================================MAIN CODE============================================== echo 'document.write("Hello World!");'; $user=$_GET['user']; $user=mysql_real_escape_string($user); echo '<div id="container"> <div id="header"><h1 class="header">Jobs In Progress</h1></div> <iframe src="http://66.76.55.66/tech/progress.php?user='.$user.'" width="100%" height="130px"></iframe> <div id="header"><h1 class="header">Request Technician Work</h1></div> <div style="position:relative; font-size:16px; top:0; left:0; z-index:1;"> <form name="myForm"><B>Job Number: </b><input type=text name="jobnumber" value="" onBlur="clientcheck(this.form)"> <B>Client Name: </b><input type=text name="client" size=60 maxlength=100><BR><b>Description: &#160</b><input type="text" size=101 maxlength=100 name=descript></form> </div> <div style="position:relative; top:-14; left:5; color:red; font-size:16px; z-index:2"> Layer 2 </div> '; mysql_close($link); //Close data base!!!!!!!! echo "</body></html>" ?> What this should be doing is getting data from a php page when you tab out of job number and the client and description fields of the form should be filled in. However the script is not running at all.. Please help!
  6. Never mind I got it. I was using a split that I pasted in from somewhere else. Thank you for your help!!!!!!!!!!!!!!!!
  7. Ok I am getting the data I wanted however the problem I seem to be having is splitting the two variables out. How to I access each var? Here is the code I have now: <script language="LiveScript"> function createRequestObject() { var ro; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ ro = new ActiveXObject("Microsoft.XMLHTTP"); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); function sndReq(action) { http.open('get', 'dynamic.php?job='+action); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; /*document.myForm.email.value=response;*/ var varArray = xmlHttp.responseText.split('|'); document.myForm.email.value=varArray[0]; /*document.myForm.email.value=varArray[1];*/ } } function emailcheck(form) { /*.form.email.value document.myForm.email.value = varArray[0]; */ if (form.email.value !=""){ sndReq(form.email.value); } } </script> <?php echo '<form name="myForm"><B>Enter your Email address :</b><BR> <input type=text name="email" value="" onBlur="emailcheck(this.form)"> <BR></form> '; ?> It should return the first of two vars into the form I typed in, but it does not
  8. This is the code I have set up to test with. Please tell what I am doing wrong. It returns undefined in the text box. <script language="LiveScript"> function createRequestObject() { var ro; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ ro = new ActiveXObject("Microsoft.XMLHTTP"); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); function sndReq(action) { http.open('get', 'dynamic.php?job='+action); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; var update = new Array(); if(response.indexOf('|' != -1)) { update = response.split('|'); document.getElementById(update[0]).innerHTML = update[1]; } } } function emailcheck(form) { /*.form.email.value */ var thing; thing=sndReq(form.email.value); document.myForm.email.value = thing; } </script> <?php echo '<form name="myForm"><B>Enter your Email address :</b><BR> <input type=text name="email" value="" onBlur="emailcheck(this.form)"> <BR></form> '; ?>
  9. I barely know what AJAX is. I do not seem to be able to make this work.
  10. How do I pass two variables from php to java script? I need to call a php page passing data in the url. i.e. myurl.com?data=123 Then The php page needs to return two variables back to the calling javascript.
  11. Ok, I need to read data from a from text field when the user tabs or clicks out of the box then I need to submit that data to a php page and get two returned values from that page then I need to take that data and fill in two of the text fields in the form automatically. Can anyone tell me how to use java script to do this? Example of what I want to happen: User enters name then tabs or clicks to next element in form. Script reads first field then calls php, which searches database for that name. If that name is found the php page will return two other strings like address and phone number. The java script needs to automatically fill in the two text fields, address and phone in the form IF data is returned.
  12. I wanted to list several things in buttons that span the entire frame. The problem is the image of the button splits when the text is to long and making the image wider just causes the ends of the image to disappear. CSS: <style type="text/css"> a.squarebutton{ background: transparent url(\'square-blue-left.gif\') no-repeat top left; display: block; float: left; font: normal 14px Arial; /* Change 12px as desired */ line-height: 15px; /* This value + 4px + 4px (top and bottom padding of SPAN) must equal height of button background (default is 23px) */ height: 23px; /* Height of button background height */ width: 100%; padding-left: 4px; /* Width of left menu image */ text-decoration: none; } a:link.squarebutton, a:visited.squarebutton, a:active.squarebutton{ color: #494949; /*button text color*/ } a.squarebutton span{ background: transparent url(\'square-blue-right2.gif\') repeat top right; display: block; padding: 4px 9px 4px 0; /*Set 9px below to match value of \'padding-left\' value above*/ } a.squarebutton:hover{ /* Hover state CSS */ background-position: bottom left; } a.squarebutton:hover span{ /* Hover state CSS */ background-position: bottom right; color: black; } .buttonwrapper{ /* Container you can use to surround a CSS button to clear float */ overflow: hidden; width: 100%; } </style> PHP: $temp = 'our cool button that is really a link . blah blah blah bla ect ect ect ect ect ect gfd g dfg fksdfasdfsdf asdf sd fsd fsd sdf'; echo ' <div class="buttonwrapper"> <a class="squarebutton" href="http://www.google.com"><span>'.$temp.'</span></a> </div> <div class="buttonwrapper"> <a class="squarebutton" href="#"><span>Submit</span></a> <a class="squarebutton" href="#" style="margin-left: 6px"><span>Reset</span></a> </div>';
  13. It would seem that my sql query was incorrect. I was trying to limit the returned results to 30, but it seems that Idont know how to do that. Removing the LIMIT part of the query lets the immage display.
  14. If I comment out the header() then I can see the image data and it is infact starting with a sql error here are the first 8 lines of the data: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in test.php on line 83 ÿØÿà�JFIF������ÿþ�>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛ�C� $.' ",#(7),01444'9=82<.342ÿÛ�C 2!!22222222222222222222222222222222222222222222222222ÿÀ�4"�ÿÄ����������� ÿÄ�µ���}�!1AQa"q2‘¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ�������� ÿÄ�µ��w�!1AQaq"2B‘¡±Á #3RðbrÑ
  15. I tried moving the header() to the bottom just before the imageJpeg() function. Same error :-\ A command like $number = mysql_num_rows($result) should not output anything to the document.
  16. OK, Im out of hair time to ask. ??? I am making a charting program that draws a chart from data in a myspl database. However, I can not get my data! Everything works fine until I do : while ($row = mysql_fetch_array( $result )) or mysql_num_rows($result) I get the error: The image “test.php” cannot be displayed, because it contains errors. Here is the block of code so far: <?php header ("Content-type: image/png"); $im = @ImageCreate (820, 400) or die ("Cannot Initialize new GD image stream"); $background_color = ImageColorAllocate ($im, 224, 234, 234); $text_color = ImageColorAllocate ($im, 233, 14, 91); $diagramWidth = 800; $diagramHeight = 400; $daysToShow = 30; $indexSpace=38; //38 pixels between index numbers $numDiv=10; //number of index divisions $colorAmmonia= imageColorAllocate($im, 145,150,0); $colorNitrite= imageColorAllocate($im, 223,13,223); $colorPh= imageColorAllocate($im, 153,96,15); $colorFeed= imageColorAllocate($im, 75,232,39); $colorNitrate= imageColorAllocate($im, 240,0,0); $colorTemp= imageColorAllocate($im, 39,39,232); $colorTempAir= imageColorAllocate($im, 147,147,188); $colorFish= imageColorAllocate($im, 155,121,49); $colorFilter= imageColorAllocate($im, 230,200,200); $colorFrame = ImageColorAllocate ($im,0,0,0); // draw graph text--------------------------------------------------------- imageString($im, 4, 0, $diagramHeight - 400, "Ammonia", $colorAmmonia); imageString($im, 4, 0, $diagramHeight - 385, "Nitrite", $colorNitrite ); imageString($im, 4, 0, $diagramHeight - 370, "pH", $colorPh ); imageString($im, 4, 0, $diagramHeight - 355, "Feed", $colorFeed ); imageString($im, 4, 740, $diagramHeight - 400, "Nitrate", $colorNitrate ); imageString($im, 4, 740, $diagramHeight - 385, "Water Temp", $colorTemp ); imageString($im, 4, 740, $diagramHeight - 370, "Air Temp", $colorTempAir ); imageString($im, 4, 740, $diagramHeight - 355, "FishWeight", $colorFish ); imageString($im, 4, 60, $diagramHeight - 28, "0", $colorFrame ); imageString($im, 4, 60, $diagramHeight - 58, "1", $colorFrame ); imageString($im, 4, 60, $diagramHeight - 96, "2", $colorFrame ); imageString($im, 4, 60, $diagramHeight - 134, "3", $colorFrame ); imageString($im, 4, 60, $diagramHeight - 172, "4", $colorFrame ); imageString($im, 4, 60, $diagramHeight - 210, "5", $colorFrame ); imageString($im, 4, 60, $diagramHeight - 248, "6", $colorFrame ); imageString($im, 4, 60, $diagramHeight - 286, "7", $colorFrame ); imageString($im, 4, 60, $diagramHeight - 324, "8", $colorFrame ); imageString($im, 4, 60, $diagramHeight - 362 , "9", $colorFrame ); imageString($im, 4, 714, $diagramHeight - 38, "0", $colorFrame ); imageString($im, 4, 714, $diagramHeight - 76, "47", $colorFrame ); imageString($im, 4, 714, $diagramHeight - 114, "62", $colorFrame ); imageString($im, 4, 714, $diagramHeight - 152, "77", $colorFrame ); imageString($im, 4, 714, $diagramHeight - 190, "92", $colorFrame ); imageString($im, 4, 714, $diagramHeight - 228, "107", $colorFrame ); imageString($im, 4, 714, $diagramHeight - 266, "122", $colorFrame ); imageString($im, 4, 714, $diagramHeight - 304, "137", $colorFrame ); imageString($im, 4, 714, $diagramHeight - 342, "152", $colorFrame ); imageString($im, 4, 714, $diagramHeight - 380, "167", $colorFrame ); imageString($im, 4, 52, $diagramHeight -20 , "Jan 1", $colorFrame ); //draw graph frame-------------------------- imageline ($im,72,0,72,380,$colorFrame); imageline ($im,72,380,710,380,$colorFrame); imageline ($im,710,380,710,0,$colorFrame); //read database--------------------------------------------------------------------------- $user = "x"; $password = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; $database = "datatracker"; $host = "localhost"; $link = mysql_pconnect($host, $user, $password); mysql_select_db("aptracker") or die(mysql_error()); $user=$_GET['user']; if ($_GET['days']){ $daysToShow=$_GET['days']; //default is past 30 days unless specified } $query = "SELECT * FROM data WHERE user='$user' ORDER BY date LIMIT '$daysToShow'"; $result = mysql_query($query); //$number = mysql_num_rows($result); $i=0; while ($row = mysql_fetch_array( $result )) { // ==============DISPLAY ALL RESULTS ++$i; $date[i]=$row['date']; $ph[i]=$row['ph']; $waterTemp[i]=$row['waterTemp']; $airtemp[i]=$row['airTemp']; $ammoni[i]=$row['ammonia']; $nitrite[i]=$row['nitrite']; $nitrate[i]=$row['nitrate']; $feed[i]=$row['feed']; $fish[i]=$row['fish']; $filter[i]=$row['filter'] ; } //end WHILE LOOP ImageJpeg ($im); ?>
  17. ??? I need my header, navigation buttons, and footer to stay put when scrolling. When I set header to not scroll it all falls apart Here is what I have: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <style type="text/css"> html, body { height: 100%; } #container { min-height: 100%; position: relative; } #header { margin:0; padding:0; background-color:gray; color:white; z-index: 3; } #nav { position: absolute; top:37px; float:left; width:100%; float:left; margin:0; padding:0; border-left:1px solid gray; z-index: 3; } #footer { height: 10px; width: 100%; position: absolute; top:59px; margin:0; padding:0; background-color:gray; color:white; z-index: 3; } #content { position: absolute; top:80px; } </style> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <meta name="author" content="Mr ME"> <title>WTF</title> </head> <body> <div id="container"> <div id="header"><h1 class="header">Productivity</h1></div> <div id="nav" align="center"> <input type="submit" name=btn value="A Button"> <input type="submit" name=btn value="Another Button"> <input type="submit" name=btn value="Log Out"> </div> <div id="footer"></div> <div id="content"> This is where the content goes... Will be many many pages of ' stuff ' </div> </div> </body> </html> Looks like I want it at that point, but when I add position:absolute; to the header, nav, and footer it all falls apart... Well to be more clear its all fine until I add it to the header. #header { margin:0; padding:0; background-color:gray; color:white; z-index: 3; position:absolute; }
  18. Wow, ok, I dont understand why thats needed, but hey it works now.. Thanks!
  19. That did not work. It only output <br />
  20. I have used mysql_real_escape_string() on all data that is input and stored in my db. I am using this; in a edit form. <input type="text" size="25" MAXLENGTH="100" name="client'.$i.'" value="'; $client=$row['client']; $client=stripslashes($client); echo $client . '"' . $j . '> Stripslashes() seems to not work. The out put goes to the first \ and stops; showing the first back slash. Ie If the client name is . Then the output is
  21. I need to update every entry in a database table. The problem is that the code stops running after 30 seconds. Is there a way/a command I can use to allow greater execution time? ??? I am updating a value on a great number of entries from one table to another but php times out before its done. Im not out putting anything 'Till the end of the code.
  22. It was an html error. I forgot to add my counter value to the name label of the name attribute..
  23. I have a java script date picker. This works great: <input type=button value="Date" onclick="displayDatePicker(\'Date\', false, \'ymd\', \'-\');">&#160&#160&#160&#160&#160<input size="8" MAXLENGTH="10"name="Date" value="'.$today.'"> This is in a loop that generates a multiple froms; one long form really. Any way I am passing data with the form and because it repeats often I have to change the variables so I can access them in a whil loop later. Running a loop I am changing my vars by adding the counter number to the var name. I.E. the name set in the form is changed from date to date1 ect.. When I change the above code to this: <input type=button value="Date" onclick="displayDatePicker(\'Date\', false, \'ymd\', \'-\');">&#160&#160&#160&#160&#160<input size="8" MAXLENGTH="10"name="Date"'.$n.' value="'.$today.'"> It stops working!! Clicking the date button does nothing when I make that change. What am i doing wrong ??? Why does this break the script?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.