Jump to content

rawb

Members
  • Posts

    44
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

rawb's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks much for your reply! I had absolutely no idea that you had to do anything other than put the encoding in a meta tag, but this was the problem! Works like a charm now.
  2. Sorry for the double post.. I was trying to edit the previous message and accidentally hit 'quote' instead and now I can't find the delete option for this post. Any help with the above question is appreciated!
  3. I posted a similar thread in the MySQL help forums about character encoding and inconsistencies when inserting into a database, but these are definitely two distinct questions and I think this one belongs here. I've been told that UTF-8 character encoding supports french characters (and that it is generally the most universal encoding that there is). If that's the case, why don't french characters display correctly with it? See both files here for an example. They are identical except for their character encoding: http://rawbwk.com/french/ Also note the error when trying to validate: http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Frawbwk.com%2Ffrench%2Futf.html The identical code with an 'ISO-8859-1' encoding validates with no errors. What's the deal?!
  4. Ok I've got kind of a weird character encoding problem that I'm going to try to describe as best I can . Basically, I'm having a lot of trouble rendering French characters and there seems to be a general consensus (on google) that utf-8 is the way to go for French. The MySQL database is set up to use the 'utf8_general_ci' collation, and my HTML also uses utf-8 character encoding like so: <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> The Problem: When using the utf-8 character encoding on my html pages, everything appears to work perfectly. However, when I go to PHPMyAdmin and check the database, it inserts weird characters ('é' instead of 'é', for example). When using the 'ISO-8859-1' charset on my HTML pages, everything inserts and retrieves correctly (this is what I'm currently doing). The thing is, I would really like to use the utf-8 charset in my HTML to keep things consistent between my database and my HTML. If this charset is supposed to be able to support French, then why is it doing this? Thanks in advance!
  5. Check out getimagesize(). http://www.php.net/manual/en/function.getimagesize.php
  6. <?php function showMonitor($monitor) { echo <<<HRD <div class="section"> <div class="images"> <img class="logo" src="images/logos/hannsg.png" alt="Hanns-G" /> <img class="monitor" src="images/hannsg/$monitor.jpg" alt="Hanns-G $monitor" /> </div> <div class="description"> <a href="#"></a> <ul> <li><strong>Color:</strong> {$hannsg[$monitor][0]} </li> <li><strong>Size:</strong> {$hannsg[$monitor][1]} </li> <li><strong>Resolution:</strong> {$hannsg[$monitor][2]} </li> <li><strong>Response Time:</strong> {$hannsg[$monitor][3]} </li> <li><strong>Input:</strong> {$hannsg[$monitor][4]} </li> <li><strong>Brightness:</strong> {$hannsg[$monitor][5]} </li> <li><strong>Contrast Ratio:</strong> {$hannsg[$monitor][6]} </li> <li><strong>Viewing Angle:</strong> {$hannsg[$monitor][7]} </li> <li><strong>Pixel Pitch:</strong> {$hannsg[$monitor][8]} </li> </ul> </div> <div class="revieworbuy"> </div> <div class="clear"></div> </div> HRD; } ?> Sorry I forgot to echo the string.. also thrope is right you need to pass that hannsg array to the function or define it within the function...
  7. <?php function showMonitor($monitor) { <<<HRD <div class="section"> <div class="images"> <img class="logo" src="images/logos/hannsg.png" alt="Hanns-G" /> <img class="monitor" src="images/hannsg/$monitor.jpg" alt="Hanns-G $monitor" /> </div> <div class="description"> <a href="#">[/url] <ul> <li><strong>Color:</strong> $hannsg['$monitor'][0]</li> <li><strong>Size:</strong> $hannsg['$monitor'][1]</li> <li><strong>Resolution:</strong> $hannsg['$monitor'][2]</li> <li><strong>Response Time:</strong> $hannsg['$monitor'][3]</li> <li><strong>Input:</strong> $hannsg['$monitor'][4]</li> <li><strong>Brightness:</strong> $hannsg['$monitor'][5]</li> <li><strong>Contrast Ratio:</strong> $hannsg['$monitor'][6]</li> <li><strong>Viewing Angle:</strong> $hannsg['$monitor'][7]</li> <li><strong>Pixel Pitch:</strong> $hannsg['$monitor'][8]</li> </ul> </div> <div class="revieworbuy"> </div> <div class="clear"></div> </div> HRD; } ?> Use the heredoc syntax to echo raw html.. be sure that the closing HRD; is NOT indented, it must be the first thing on a line by itself. You don't need to use the letters HRD either, it's up to you. But that code above should work.
  8. Most of what I've learned, especially while starting out, has been from tutorials online. Here's a good one: http://www.oxyscripts.com/item-418.html . I remember taking an entire night to work through that code, but I learned a ton and actually had a lot of fun figuring it out. That site's got a lot of good ones, check out good-tutorials.com for a ton more.. there are a million PHP tutorials online just google it. Also, take advantage of the PHP manual it's by far the best reference for a programming language that I've ever seen.
  9. I use htmlentities as well to make sure nobody tried to insert any javascript or html. Also be sure to quote your values in the query (I.E. "INSERT INTO table (productId, something) VALUES ('$quote', '$these')").
  10. I don't think the arrow is used for anything outside of OOP. Unless you're just referencing an object's variable and not a method above I think what you're trying to accomplish is done with just a plain vanilla function <?php function filename() { // your code here } filename(); ?>
  11. Without javascript there is no way (that I know of) to send a request from a client to the server to do anything after a certain amount of time. Ways that I can think of to accomplish your goal: 1) use javascript to time the player on the client side and send an ajax request to update whatever needs to be updated in your database after a specified amount of time 2) use a meta refresh tag (or javascript) to time the player on the client side and refresh the page after a specified amount of time.. when the page reloads check to see if the user had run out of time on the previous page and if so update whatever needs to be updated if the user has run out of time 3) php_dave's recommendation of using a cron job to update all records on the server every so often should work 4) you can use php to check and see the amount of time the user was on the previous page and then check to see if it was too long, but this requires action on the user's part so it isn't really automatic... unless used in conjunction with option #2 I guess hope this helps a little
  12. change this $presultafc=$_POST['resultmfc']; $presultother=$_POST['resultother']; to this $presultafc=mysql_real_escape_string($_POST['resultmfc']); $presultother=mysql_real_escape_string($_POST['resultother']); ANY string input that you use in a mysql query should be escaped with this function (this function also takes a second argument, the database resource variable, and ideally that would be included as well). If the user input is not intended to be a string (an integer, for example), be sure to cast it (i.e. $var = (int)$var) to ensure that it is the correct datatype. Also be sure to continue to use those single quotes around your values to prevent certain types of injection.
  13. Assuming the code above works to create two new connections, the only thing that I can think of that could be wrong is you're not including the link identifier in the arguments of mysql_query (i.e. mysql_query("SELECT * FROM something", $connection))...the 'rest' of the code (from the creation of the connections to the all the way up to the output) would help...
  14. If you're trying to overwrite the old table with the same name with this new table structure, drop the 'if not exists'. Please note that you'll loose all your records! If you're trying to edit the table structure and keep your records, http://dev.mysql.com/doc/refman/5.0/en/alter-table.html is a better option.
  15. Thanks for your reply. This does seem plausible, but might not be scalable.. what if I need to add many more than 50 items between items? Is there really no better way?
×
×
  • 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.