
markjoe
Members-
Posts
226 -
Joined
-
Last visited
Never
Everything posted by markjoe
-
I have a PHP script that build 3 arrays from SQL queries. A table is built with the header built from 1 array, the rows labeled with the second array and the table filled in with a binary value show weather the combination exists. This may explain it better: echo "<tr>"; foreach($A1 as $x1){ echo "<th>$x1</th>"; } echo "</tr>"; foreach($A2 as $x2){ echo "<tr>"; echo "<td>$x2</td>"; if(in_array($x1.$x2, $A3)){ echo "<td>X</td>"; }else{ echo "<td> </td>; } echo "</tr>"; } Basically, its graphing out what services are available in what areas. The Problem: I am trying to re-create this in ASP.NET 3.5. I keep seeing people poo-pooing Response.Write. Is there a good way to build the table manually like this, or is there a "control" that would apply to this?
-
Thanks for the info. I guess in most cases I am using tables and divs correctly then, other than that one index page I don't want to re-do. I do sometimes have a tendancy to fall back on tables rather quickly when I have I don't get the results I want in CSS right away (hangs head in shame).
-
I have seen randomly on the web people saying "never use tables for layout!". Trouble is they never seem to go into any reasoning. I have pages with a table-like layout with tables and some with divs. Either seem to work fine. (actually I find that sometimes using tables is quicker and easier, mostly report-type pages) Question is, does anybody know any actual reason(s) to not use tables for basic layout? Keep in mind that when I use tables, it is plain table, tr, td elements with CSS (not using the deprecated attributes).
-
So does Box 1 go off page when user scrolls down the page and boxes 2,3 and 4 stay put always? Or the other way around? Either way, it should all be possible with fixed positioning. Unfortunately, IE 6 does not support fixed positioning, and there is no good workaround. http://w3schools.com/css/css_positioning.asp
-
Well, i see Maq just posted it but here's mine anyway. How about: <?php if(SUCCESS){ echo "<script type='text/javascript'>window.location.href='gotopage.php'</script>"; } ?> You could even use setTimeout() to add a count down or delay so they have a chance to see the message first.
-
You should change which ever end you feel more comfortable coding (PHP or JavaScript). What function are you using to fetch results, mysql_fetch_row() or mysql_fetch_assoc()? In order to make this work properly, you must use mysql_fetch_assoc(), so that you can pass the column names on properly.
-
The input tag IDs were wrong, (missing the 'Tag' part of the name). ajax.php was not quoted in open(). Changed to .value instead of the very wrong .innerHTML (that is for DIV, TD, etc tags) Added a check for the last always blank value of allData array. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Untitled Document</title> <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxRequest(){ var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken) for (var i=0; i<activexmodes.length; i++){ try{ return new ActiveXObject(activexmodes[i]) } catch(e){ //suppress error } } } else if (window.XMLHttpRequest) // if Mozilla, Safari etc return new XMLHttpRequest() else return false } //--> </script> </head> <body> <script language="javascript" type="text/javascript"> function ajaxpost(){ var X=new ajaxRequest(); X.open('get','ajax.php'); X.onreadystatechange=function(){ if(X.readyState==4 && X.responseText){ var allRows=X.responseText.split("~"); for(var i=0; i<allRows.length; i++){ if(allRows[i]){ var allFields=allRows[i].split("|"); for(var j=0; j<allFields.length; j++){ var oneField=allFields[j].split("^"); document.getElementById(oneField[0]+'Tag').value+=oneField[1]; } } } } }; X.send(null); } //--> </script> <form id="form1" name="form1" method="post" action=""> <input type="text" name="1" id="1Tag" /> <br /> <input type="text" name="2" id="2Tag" /> <input type="button" name="button" id="button" value="Load" onClick="ajaxpost();" /> </form> <br /> </body> </html>
-
Woops, i used input tags and innerHTML, Booo. .innerHTML should be .value I'll try to take a closer look in a bit.
-
I may have an example to show, if I can find it at home. Let's see if I can make one up on the fly for now. This will be very minimal as I assume you already know how to set a query based on $_GET input, and similar basic tasks. php: <?php $R=mysql_query("select * from my_data"); while($D=mysql_fetch_assoc($R)){ echo "datum1^".$D['datum1']."|datum2^".$D['datum2']."~"; } ?> JavaScript: var X=new XMLHttpRequest(); X.open('get',page.php?var1='+val1); X.onreadystatechange=function(){ if(X.readyState==4 && X.responseText){ var allRows=X.responseText.split("~"); for(var i=0; i<allRows.length; i++){ var allFields=allRows[i].split("|"); for(var j=0; j<allFields.length; j++){ var oneField=allFields[j].split("^"); document.getElementById(oneField[0]+'Tag').innerHTML+=oneField[1]; } } } }; X.send(null); HTML: <input type='text' id='datum1Tag' /> <input type='text' id='datum2Tag' /> I have used this method a few times, and it has worked fine so far. I believe this may be basically what JSON is doing, but I have yet to look into JSON. My opinion on ExtJS is that you may have an easier time building from scratch rather than understanding their API. I had to maintain an Intranet tool that used it and I hated it entirely.
-
If you take care in naming your fields in the data base and html page, this should be fairly easy. In the readystatechange handler, you can use the data passed form PHP to update the elements in the page. So PHP returns the name and value of each database field. Javascript uses the name to address the proper HTML element and update it with it's data. I not sure if I'm explaining well enough...
-
Pretty much any decent code editor should be able to do a multi-file find and replace. I use Crimson Editor, it can do it accross all open files. Maybe a different editor can do it without opening the file first in the GUI? But, you want to add text, not replace text... If your files are consistent, you may be able to try something like find "<?php" replace with "<?php\n/* copyright info blah blah */\n" At least thats my second thought, the first was just write a little script to do it.
-
heh, I didn't really think that one through did I? IIS is using php5ISAPI.dll, Apache is using php5apache2_2.dll. It's installed and running fine. Thanks for the response and sorry for the dumb question.
-
Does anybody know if I will run into problems running IIS and Apache (different ports) both using the same PHP module? It's a long story, but I'm trying to bridge a gap and will need both running PHP for a while.
-
http://us.php.net/manual/en/function.preg-match.php preg_match("/category=(.*)\b/", $stringVar, $matches); $matches[1]; $matches[1] will be "Lighting" This is off the top of my head (not sure if I used word boundry right), but there is the man page link also. It's at least a start.
-
When a page interacts with the file system to upload a file, it using using the HTML input tag of type "file". This interaction is rather restricted for obvious security reasons. As already stated, JAVA can run a client side app that can access the file system. If you are running page on localhost, I believe you can link to the file directly, "C:\path\file.txt". This will still open with iexplorer.exe, not explorer.exe. Although, the funcitonality of iexplorer and explorer is nearly identical (if not completly identical). (explorer.exe is the file browser you see anytime you double click a folder on Windows.)
-
[SOLVED] How to MAKE the query string show up in the address bar?
markjoe replied to sd9sd's topic in PHP Coding Help
The POST method passes the values in the headers, you will never see them in the address bar. The GET method passes the values in the URL (address bar), you will always see them in the address bar. When you access the variable, you must the corresponding name. <form method="GET"> ... $var1=$_GET['var1'] -
[SOLVED] How to MAKE the query string show up in the address bar?
markjoe replied to sd9sd's topic in PHP Coding Help
use GET method, not POST method. <form method='GET' name...> -
[SOLVED] [Bash] error, but seems to work anyway?
markjoe replied to markjoe's topic in Other Programming Languages
That did it, thanks alot. I thought the backticks would bring the returned code into the conditional. -
Here is the piece of code in question. if [ `rm "/raid/$purgeFile.mpg"` -eq 0 ] then echo "Deleted $purgeFile.mpg" else echo "Unable to Delete $purgeFile.mpg" fi I get an error stating: "Unary operator expected", and the else branch runs. Yet, the files seem to be deleted. I only say 'seem to be', because I did not confirm the files where there in the first place. But the list this is running through is way longer than the echos I get from the script, and if I run it again, I get nothing back. Do I have a simple syntax problem here? Obviously, I'm not Super Bash Guy here. Running on HP's Tru64 UNIX.
-
[SOLVED] AJAX works in all browsers but firefox...
markjoe replied to therealwesfoster's topic in Javascript Help
Error: syntax error Source File: http://atlantasyoungfaces.com/ajax/submit.php Line: 1, Column: 1 Source Code: Please select a gender^ -
Here, this is the best I can throw together off the top of my head. I am currently without my development laptop and books. I only checked in Firefox, I tried to get some IE stuff in there, just can't test it in IE right now. This is by no means perfect, but it's a start. Usually I put a table in the div to shade the first row as the drag bar, float an image in the bar as the close button, and such. When using a table to make a pseudo-window, I find it best to include "border-collapse:collapse" in the CSS/style. <script type="text/javascript"> function grab(e){ if(!e){ var e=window.event; } handle=e.target || event.srcElement; Xoffset=e.clientX-getOffsetLeft(handle); Yoffset=e.clientY-getOffsetTop(handle); document.body.style.cursor='move'; document.body.onmousemove=drag; document.body.onmouseup=drop; } function drag(e){ if(handle){ var X=e.pageX || event.pageX; var Y=e.clientY || event.clientY; handle.style.left=(X-Xoffset); handle.style.top=(Y-Yoffset); } } function drop(){ handle=null; document.body.onmousemove=null; document.body.onmouseup=null; document.body.style.cursor='auto'; } function getOffsetTop(theElement){ theOffset=0; while(theElement!=null){theOffset+=theElement.offsetTop;theElement=theElement.offsetParent} return theOffset; } function getOffsetLeft(theElement){ theOffset=0; while(theElement!=null){theOffset+=theElement.offsetLeft;theElement=theElement.offsetParent} return theOffset; } </script> <html> <body style="width:95%;height:95%;"> <div id="B1" onmousedown="grab(event)" style="position:absolute;left:300;top:200;width:200;height:300;z-index:9;border-style:solid;border-width:10px 2px 2px 2px;border-color:#444444;"> <div style="float:right;cursor:pointer;" onclick="document.getElementById('B1').style.display='none;'">close</div> </div> </body> </html>
-
[SOLVED] AJAX works in all browsers but firefox...
markjoe replied to therealwesfoster's topic in Javascript Help
FF 2.0.0.14, WinXP Pro SP2. I actually having a hard time getting the errors, since the search keeps crashing my Firefox completely. I was almost sure I saw 2 or 3 errors one time before it crashed, now all I get is this: Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://atlantasyoungfaces.com/ajax/init.js :: submitSearch :: line 77" data: no] That doesn't tell much other than it failed on the send. I've had some wierd problems with POSTing before, I try to keep it to GET or I use a popunder window, POST a form to it then close it. (But I can get away with telling everybody to allow popups form that server on my Intranet site) -
The most important key to start with is CSS: "position:absolute;". <div id="B1" style="position:absolute;left:300;top:200;width:200;height:300;z-index:9;border-style:solid;border-width:10px 2px 2px 2px;border-color:solid #444444;">Some content</div> The left, top, width and height will give you complete control of the box and can be manipulated with Javascript. Z-index is the 'stacking' order of the various elements on the page. Where you go from there depends on if you want the boxes moveable, how many boxes will be open at once and how they fit into the rest of the page. Keep in mind that a simple DIV box will NOT cover a drop down menu in IE6 (I think IE7 also). For that you need to use an iframe. For just about eveything you need to know about CSS try this place: http://w3schools.com/.
-
Here's my untested guess... preg_match("/\((\d{3})\)(\d{3}-\d{4})/",$input, $regex); $areaCode=$regex[1]; $phoneNumber=$regex[2];
-
There situations that flat files are just fine and even easier, they are just few and far between. I needed to make an ultra simple web front end for our FTP server (upload+download). So i wrote about 20 lines of HTML+PHP and used a date/time algorithm for the password instead of installing an SQL database just for one username and password. Flat file would have worked just as well, I just went one step even lazier.