We all know what the FCC is, right? Well, if you don’t, then here’s the gist of it:
The Federal Communications Commission (FCC) is an independent United States government agency. The FCC was established by the Communications Act of 1934 and is charged with regulating interstate and international communications by radio, television, wire, satellite and cable. The FCC’s jurisdiction covers the 50 states, the District of Columbia, and U.S. possessions.
Right, so there’s a communications regulation agency of the U.S. government. They handle things like what can be said or displayed on public television (television that doesn’t need a subscription; for example, Cartoon Network can be viewed for free, whereas you have to pay extra for Showtime). The contradiction is this video:
If you click on it, it says you must be over 18 to view it. Funny… it’s a television ad. The FCC approved of it, yet some silly monkey went and marked the video as adult content. It’s funny what some people do, don’t you agree?
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
This video explains what the title means. Anyway, one of the things I hate about PHP is how redundant the MySQL statements are. Each one is the same thing, but different only by a little bit. Experiencing the same thing? Well, this function I just wrote will help lighten the redundancy!
<?php
function add_mysql_entry($info)
{
if(is_array($info) and sizeof($info) > 0)
{
// Python: mysql_values,mysql_tables = {},{}
$mysql_values = array();
$mysql_tables = array();
if(is_array($info['post']))
{
foreach($info['post'] as $post)
{
// You need single quotes, or else it’s a suntax error.
$mysql_values[] = “‘”.htmlspecialchars($_POST[$post[0]]).”‘”;
$mysql_tables[] = $post[1];
}
}
if(is_array($info['background'])) {
foreach($info['background'] as $background_info)
{
$mysql_values[] = “‘”.$background_info['value'].”‘”;
$mysql_tables[] = $background_info['column'];
}
}
$mysql_values = implode(’,', $mysql_values);
$mysql_tables = implode(’,', $mysql_tables);
$query = mysql_query(”
INSERT
INTO “.$info['table'].”(”.$mysql_tables.”)
VALUES(”.$mysql_values.”)”) or die(mysql_error());
}
}
?>
This function is basically a simple MySQL INSERT statement. It makes it so that you don’t have to declare each $_POST variable, preform all precautions, execute the query, and then make sure that the query did what you wanted it to do. Here’s an example:
In this example, there are three $_POST variables that the programmer wants to use: add_shoes_name, add_shoes_desc, and add_shoes_price. He wants insert them in the columns shoe_name, shoe_desc, and shoe_price in the table shoes_tb. Of course, getting something such as the date and not letting the user see it can’t be done through a $_POST variable (other than using the hidden input type). This is where background comes in. The syntax of the $info array is:
Have you ever read the comments on websites such as YouTube or any type of site that allows users to post a comment? There is someone that will always like Internet Slang (lol, ya, np, etc.), and, likewise, there is always someone, or some people, to flame him/her. I agree, it is annoying. However, I’ve just had a lesson pounded into me while playing Mabinogi.
You may remember Mabinogi from my previous post. My character can handle all wolves, excluding wolves more powerful than a white wolf. Well, I was killing wolves and… got killed trying to finish one off. A good-hearted chap wanted to revive me, but… the problem was, I’ve never typed a message while I was dead - in fact, I didn’t know how to! So, he asked if I needed help, I couldn’t respond (trust me, I tried to answer with a “Yes!”) and he left. I then revived at the city and immediately went back to where I died to apologize for not replying (from his perspective, I was ignoring him) and what do you know: he was almost dead. So, I save him. He gives his thanks and this is where I learn a lesson: I tried to reply, but given my fanatical anti-1337speak attitude, he left before I could even finish what I was typing. Probably thought I was ignoring him again. So, I said “Screw it,” logged off and then came on here.
I’m not sure if it was a girl or a boy, so I just use “him” (and other forms) as a gender-neutral pronoun. His character was a boy, though.