Jump to content

Ingolme

Moderator
  • Posts

    14,894
  • Joined

  • Last visited

  • Days Won

    176

Everything posted by Ingolme

  1. Ingolme

    Good example?

    That article is OK for learning basics but there are things that aren't right. First of all, they mentioned "Netscape" which means this is a very old article. The second problem is that they're using register_globals instead of the $_GET array to access input variables.Another problem is that they're not sanitizing data before putting it into a query, which means that visitors to your site can mess up the database.
  2. Ingolme

    printf function?

    For the printf() function, specifically, the list of all the % placeholders is in the sprintf() manual page.
  3. Ingolme

    printf function?

    It's a complex system. It involves HTML forms and PHP. You can always choose your own variables names, or even just pass literal values to the function. printf($a, $;printf($x, $y);printf('Literal %s', 'string');$s = 'string';printf('Variable and literal %ss', $s);
  4. Ingolme

    printf function?

    print can output as many variables as you want. A good use for printf() is outputting content in different languages.Here's an example: <?php$num = 5; if($language == 'english') { $format = 'There are %d monkeys.';}if($language == 'spanish') { $format = 'Hay %d monos.';} printf($format, $num);?> This example isn't perfect because it can be done without printf(), but I'm building a system that supports multiple languages which uses the sprintf() function.
  5. Ingolme

    printf function?

    The first argument of the printf() function has a string with special codes where variables are supposed to go. (%s, %d ... and others) The variables from the rest of the function arguments are put in the string where the codes are. The sprintf() page has more information on what each code is for:http://es.php.net/manual/en/function.sprintf.php Here's an example copied from the manual <?php$num = 5;$location = 'tree';$format = 'There are %d monkeys in the %s';printf($format, $num, $location);?>
  6. We cannot allow linking to illegal downloads of intellectual property on these forums.
  7. I don't like creating extra elements for styling if I can avoid it. You can make a 1x1 pixel semi-transparent PNG as a background image if you want to support browsers that don't accept rgba format.
  8. Ingolme

    Expanding text box

    You can add events to elements without actually changing the HTML of the element. CSS cannot do what you're asking for.
  9. Ingolme

    Triangle Grid

    CSS just makes rectangles.The only way to work with other shapes is image maps and the <canvas> element with Javascript.
  10. Ingolme

    Expanding text box

    It can be done, but not with CSS. You would need to use Javascript. Just attach an onclick event to the box and set the height.
  11. I'd keep the href attribute in case Javascript is disabled, then return false to prevent the link from opening a new page.
  12. You can use mysql_error() to see what the problem is. I think the problem is that you have a comma at the end of this line: maidenname varchar(255) NULL,
  13. Ingolme

    Echo or print?

    I'm not the one choosing the language. The PHP manual chooses the language automatically when you get there. I always use echo because print has no advantages over it.
  14. You can have a query string on the link so that PHP knows which page to go to: <a href="direct_all_links_from_here.php?page=Bob">Bob</a><a href="direct_all_links_from_here.php?page=Barbara">Barbara</a><a href="direct_all_links_from_here.php?page=Beatrice">Beatrice</a>
  15. Ingolme

    Echo or print?

    The difference between echo and print() is that print() can be used anywhere that a function can while echo cannot. Another difference is that echo can have several parameters separated by commas.Function behavior from print() $a = print('Something');echo $a; // outputs "1" Echo can take several parameters echo 'A', 'B', 'C', 'D'; For more information, read the manual pages for echo and print:http://php.net/echohttp://php.net/print
  16. If the link has an href attribute, just send all the links to one function that gets the href property from the link.
  17. It's a PHP error. An index is the part between square brackets in an array element: $arr['index']; or $arr[1] or $arr[$indexInVar];
  18. I believe Datetime fields are stored in the format YYYY-MM-DD HH:MM:SS
  19. Just prepend http:// to the URL. <a href="http://192.168.1.4/about.php">About</a>
  20. If you could show a working example of the problem then I could see the problem.
  21. Ingolme

    Next step?

    You can put the PHP between other HTML, like this:<!DOCTYPE html><html> <head> <title>Page</title> </head> <body> <h1>Database test</h1> <?php // Database code goes here ?> </body></html>
  22. It might be due to case sensitivity. Check that your element's ID is "leftCol" and not "leftcol" or something else. Also, be sure the element has an "id" attribute and not a "name" attribute. The DOCTYPE only breaks the page if something was wrong in it to begin with.
  23. Check that you're uploading the files to the www/ or htdocs/ or public_html/ folder.
  24. You should have the session_start() at the very beginning of your script. The problem here is the location header. You should use session_write_close() before sending location headers. Another thing is that the location header requires an absolute URL. While some browsers accept relative URLs it is incorrect. session_write_close();header ('Location : http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF']) . '/dow.php'); Be sure to check that $_SESSION['logged_in'] is true on the dow.php file.
  25. In the page that's inside the frame you can set the max-height and max-width properties of the image to 600px.. This, requires that the image is inside an HTML page.Instead of an iframe it might be good to try other methods such as Javascript and fall back to PHP.
×
×
  • Create New...