scootstah
Staff Alumni-
Posts
3,858 -
Joined
-
Last visited
-
Days Won
29
Everything posted by scootstah
-
Huh. So it is. Interesting. VARCHAR stores data in the row, whereas TEXT/BLOB is just a reference to another location where the data is stored. Therefore, TEXT/BLOB only contributes a very small amount to the row size. VARCHAR has a maximum size of the row size - so it's only 0-65,353 if it's the only column in the row. The speed of VARCHAR vs TEXT/BLOB is highly situational. If you have a small amount of data (such as an email address) then VARCHAR should be faster. If you have a blog article, obviously TEXT is a better option. Like I said, if you are putting that huge chunk in there I would go with a TEXT. But, I still think this is a bad approach.
-
Except varchar can only go to 255 and not 322. ;P
-
So who else can't sleep because of Christmas excitement?
scootstah replied to scootstah's topic in Miscellaneous
Bah, you're no fun. -
Not always, but in this case yes, it is. Honestly, I absolutely loathe code like this. It is so annoying to maintain.
-
I know I can't. And the forums are dead right now :'(
-
Yes you can do this. If you are putting this entire thing in: echo '<div id="box_Content_700b">'; echo '<h1>Member Account Created</h1>'; echo '<p>Congratulations!</p> <p>Your account has been created, and a confirmation e-mail sent to: "' . $email . '"</p> <p>Please click on the link in that e-mail to activate your account.</p>'; echo '</div>'; Then definitely use text. Going off a lot of your posts with such code in it, I have concluded that you really need to use a template solution. I would recommend that even if you don't understand or want to dive into OOP yet, that you at least learn the concepts and principles behind MVC. Mostly the part about separating business and presentation code. Consider the following: function load_template($template, $data = array()) { // extract $data array into variables extract($data); // is the template file found? if (is_readable('template_path/' . $template . '.php')) { require 'template_path/' . $template . '.php'; } else { die('Could not find template "' . $template . '"'); } } Now your template folder might look like this: header.php footer.php account_success.php header.php would contain the "top" of your site. In other words, it would contain all of the HTML markup up to the point where your main content would be. So like <!DOCTYPE html> <html> <head> <title>blah</title> </head> <body> <div id="content"> And then footer.php would close any open tags from header.php. So like </div> </body> </html> Then in each template file, you simply include these files at the top and bottom of your template, and put the content in between. So your "account_success" file would be like <?php require 'header.php'; ?> <div id="box_Content_700b"> <h1>Member Account Created</h1> <p>Congratulations!</p> <p>Your account has been created, and a confirmation e-mail sent to: "<?php echo $email; ?>"</p> <p>Please click on the link in that e-mail to activate your account.</p>'; </div> <?php require 'footer.php'; ?> Finally, here is the usage: if (mysqli_stmt_affected_rows($stmt)==1){ load_template('account_success', array('email' => $email)); } else { load_template('account_failed'); } Here is the huge benefit from this. You can create "success" and "failure" templates, and then simply pass in a title and a message - now you can display a message with one line of code, and if you ever change the markup, you don't have to change it in multiple places. Hope this gives you something to think about.
-
If it's a stupidly simple list, then yes you could do that. Nothing is preventing you. But hacking other structures to replicate tables is more inefficient than incrementing a variable.
-
need to use the value in a variable as the function name
scootstah replied to johnsmith153's topic in Javascript Help
It would be like this: $var_name = function() { // your function } -
You can use the minified versions. Minified means all comments, white-space and otherwise unneeded characters/things are removed from the scripts - making their file size smaller. If you can't find a minified version for a particular script or plugin, there's a few web services out there that can minify scripts for you.
-
Try this: http://unused-css.com/ But keep in mind that if you have pages or content that aren't visible to the public and they use styles that aren't used anywhere else, you may get some unexpected results.
-
Like I said, you will almost never see someone with an email 255 characters long. That's just absurd. Most people have short, easy to remember emails...so around 60-80 characters and you should be fine. If you ever get a complaint you can always increase it.
-
Well, blyz said that he was scared of paying a developer to write the code since the developer might use the code somewhere else or for himself. Then premiso refers to it as "he", meaning the developer. Anyway, this is getting off topic. We all know what was meant.
-
If you're worried about it just use varchar(255).
-
It still seems unprofessional and unneeded in my opinion.
-
Are you using PHP to loop through database results? If so then just use the loop to add numbers. $i = 1; while($row = mysql_fetch_assoc($result)) { echo '<tr> <td>' . $i . '</td> <td>' . $row['username'] . '</td> </tr>'; $i++; }
-
Honestly, they will just get reported and taken down if you spread slander. This really isn't a professional thing to do. Just accept that you picked a bad host and move on.
-
Well, this is 40 characters: "[email protected]" So you decide. I'd probably bump it up to 60 or 80. Although emails can be much longer, that's not really normal.
-
#background > article header or #background > article > header Either will work.
-
You could cheat... http://jsfiddle.net/dn2zb/
-
What I usually do is make the data safe to store (so cleanse SQL injections, basically) and that's all the sanitation I do on input. Actually, I don't even do that - because I use prepared statements. Then if I don't want HTML to be displayed on pages, for example, then I can either run it through HTML purifier or just throw htmlspecialchars() at it.
-
If you end up being unable to get your domain situated, you may try complaining to ICANN - maybe they can do something about it.
-
dirname(__FILE__); gives you the directory to the file. So if everything is running out of your index.php in the webroot, then all you to do is put this function in front of every include. It doesn't matter if the webroot changes, because it will still give the path to the file that called it. AJAX has no bearing on where files are.
-
You'll need Javascript. http://selectivizr.com/
-
Like I said, your styles already work for IE8. http://jsfiddle.net/mzbXf/1/ This works just fine for me in IE8 - there is no dotted outline around it.
-
Tables are meant for tabular data - there's nothing wrong with using tables in this case. In fact, trying to make faux tables with other structures is kind of silly.