Jump to content

phil88

Members
  • Posts

    111
  • Joined

  • Last visited

    Never

Everything posted by phil88

  1. echo "</td><td align='center' valign='center'>"; echo "<input name='FirstName".$counter."' type='text' size='15' maxlength='7'>"; echo "</td><td align='center' valign='center'>"; echo "<input name='LastName".$counter."' type='text' size='15' maxlength='7'>"; echo "</td></tr>"; Should do it.
  2. I need to use memory_get_peak_usage(), but it's only available in PHP versions > 5.2.0 and I have 5.0.4. I can't use memory_get_usage() either because PHP wasn't compiled with --enable-memory-limit. So, because of this...I'm stuck. Does anybody know of an alternative implementation of either function that would work on my set up? There's no way for me to upgrade PHP or recompile it, I'm stuck with this environment unfortunately. Bit of useful info; PHP 5.0.4, not compiled with --enable-memory-limit Windows XP I'm guessing that I'm going to need to use exec(), but the examples in the comments on php.net don't seem to be working.
  3. What HTML have you got for the form itself?
  4. From www.php.net/mysql_close : So no, generally speaking, you don't need to explicitly close a mysql connection.
  5. Forms need to submit to somewhere - they can't figure out for themselves where they're meant to send the data. In the <form> tag, you need a action='somefile.php' attribute to tell the web browser where to submit that form's data to. Then, in that 'somefile.php', you deal with the data that has been sent to it. You can make a form submit to the same file as itself, but to start with, I'd suggest reading up on HTML forms and getting them to submit to a separate PHP file.
  6. The main problem as far as efficiency goes with your code is that you have a loop inside a loop inside a loop. Think of it like this; Loop a goes around 10 times Loop b goes around 5 times Loop c goes around 10 times //code End loop c End loop b End Loop a Those loops will be run through a total of 500 times despite the small number in each loop's stop condition. Adding 1 to the number of times any one of those loops will cause the total number of times the code is executed to rocket. Loops inside loops should be avoided where possible and loops inside loops that are inside loops should definitely be avoided - but unfortunately, it's not always possible. As far as your code goes: I have no idea what your code is supposed to do, so I can't really advise as to how to make your code more efficient.
  7. You can't just include parts of a single file. I'd recommend breaking the file up into smaller files that you can include as and when you want. For example, /config/db.php = All the database configuration variables and functions /config/user.php = All the user specific configuration variables and functions etc.
  8. It could be because you are still using PHP short tags. Instead of using <? to start a PHP code section, use the full tag <?PHP
  9. <?php include "php_includes/functions.php" ; ?> <!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" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>Default : Default</title> <link rel="stylesheet" type="text/css" href="/css/main.css" /> <?php if($_GET["s"]=="solutions" || $_GET["s"]=="highvolume" || $_GET["s"]=="largeformat" || $_GET["s"]=="orderform"){ include "php_includes/solutions_subnav.php" ; } ?> </head> <body style="margin:0px; background-image:url(img/background_middle.gif); background-repeat:repeat-y; background-position:center;"> <div align="center"> <table width="100%" align="center" cellpadding="0" cellspacing="0" border="0" style="background-image:url(img/background_table.gif); background-repeat:no-repeat; background-position:center top; margin:0px; padding:0px;"> <tr> <td> </td> <td width="760" align="center" valign="top" style="width:760px;" id="column_top_center"> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="760" height="235" id="navigation" align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="/swf/navigation.swf" /> <param name="menu" value="false" /> <param name="quality" value="high" /> <param name="scale" value="exactfit" /> <param name="bgcolor" value="#ffffff" /> <embed src="swf/navigation.swf" menu="false" quality="high" scale="exactfit" bgcolor="#ffffff" width="760" height="235" name="navigation" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object> </td> <td> </td> </tr> <tr> <td> </td> <td width="760" style="width:760px;" id="column_content_center"> <div class="content"> <table width="730" style="width:730px;" cellpadding="0" cellspacing="0" border="0"> <tr> <td valign="top" align="center" width="260" style="width:260px; padding-right:35px;"> <?php if(!$_GET["s"]) { include "php_includes/left_home.php" ; } else if($_GET["s"]=="approach") { include "php_includes/left_approach.php" ; } else if($_GET["s"]=="imaging") { include "php_includes/left_imaging.php" ; } else if($_GET["s"]=="home") { include "php_includes/left_home.php" ; } else if($_GET["s"]=="ediscovery") { include "php_includes/left_ediscovery.php" ; } else if($_GET["s"]=="contact") { include "php_includes/left_contact.php" ; } else if($_GET["s"]=="solutions") { include "php_includes/left_solutions.php" ; } else if($_GET["s"]=="highvolume") { include "php_includes/left_solutions_highvolume.php" ; } else if($_GET["s"]=="largeformat") { include "php_includes/left_solutions_largeformat.php" ; } else if($_GET["s"]=="orderform") { include "php_includes/left_solutions_orderform.php" ; } ?> <!-- <img src="img/section/home.gif" border="0" alt="" /> <br /><br /> <img src="img/_home/printer_01.jpg" border="0" alt="" /> <div style="width:259px; height:1px;"></div>--> </td> <td valign="top" width="435" style="width:435px;" align="left"> <div style="width:435px; height:<?php if($_GET["s"]) { echo section_height($_GET["s"]) ; } else { echo section_height("home"); } ?>;" class="content_frame"> <?php if($_GET["s"]){ include "content/" . $_GET["s"] . ".php" ; } else { include "content/home.php" ; } ?> </div> </td> </tr> </table> </div> </td> <td> </td> </tr> <tr> <td> </td> <td align="center" width="760" style="width:760px;" id="column_bottom_center"> <div style="padding-top:5px;"> <a href="index.php?s=home">Home</a> | <a href="index.php?s=approach">Our Approach</a> | <a href="index.php?s=solutions">Documents Solutions</a> | <a href="index.php?s=imaging">Document Imaging</a> | <a href="index.php?s=ediscovery">eDiscovery Services</a> | <a href="index.php?s=contact">Contact Us</a> </div> <div style="width:700px; padding:5px 0px 15px 0px;"> <a href="index.php?s=solutions">Confidential Document Solutions</a> | <a href="index.php?s=highvolume">High Volume Printing</a> | <a href="index.php?s=largeformat">Large Format (Color & BW) Printing and Mounting</a> | <a href="index.php?s=orderform">PDF Order</a> </div> </td> <td> </td> </tr> </table> </div> </body> </html> Might do it. Totally untested. I assumed it's because your code was using the depreciated $HTTP_GET_VARS rather than the newer way, $_GET. There might be other things in your code that are stopping it from working too, but that's what jumped out at me, so give the new code a go and see what happens.
  10. I think iarp may have misread your post, I don't think <hr> is what you need (unless I've misread your post ) Instead of; <td width='85%' colspan='3'><textarea name='msgtext' cols='53' rows='7'><?php echo ($_GET['reply'] != "") ? " \n ------------------------------------------------------------------------------------------------------ \n ".$worked2['msgtext'] : ""; ?></textarea></td> Have: <td width='85%' colspan='3'><textarea name='msgtext' cols='53' rows='7'><?php echo ($_GET['reply'] != "") ? "<br><br>".$worked2['msgtext'] : ""; ?></textarea></td>
  11. I can't remember exactly what mysql_fetch_array() does, I tend to use mysql_fetch_assoc() in situations similar to what you're trying to achieve. I'm not entirely sure what you're trying to achieve in the first part of code you posted with the raw HTML and various other bits of code mish-mashed all over the place. But the second bit of code you posted should do what you want it to do assuming that $rowss['player_id'] contains what you're expecting and that a database connection has been set up before the query is made. Also, you might want to put the echo <table....> line before the while loop, and the echo </table> line after the closing } of the while loop. Otherwise, those tags are going to be repeated for every row - giving you lots of tables that only contain 1 row, instead of 1 table that contains a lot of rows.
  12. I was more thinking of compiling straight to binary rather than byte code - but the same principle applies to both.
  13. A way to do it that I can think of would be to write a PHP compiler that compiles PHP code into binary/assembly that can be executed without the need for the PHP interpreter. This way, the source, plain-text files wouldn't need to be on the server as the compiled code could be executed rather than the source-code being interpreted. Of course, writing a PHP compiler would be a ridiculous task - if it's even realistically possible. There might even be compilers available on the internet somewhere. I neither know nor particularly care. If you're going through that much effort, you're using the wrong programming language. Use a language that is meant to be compiled rather than interpreted. Actually, I just did a quick google. It would seem that there is indeed a relatively reliable PHP Compiler out there. Give that a look.
  14. It would have happened sooner, I was just looking for the button to do it Hiding it down the bottom on it's own where it's not noticeable seems a bit odd to me.
  15. Thanks for the info. I managed to do a bit of a botched fix. Because the only thing that changes from :active to :visited is the border, I just used javascript to set the CSS to border:0; after the AJAX has generated the page. Not ideal, but it works.
  16. Still no luck. I was sceptical of your second suggest because it's handling all the pseudo classes fine (including :hover), it's just not reverting to using :link or :visited when the link is no longer :active, but I tried it anyway. I've uploaded what I have so far, so you can see exactly what I mean. You can view it here. Click on the main navigation links in the top right of the page using IE7 to see what I mean. Unlike every other browser, IE7 keeps each link :active (red underline) even when the javascript is finished.
  17. That didn't make any difference unfortunately.
  18. I'm having a issue with IE7 and CSS. I've made a site that uses AJAX to retrieve the content needed for each page without the browser needing to navigate away. When a link is clicked and the javascript does its thing and stops the browser navigating away, IE7 doesn't return the link to a:link or a:visited styles- instead, it 'gets stuck' on a:active. So, once a link is clicked, it's stuck with a red border underlining it when it should revert back to having no border - the a:link and a:visited states. Is there a way to force a browser to use a pseudo class? This is the CSS I'm using for the links; #navLinks a:link, #navLinks a:visited{ color: black; text-decoration: none; font-size: 24px; font-family: Verdana; font-weight: 500; margin-right: 10px; } #navLinks a:active{ border-bottom: 8px solid #8f2c2c; } #navLinks a:hover{ border-bottom: 8px solid #6aaaaa; }
  19. Hey all, I'm trying to do something that should be very simple...but I can't seem to figure it out. Basically, I want to submit a form and jQuery will do a call to a PHP file on the server which, depending on the data supplied to it, will come back with something for jQuery to display on the page. This is what I have so far: ... <script type='text/javascript'> $(document).ready(function() { $('#searchf').submit(function(){ var terms = encodeURIComponent($('#search').val()); var listener = 'jsListener.php'; $.post(listener, { t: terms }, function(data){ $('#result').html(data); }); }); }); </script> <form id='searchf' method='get' action='#'> <input id='search' type='text' onfocus="javascript: clearBox('search');" value='Enter your search terms' name='terms'/> <input type='submit' value='Search' name='search'/> </form> <div id='result'></div> ... The strange thing is, in every browser except firefox, nothing happens when submit is clicked etc the URL in the address bar changes to reflect the form's get method. In firefox however, the first click of the button does what every other browser does, but the second click of the button makes it do what I want it to and the data is sent off to jsListener.php. So clearly, I'm doing something wrong - but I don't understand what. I'm new to both javascript and jQuery.
  20. If you're on a shared host, it could be a vulnerability in someone else's site that is messing up your site because it's on the same server.
  21. The website_down function would need to try and contact the server and wait for an amount of time to see if the request times out - that could probably be done with a simple ping request. There isn't a function built into PHP that'll ping a server, but you might be able to use PHP's exec() function to call the server OS's ping program. Eg; <? $str=exec("ping -c 1 -w 1 ".$ip,$a,$a1); if(strlen($str)>1){ //website's up }else{ //website's down } ?> Completely untested of course. I started muddling together some code, then I found this so just posted the code I found on that page here. Should do what you want.
  22. I managed to fix it, I just used a totally different method of changing the font colour and made a new CSS class with black text for the input box and changed it in the input box's onclick attribute with: this.className='activated' Thanks for your help though (:
  23. No, that breaks the colour changing in other browsers too.
  24. Ok, I've managed to fix IE's problem of re-clearing the input box on every click instead of just the first by using a simple boolean flag; var flag = true; function clearBox(id){ if(flag){ document.getElementById(id).setAttribute('value',''); document.getElementById(id).setAttribute('style','color: #000000'); flag = false; } } I'm still having issues with the colour not being changed correctly in IE, anybody know what I'm doing wrong, or what the issue is?
×
×
  • 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.