Jump to content

Don E

Members
  • Posts

    996
  • Joined

  • Last visited

Posts posted by Don E

  1. One thing you can try, depending on how the paragraphs are stored, meaning if you have something like this for one $post:

    <p>This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.</p>
    <p>This is another paragraph. This is another paragraph. This is another paragraph from same post.</p>

    You can use PHP substr function along with strpos to try and get the first paragraph like:

    $firstPara = substr($post, 0, strpos(‘</p>’, $post));

    This should retrieve the first paragraph. 

  2. 17 minutes ago, dsonesuk said:

    Actually No, there are several ways to do this, and I did not which had been chosen, but the how the querystring and value are used is the important part to get it to work.

    Last time i checked GET is for query strings (using <a> tag, although can be applied to form via method get) which is what you mentioned in your post. But okay man. 

    • Like 1
  3. 1 hour ago, Weiss said:

    echo '<td><form action="findorder.php?'. $order_num.'"><input type="submit"  value="edit" /></form></td>';

    doesnt seep to work... above is the line that create the edit button, (order_num is uniqe in the database), but when pressed, it send the user to the findorder.php? with no order_num.. what am i doing wrong here?

    dsonesuk is referring to using <a> tag. Like:

    <a href="edituser.php?cust_id=n">Edit User</a>

     

    • Like 1
  4. 2 hours ago, iwato said:

    How is it that a cookie can be set in a browser, but the cookie is, itself, not on the same machine as the browser?  Is a cookie not simply a name for special information that is passed between a remote server and a local browser?  If so, how is it that this information cannot be found on the user's machine?

    The cookie/session that is being set in the browser is only an identifier. The browser sends the identifier back to the server for PHP to retrieve the data for that identifier(cookie/session data) which is on the server. 

    Basically what JSG meant here: 

    10 hours ago, justsomeguy said:

    PHP tells the browser to set a cookie containing the session ID, and the browser sends the session ID cookie back to the server so that PHP can look up that user's session data, which is saved on the server.

     

  5. 4 hours ago, Ingolme said:

    A responsive page should not have any effect on the canvas. The width and height attributes of the canvas determine its real size, if it has been scaled down by CSS that will not actually reduce the number of pixels that are on the canvas.

    Yes you're correct. The only thing with that is, if I draw on the canvas where the canvas has been scaled down by CSS, you get the result below(see link), the mouse is not matching with the drawn lines. This is expected because the actual drawing is happening on the canvas's width and height dimensions which in this case is: 670x470  but the scaling is: 255x168

    Is there anyway to have the mouse match up with the drawing when the image is scaled?

    Video Demo

    Thanks.

  6. I see, but is it possible to output the canvas(in this case an image that has lines drawn on it) to the browser with the original dimensions(width and height) of the image?

    So if the canvas is rendered down to 300x300 because of responsive design and we load an image into it, yes the image takes on the dimensions of the canvas which would be 300x300 but I was wondering if we can output the edited canvas image back out to 600x600 (original dimensions)?

    For i.e., the A4(smaller) print now can be printed into a poster(bigger) for example. Would be nice if we can take a canvas at a certain size and output it as a different size(bigger in this case) and still maintain all it's data. 

  7. Hello everyone,

    I have a question about the HTML canvas element. 

    If loading an image into a canvas where the canvas has been scaled down to a smaller size because of responsive design, say for example 300 by 300, how can then after playing in the canvas get the original size of the image for the canvas upon out putting to the browser to download? 

    So for example, original image size may be: 600x600. Loading it into a canvas that is being rendered responsive is scaled to: 300x300. Upon finishing playing with the image in the canvas, how can I get a 600x600 version of it instead of the scaled size which is 300x300?

    I've noticed that whatever the canvas width and height is set to, you will get that size for your output, which is fine but if an image is loaded into the canvas, it would be nice upon output to output as the original width and height for the canvas.

    Appreciate it in advance. Thanks!

     

  8. You can place the file.php in a directory other than the public_html directory since everything in the public_html directory is accessible by the public.

    For example, you can create a folder(directory) for cron job files in your home or username directory and call the file from there for the cron job:

    /usr/local/cpanel/bin/jailshell -q /home/my_username/cron_jobs/file.php

  9. Are you running the first cron job with the colons? 

    /usr/local/cpanel/bin/jailshell: -c: /home/my_username/public_html/folder/file.php"

    Try removing the colons and also the double quote at the ends of the cron jobs.

    • Like 1
  10. Just thought I'd share this video course on JavaScript for those who may be interested.

     

    https://www.udemy.com/understand-javascript/

     

    The course original price is $175 but there is a sale going on until Mar 1 where you can get it for $10.

     

    I'm not affiliated with udemy or anything. Just thought maybe someone would like to take advantage of the sale. It's a very good course for those who want to delve deep into JavaScript or enhance their JavaScript knowledge for a little cost. ??

  11. It's either people using a CMS like Wordpress or a site like Wix to do everything for them, or it's a programmer using a bunch of libraries and toolkits. People don't write HTML and CSS by hand like they did 20 years ago. If people are doing things the same way they were doing them 20 years ago then they haven't progressed.

     

     

    Kind of sounds like you're implying those who write HTML, CSS by hand today haven't progressed because they aren't using libraries, Wix, toolkits, CMS, etc?

  12. The software does not support PHP 5.2. It's more that just syntax errors, it's relying on features that are only available in newer versions of PHP, such as namespaces.

     

    That's such an outdated version of PHP that I'm amazed your web host is still using it, you should tell your web host to upgrade your version of PHP. PHP 5.3 was killed off two years ago, you shouldn't be using a version of PHP older than 5.4.

     

     

    Just to note and I wondered this for some time.. it seems most linux distros use dated versions of PHP. I read somewhere along time ago that this has to do with stability. Whenever they update I noticed, it's an update to the current version and usually not to a newer version.

     

    Here is a current list of some linux distros and their PHP versions: http://www.sasaprolic.com/2013/02/list-of-current-php-version-in-major.html (From 2013 but the list gets updated)

     

    If on a shared host, it would be probably difficult to get your host to upgrade your PHP just for you. Usually for shared hosts, everyone uses the same version from what I understand. Of course you can get dedicated and install your own new version of PHP but again as some have mentioned via the net, it's easier to manage server software via the software package manager that comes with your distro and whatever updates you get from the distro.

     

    Long story short, I was once on a shared host. I needed a particular software to be the latest. I contacted the host and they said "We cannot manually update that particular software only what the distribution has to offer at the moment." At the time I didn't understand but after research etc, I mostly understand.

  13.  

    i found out that its not by adding $stmt->store_result() AFTER bind_result(). but its solved by adding $stmt->store_result() BEFORE bind result.

     

    somewhere on the web i read that when selecting a longtext() field, we have to use store_result before bind_result.

     

     

    Good to know! Glad you figured it out! :happy0046:

  14. Have you tried doing a simple select to see if it returns anything like the following with description:

     

    SELECT description FROM stock

     

    or

     

    SELECT description FROM stock WHERE icode = 1

     

    or

     

    SELECT item,sid,catid,oqty,unitid,sprice,pprice,description FROM stock WHERE icode = 1

     

    Good luck.

  15. Try adding $stmt->store_result(); after $stmt->bind_result() and then add/check if $stmt->num_rows returns anything.

     

    i.e.:

    $stmt->bind_param('ssi', $icode, $icode, $cid);
    $stmt->execute();
    $stmt->bind_result($item,$sid,$catid,$oqty,$unitid,$sprice,$pprice,$description);
    $stmt->store_result();
    
    if($stmt->num_rows)
    {
       echo $stmt->num_rows; //test to see if num_rows
       
      //if any num_rows returned, then fetch....
      // if you know a single row is returned: $stmt->fetch();
      //if multiple rows....: while($stmt->fetch()) {}
      
    }
    else
    {
      echo 'no rows returned';
    
    }
    
  16. The default max execution time for PHP scripts is 30 seconds. If ran longer than that, you get an error like the one you saw. You can increase the execution time in your php.ini file by increasing the max_execution_time directive.

  17. This is an old topic but instead of making a new one, I thought I'd ask here again.

     

    Would it also be advisable to use prepared state for SELECTING as well instead of just for INSERTING/UPDATING.

     

    Currently I am doing that for selecting as well but just thought I'd ask. Thanks.

  18. Are you seeing any errors anywhere? Try and remove @ from @mysql_query so that errors are not suppressed.

     

    If the columns confermato and id_studente are of type int, you do need single quotes for the value.

     

    Side note, if you're going to use MySQL, it's recommended to use MySQLi instead along with prepared statements.

  19. On line 74 in: http://iiifactor.org/templates/jm-fitness/cache/jmf_fd13cc26d71bb41969504b15616231cb.css?t=1463891995

    .table-striped tbody > tr:nth-child(2n+1) > td, .table-striped tbody > tr:nth-child(2n+1) > th {    
         background-color: #f8f8f8;
    }

    If you remove the background color (above), green background appears with the header titles. That CSS file may be minified.

     

    You may want to override that table header rule by creating your own CSS file and place it last after your other CSS files for that page.

     

    You can then try to target it like the following:

    form#adminForm table tbody tr th {       
        color: #fff;
        font-weight: 500;
        padding: 15px 8px;
        text-align: center;
    }

    The above gives you the green background with white lettering:

     

    tableHeader.png
×
×
  • Create New...