Jump to content

davidz

Members
  • Posts

    45
  • Joined

  • Last visited

    Never

Everything posted by davidz

  1. Yes, that's correct... but you really should be using 4.1 or higher. Yeah, it's actually on our todo list to upgrade both servers to 5. Thanks for the info! David
  2. The two databases are on completely different servers, so doing a dbname.tblname.field in the SELECT will not work. Now correct me if I'm wrong, the FEDERATED tables are basically just aliases to a table on another server? Thanks, David
  3. I'm using PHP5+Mysql 4.0+Apache 2.0. I need to join tables from two different Mysql servers. I've looked everywhere and can't find a for sure yes or no if this is possible. So my question is: Is it possible to join tables using php from two different servers? If yes, how? Thanks! David
  4. I have a master database server that has one slave server replicating. I have a remote office that only has T1 connectivity to the Master DB. So when we get lots going on they complain of slowness, and it is pretty bad. So we are thinking about putting another slave server on their local network, and have that serve the SELECTS and the modifying of data will still have to go to the Master. Anyway, does anyone have any experience doing something like this? Or is there a better way to get data to the remote location (cluster, or something)? How about if the data is changed on the master but has not propagated to the slave, will the user see old data? Any information would be very helpful. I've read all the manuals on replication, but I was hoping for a real world point of view. -David
  5. That must just be some odd quirk with PHP and Javascript. After I moved that to the bottom it works fine. Thanks again for all the help!!! David
  6. I think I figured out my problem. I think the problem is: window.onload = function(){ cellActions(); When this code loads the table is not there. The php is still producing it. So if I put <div onClick="cellActions();">HERE</div> At the bottom somewhere and click on "HERE". Then the highlights start working. So is there some alternative to window.onload that can happen after the page is finished? -David
  7. I just defined the getPropertyData function with no output, and it still worked, so I'll have to try it on my full page. As per the styling, I know it's messy, the page is still pretty early in development. I really need to try and eliminate some of the div/style tags. Just out of curiosity, why is it better to use class definitions rather that inline styling? Thanks, David
  8. Nice!! That seems to work exactly like I need it to. Hopefully now I can make it work with my PHP page that generates all this stuff. I'll reply here tomorrow if I still can't get it to work. Thanks for the help!!! David PS Could it not be working because of other onClick events that I have in this table?
  9. Alright here is a complete HTML page with some of the problems. For some reason after I chopped it up the highlight started working, but with other problems. <!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=utf-8" /> <title>Untitled Document</title> <script type="text/javascript"> function cellActions(){ var rows = document.getElementById('test').getElementsByTagName('tr'); var len = rows.length; function otherCells(idx){ for(var i = 0; i < len; i++){ if(i != idx) rows[i].style.backgroundColor = '#fff'; } } for(var i = 0; i < len; i++){ rows[i].onclick = function(){ otherCells(i); this.style.backgroundColor = '#f00'; }; //now you can add more events like onblur or onmouseover onmouseout rows[i].onmouseover = function(){ //do stuff here }; } } window.onload = function(){ cellActions(); } </script> </head> <body> <div style="overflow:auto; width:745px; height: 250px; padding:0px; margin:0px; border-bottom: 1px black solid; border-top: 1px black solid;"> <table id="test" width=727 class=smalltable border=0 cellpadding=0 cellspacing=0 > <col width=40> <tr id="row1"style="background-color: #FFFFCC;";> <td><a href=# onClick="getPropertyData('1674','8-801');"><img name="View1" border="0" src="images/view.gif"></a></td> <td><a onClick="getPropertyData('1674','8-801');" target=_blank href=view_entry.php?entryID=755671&ref=ef2a2af07e4fb6bc04591ec634c14358>09/20/2007</a></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;">MEDINA SUSANA AND MEDINA DANIEL</div></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;"></div></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;">MORTGAGE ELECTRONIC REGISTRATION SYS INC</div></td> <td><div style="text-align:left;"><a onClick="getPropertyData('1674','8-801');" target=_blank href=view_entry.php?entryID=616079&ref=0f705412a787ccb898f1f3a02a92101c>$212,400</a></div></td> <td> </td> <td> </td> </tr> <tr id="row2"style="background-color: #FFFFFF;";> <td><a href=# onClick="getPropertyData('1673','23');" ><img name="View2" border="0" src="images/view.gif"></a></td> <td><a onClick="getPropertyData('1673','23');" target=_blank href=view_entry.php?entryID=755631&ref=e46e43ce5b37ae05179f22ee3904192a>09/20/2007</a></td> <td><div title="SEWELL BRIAN G" style="width:130px; height:15px; overflow:hidden; text-align:left;">SEWELL BRIAN G</div></td> <td><div title="" style="width:130px; height:15px; overflow:hidden; text-align:left;"></div></td> <td><div title="VILLAGE BANK" style="width:130px; height:15px; overflow:hidden; text-align:left;">VILLAGE BANK</div></td> <td><div style="text-align:left;"><a onClick="getPropertyData('1673','23');" target=_blank href=view_entry.php?entryID=588193&ref=8777aa783706bf5cadcf26625a62435d>$279,175</a></div></td> <td> </td> <td> </td> </tr> <tr id="row3"style="background-color: #FFFFCC;";> <td><a href=# onClick="getPropertyData('1675','HT-35');" ></a></td> <td><a onClick="getPropertyData('1675','HT-35');" target=_blank href=view_entry.php?entryID=755690&ref=e2686ac0d52e120595ddeeed7b2094be>09/20/2007</a></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;">VENSEL DAVID W AND VENSEL HOLLY M</div></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;"></div></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;">ARGENT MTG CO L C</div></td> <td><div style="text-align:left;"><a onClick="getPropertyData('1675','HT-35');" target=_blank href=view_entry.php?entryID=635688&ref=a771d43a021bd04b663728ca12749bca>$156,000</a></div></td> <td> </td> <td> </td> </tr> <tr id="row4"style="background-color: #FFFFFF;";> <td><a href=# onClick="getPropertyData('1666','3-44');"></a></td> <td><a onClick="getPropertyData('1666','3-44');" target=_blank href=view_entry.php?entryID=755515&ref=f994bfb73f4cc74d4c9a29a541063bd4>09/19/2007</a></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;">TOBIN MICHAEL A AND AGUINAGA KATRINA F</div></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;"></div></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;">WELLS FARGO BANK</div></td> <td><div style="text-align:left;"><a onClick="getPropertyData('1666','3-44');" target=_blank href=view_entry.php?entryID=626398&ref=32ef9f1a28fc9c2c2e3dd18eba81c4db>$144,000</a></div></td> <td> </td> <td> </td> </tr> <tr id="row5"style="background-color: #FFFFCC;";> <td><a href=# onClick="getPropertyData('1663','9-4242');"><img name="View5" border="0" src="images/view.gif"></a></td> <td><a onClick="getPropertyData('1663','9-4242');" target=_blank href=view_entry.php?entryID=755487&ref=57627f362517aa6d6c7439619d8c6561>09/19/2007</a></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;"></div></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;"></div></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;"></div></td> <td> </td> <td> </td> <td> </td> </tr> <tr id="row6"style="background-color: #FFFFFF;";> <td><a href=# onClick="getPropertyData('1665','1-3');"><img name="View6" border="0" src="images/view.gif"></a></td> <td><a onClick="getPropertyData('1665','1-3');" target=_blank href=view_entry.php?entryID=755513&ref=c35e11ccf2f747287a23bddf4cdb1ee5>09/19/2007</a></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;">HIGGINS R DAMEON</div></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;"></div></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;">MORTGAGE ELECTRONIC REGISTRATION SYS INC</div></td> <td><div style="text-align:left;"><a onClick="getPropertyData('1665','1-3');" target=_blank href=view_entry.php?entryID=545298&ref=775d766c29aafb880b83f856714c2f12>$228,000</a></div></td> <td> </td> <td> </td> </tr> <tr id="row7"style="background-color: #FFFFCC;";> <td><a href=# onClick="getPropertyData('1667','AUG-5');"><img name="View7" border="0" src="images/view.gif"></a></td> <td><a onClick="getPropertyData('1667','AUG-5');" target=_blank href=view_entry.php?entryID=755526&ref=5cd116fb1e6a913eded19577df7f153b>09/19/2007</a></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;">HANSEN DAVID J</div></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;"></div></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;">MORTGAGE ELECTRONIC REG SYS INC</div></td> <td><div style="text-align:left;"><a onClick="getPropertyData('1667','AUG-5');" target=_blank href=view_entry.php?entryID=665151&ref=f6930d6be76a0cc1a523f84e77b3d7a8>$412,000</a></div></td> <td> </td> <td> </td> </tr> <tr id="row8"style="background-color: #FFFFFF;";> <td><a href=# onClick="getPropertyData('1664','PSE-15');"><img name="View8" border="0" src="images/view.gif"></a></td> <td><a onClick="getPropertyData('1664','PSE-15');" target=_blank href=view_entry.php?entryID=755501&ref=9d3991d20ea4a6da3e3c536e398412b6>09/19/2007</a></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;"></div></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;"></div></td> <td><div style="width:130px; height:15px; overflow:hidden; text-align:left;"></div></td> <td> </td> <td> </td> <td> </td> </tr> </table> </div> </body> </html>
  10. Thank for the great example. But my JavaScript abilities are pretty bad, and I can't seem to make it work. If I just copy and paste your code into a new HTML file it works fine. But it won't integrate with my current code. Now my table has div's and styles and other stuff in the <TD> tags. Are these going to cause problems? I can't seem to find why I get absolutely nothing. David
  11. I have a simple Javascript that changes the background color of the table row you click on and then switches it back when you click on a different one. Here is the relevant code: <script language="JavaScript"> function toggle(x,origColor){ var newColor = 'red'; if ( x.style ) { x.style.backgroundColor = (newColor == x.style.backgroundColor)? origColor : newColor; } } </script> And the relevant HTML: <table width=700 border=0 cellpadding=0 cellspacing=0 > <tr id='1' style="background-color: #FFFFCC> <td> <a href=# onFocus="toggle(document.getElementById('1'),'#FFFFCC');" onBlur="toggle(document.getElementById('1'),'#FFFFCC');"> <img name="View1" border="0" src="images/view.gif"> </a> </td> </tr> <tr id='2' style="background-color: #FFFFFF> <td> <a href=# onFocus="toggle(document.getElementById('2'),'#FFFFCC');" onBlur="toggle(document.getElementById('2'),'#FFFFCC');"> <img name="View2" border="0" src="images/view.gif"> </a> </td> </tr> <tr id='3' style="background-color: #FFFFCC> <td> <a href=# onFocus="toggle(document.getElementById('3'),'#FFFFCC');" onBlur="toggle(document.getElementById('3'),'#FFFFCC');"> <img name="View3" border="0" src="images/view.gif"> </a> </td> </tr> </table> This repeates for several hundred rows (PHP+MySQL). So my problem is not with the above code, it works perfect. But in my javascript I am using the alternate color as "red". If I try and use something like "#FFFF00" it breaks it. Any suggestions? David
  12. Ok, so is there a difference (following good programming practice) in either one of these? <?php if (isset($_SESSION['username']) == True){ echo "Yes it was set" } ?> <?php if (isset($_SESSION['username'])){ echo "Yes it was set" } ?> Or these: <?php if (isset($_SESSION['username']) == False){ echo "No it was not set" } ?> <?php if (!isset($_SESSION['username'])){ echo "No it was not set" } ?> Thanks, David
  13. My question if more of a "good practice" type of thing. Let say I have a session variable $_SESSION['username']. And I want to display some text based upon the fact that this variable exists. So if I do this: <?php if ($_SESSION['username'] == 'bob@domain.com') { echo "Hello World"; } ?> When I do this, I get PHP Notice: Undefined index: username in my log messages. Now granted this is just a notice and not an error. So, my question is, is there anything wrong with this? Or is it really necessary to do checks like isset()?? Thanks, David
  14. Maybe this? http://us3.php.net/manual/en/function.include.php Look at example 16.7. Beware security problems...
  15. Perhaps this: http://us.php.net/system
  16. For anybody that cares I found the problem. It was treating my variable as a number not a string so it was trying to do math and dropped the leading zeros. This line: $tabledata .= "<td><a href=# onClick=\"getPropertyData('$row[iD]','$row[TaxID]',$accountnum);\"><img name=\"View$a\" border=\"0\" src=\"images/view.gif\"></a></td>"; Needs '' around the $accountnum Like: $tabledata .= "<td><a href=# onClick=\"getPropertyData('$row[iD]','$row[TaxID]','$accountnum');\"><img name=\"View$a\" border=\"0\" src=\"images/view.gif\"></a></td>"; Thanks! David
  17. I have a page that gets created with PHP+MySQL. Then I have some javascript/ajax elements as well. My problem is I am losing the leading zeros on a variable. Here is where PHP builds the onClick: $tabledata .= "<td><a href=# onClick=\"getPropertyData('$row[iD]','$row[TaxID]',$accountnum);\"><img name=\"View$a\" border=\"0\" src=\"images/view.gif\"></a></td>"; The one with the problem is the third variable ($accountnum). This value is normally something like 0029754 or 0689871, etc. Now this part of the page is being created fine. Look at the source code for the completed page: <td><a href=# onClick="getPropertyData('716','SG-FORR-35',0503006);"><img name="View3" border="0" src="images/view.gif"></a></td> Now here is the Javascript for the onClick: function getPropertyData(ID,TaxID,AccountNum) { var HouseImage = getHouseImage(AccountNum) } function getHouseImage(AccountNum) { // Make the XMLHttpRequest object var http = createRequestObject(); var HouseImage; // Open PHP script for requests http.open("GET", "defaultpropertyprocessing.php?Section=HouseImage&AccountNum="+AccountNum, true); http.onreadystatechange = function(){ if(http.readyState == 4 && http.status == 200){ // Text returned FROM the PHP script var response = http.responseText; if(response) { // UPDATE ajaxTest content HouseImage = response; document.getElementById("HouseImage").innerHTML = HouseImage; } } } http.send(null); } I think it is the http.open that is messing it up. I can use DOM Inspector for FireFox and see the link that is being created to GET data from the PHP page. http://www.signingservices.net/defaultpropertyprocessing.php?Section=HouseImage&AccountNum=29754 Where am I losing my zeros? Thanks! David
  18. So for example, checking to make sure that in a box where only numeric values are valid, make sure they only put in numbers?
  19. Just wondering if there is an easier way to run mysql_real_escape_string on a large POST. We have a form with 20+ text boxes and I don't want to have to run it on each one individually. Any suggestions? Thanks, David
  20. I have a php page that gets a bunch of stuff out of a Database. All this works great! We have recently added two simple image browser/selector. What I need to be able to do is pass the value of a hidden input field over to another page. I will post the relevant code below: //Start Form <form name=Profile method=POST action=profile.php> //Get house image references from Database $connection = mysql_connect("192.168.100.230", "statsdb", "password") or die(mysql_error()); $db = mysql_select_db("NewStats", $connection) or die(mysql_error()); $Housesql = "SELECT AccountNum, ImageType, ImageNum, BaseDir, FileName, CountyID, FileDT, ID FROM taxrollImages WHERE ImageType = 'Photo' AND AccountNum = '$accountnum' AND CountyID = '4' ORDER BY FileDT ASC"; $Houseresult = mysql_query($Housesql, $connection) or die(mysql_error()); //Start the javascript stuff for multiple images $houseimage = "<div style=\"width: 284px; height: 192px;\">"; //Loop through results and build the HTML for the image selection while($Houserow = mysql_fetch_row ($Houseresult)){ //remove windows directory stuff from path $path_to_image = substr($Houserow['3'], 3); $path_to_image = str_replace('\\','/',$path_to_image); $image_file_name = $Houserow['4']; //Mount point to images $houseimageFile = "images/AccountImages/" . $path_to_image . $image_file_name; $houseimage .= " <p class=virtualpage2> <input type=hidden name=IID value=$Houserow[7]> <img src=$houseimageFile width=284 height=192> </p>"; } //Initialize the Javascript $houseimage .= " <div id=scriptspaginate class=paginationstyle style=\"width: 284px\"> <a href=\"#\" rel=previous>Prev</a> <span class=paginateinfo style=\"margin: 0 30px; font-weight: bold\"></span> <a href=\"#\" rel=next>Next</a> </div> <script type=\"text/javascript\"> var newscripts=new virtualpaginate(\"virtualpage2\", 1, \"p\") newscripts.buildpagination(\"scriptspaginate\") </script>"; //This code gets repeated again with a new query and variables etc. For a second set of images. //submit button for stuff <input type=submit name=ProfileSubmit value='Property Profile'> //close form </form> So when I hit the submit button the next page only gets the results of the last item created. Which can easily been see from the final output (View Source). <div style="width: 284px; height: 192px;"> <p class=virtualpage2> <input type=hidden name=IID value=52> <img src=images/AccountImages/AssessorNew/Photo/Photo1/0000698011.JPG width=284 height=192> </p> <p class=virtualpage2> <input type=hidden name=IID value=53> <img src=images/AccountImages/AssessorNew/Photo/Photo1/0000698021.JPG width=284 height=192> </p> <p class=virtualpage2> <input type=hidden name=IID value=54> <img src=images/AccountImages/AssessorNew/Photo/Photo1/0000698031.JPG width=284 height=192> </p> <p class=virtualpage2> <input type=hidden name=IID value=55> <img src=images/AccountImages/AssessorNew/Photo/Photo1/0000698041.JPG width=284 height=192> </p> <div id=scriptspaginate class=paginationstyle style="width: 284px"> <a href="#" rel=previous>Prev</a> <span class=paginateinfo style="margin: 0 30px; font-weight: bold"></span> <a href="#" rel=next>Next</a> </div> <script type="text/javascript"> var newscripts=new virtualpaginate("virtualpage2", 1, "p") newscripts.buildpagination("scriptspaginate") </script> After all that... What I need to do is when I click the button I need it to know which image I am on so I can get the right ID number from the html tags. Here is the page I got the image browser from: http://www.dynamicdrive.com/dynamicindex17/virtualpagination.htm The one we are using is on the right hand side, second one down. Thanks! PS Sorry if this is confusing, the total code for the page is over 1500 lines so I did not want to post the whole thing.
  21. Here's a little about our setup: Dual Processor Xeon 3.0ghz 2.5 gigs DDR2 533mhz EEC Registered Dual Channel 2 - 74gig UltraWide320 10k RPM SCSI setup in RAID 1 This server runs 5 or 6 Databases. Most are small in size (<250 megs). Two are larger with one is about 4 gigs with around 11 millions rows in the largest table. Here is the my.cnf [mysqld] log-bin server-id=1 datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock set-variable=max_connections=250 set-variable=max_allowed_packet=32M set-variable=query_cache_size=64M set-variable=query_cache_limit=3M set-variable=key_buffer_size=512M set-variable=table_cache=500 set-variable=tmp_table_size=128M # Default to using old password format for compatibility with mysql 3.x # clients (those using the mysqlclient10 compatibility package). old_passwords=1 [mysql.server] user=mysql basedir=/var/lib [mysqld_safe] err-log=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid The key point are the set-variable lines. I'll go through them explaining what I know briefly. set-variable=max_connections=250 Obvious. How many simultaneous connections. set-variable=max_allowed_packet=32M Largest size allowed per SQL statement. We increased this so we could insert full email body including attachments into database. We don't get email bigger than 15 megs so 32 seemed ok. Don't forget to include some extra for overhead of query. set-variable=query_cache_size=64M Size available to the query cache. If you don't know what the query cache is reply and I can explain briefly or look it up on google. Helps a ton! set-variable=query_cache_limit=3M Largest size of query that can be put into the query cache. set-variable=key_buffer_size=512M Extremely important! The amount of RAM given to mysql to store your indicies. The default I think is only 8 megs! So if you look at all your DB's and Tables and find out how big all of your indicies are this is how much you would put here. This is not always realistic so we added up the indicies for all the tables that get used alot and came up with around 400 megs. We are still playing with this as the server has 2.5 gigs available we might increase if the buffer is filling up. set-variable=table_cache=500 Home many tables to hold "open" in memory. Default is like 16. :-( I think that I saw somewhere that the recommended number is (number of max connections) * 'N'. Where 'N' is the largest number of joins that you have in a query. So if you have a query that has 5 joins and you have a max connections at 50 you should have table_cache at 250. We are still tweaking this. Started at 300 and it filled up fast so we increased to 500. We'll see how it goes. set-variable=tmp_table_size=128M Max size for temp tables. Once mysql needs a tmp table bigger that this setting it creates it on disk. We are still working on this one as well. So those are some of the major changes we've made recently with massive performance increases!! --David
  22. Thanks for the pointers. I looked all through that link you provided and found lots of good stuff. Even if not for large databases specifically. Mostly about performance tunning. I never realized that MySQL "out-of-the-box" has such horrible performance settings (obviously designed for compatibility). I wrongly assumed that it was automatic enough to use what ever ram the system had available for it. But now that I've been educated I think that this is a point that often gets missed by newbies (like myself). You have to manually go in and change several variables to get decent performance from your server. I found out that MySQL was only using like <32 megs total ram ever. What a complete waste of our Dual Xeon 3.0ghz servers with 3 gigs of ECC ram!!! So now its setup to use over a gig. And I'll watch it very closely over the next few days to increase the buffers that need it. I'd be happy to share the settings I changed for an instant performance increase if anyone is following this thread... David
  23. I am looking for some one that has experience with large tables in MySQL. As in >10-20 gigs and up to say 200 gigs. We are going to start archiving all of our email into a MySQL database. Using PERL and PHP we've already got the system working, but doing the math we are looking at about 3-4 gigs of email each week. None of us here have any experience working with MySQL on this large of a scale. We have tables now that are in the 1 gig range, but not nearly as big as this email thing is going to be. So, can anyone give me some advice on how to handle these tables, realistic size limits of MySQL, etc. Thanks!!! David
  24. Not quite sure what the goal is here. Are you trying to say to show results where ActivityID is 33 and if there are no results to show everything? Side note: '*' is a wildcard is microsoft, in mySQL '%' means the same
×
×
  • 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.