Jump to content

Zane

Administrators
  • Posts

    4,362
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Zane

  1. Yes, why? I would ditch the spaces, until you actually want to display the data.. otherwise, it's just a pain in the ass. You can query without the hassle of spaces SELECT * FROM vehicles WHERE plate_number LIKE '%f35%' To display the plate number with the spaces, just convert the string to an array and implode it by string. $str = implode( " ", str_split('fff3333') ); echo $str;
  2. In the manual page for str_getcsv, it provides an excellent example of how to get started; in the first comment. $csv = array_map('str_getcsv', file('data.csv')); You will then have an array with all of the names Also, in the manual, for the function array_multisort, there is another example. foreach ($csv as $key => $row) $lnames[$key] = $row[2]; array_multisort($lnames, SORT_DESC); With their powers combined, you can create this $csv = array_map('str_getcsv', file('csv.csv')); foreach ($csv as $key => $row) $lnames[$key] = strtolower($row[2]); array_multisort($lnames, SORT_ASC, $csv); echo "<pre>", print_r($csv), "</pre>"; $csv is now sorting in ascending order by last name.
  3. You're missing a closing brace $clientFeatures = DB::table('features')->join('clientFeatures', function($join) use($clientID) { $join->on( 'clientFeatures.featureID', '=', 'features.featureID') ->where('clientFeatures.clientID', '=', $clientID); })->get(); $groupIDs = array(); foreach ($clientFeatures as $c) { $groupIDs[] = $c->groupID; } } catch
  4. Content, content, content. The key to SEO. There are several, and I mean several, other factors involved (with search engines today), but content is the number one source of information. By content, I means words, lots of words, like enough to fill a few blog entries. For ecommerce sites, the product information, and most importantly the name and descriptions will draw in the traffic.
  5. SELECT UNIX_TIMESTAMP( datetime field); This will cause your database to work harder though, especially if you have thousands of records. Mysql's DATETIME datatype is the better alternative, it will allow you to perform complex date calculations much faster. otherwise you will have to convert all UNIX TIMESTAMPs to a mysql date format before performing any kind of the date functions provided by MySQL. Granted, though, NOW() will give you the server time, while the UNIX Timestamp will give you seconds since the epoch.
  6. SELECT DATE_SUB(OrderDate,INTERVAL 1 HOUR) AS SubtractDate FROM Orders
  7. Just echo out the PHP variables into your Javascript. var sender_id = <?php echo $sender_id; ?>; var receiver_id = <?php echo $sender_id; ?>; var message = <?php echo $sender_id; ?>; You can create JavaScript from PHP, but not the other way around. PHP is parsed FIRST. You can have PHP output whatever you want, anywhere you want. pretty much.
  8. it was saying thread_id wasn't a defined index because you were echo-ing out the thread_id get variable. You also commented out the if (isset) portion. So it seems the answer is that thread_id isn't being passed when you seem to think it is. If you plan to use the same value on multiple pages, it's best to use the actual tool for that task... $_SESSION.
  9. It's not going to be as easy as getting the average of the two colors. You're going to have to convert to something like CMYK/HSL/HSV and so on, perform some extremely complex algorithms, and get a result that you would then convert back to RGB. (hex) Your best bet, and easiest alternative without re-inventing the wheel is to find a jQuery plugin that can do it for you, such as this one http://www.xarg.org/project/jquery-color-plugin-xcolor/
  10. Turn on error_reporting for one. error_reporting(E_ALL); ini_set('display_errors', 1); Are you sure that thread_id is even set? Put in some echos and die(s) above and below figure out when you're script is finishing execution.
  11. Any SQL advice Barand gives you, soak it up like a sponge. He (and fenway) have helped me several times over the years, without any disappointment. Creating a blank table with premade records is the most inefficient way possible to do what you are doing. One day can have several appointments from what I gather so what good would it do you to prepopulate a table? Again, you will have multiple appointments for a given day, so using the DATE as a primary key will not work like a primary key should. Most primary keys are set to auto-increment, so what is going to happen when you want to add a new booking appointment? You'll have to insert the date everytime and not only that, you would need to check if there is s a duplicate key, since you're not automatically incrementing your index. What Barand has shown you in the other thread is more than enough to get started. Read over it several times if you have to. I'm closing this thread so you can continue with your original one. http://forums.phpfreaks.com/topic/290480-appointment-booking-script-for-calendar/?do=findComment&comment=1487931
  12. Install and exclusively use Google Chrome Install a Adblock AND Adblock Plus, to keep tempting clicking of ads with chicks with really nice racks and nice everything else... raw. Well not just to keep them from clicking it, but from having it appear at all on the webpage. You can also install VNC and remotely access the computer from somewhere else, like your batthroom, sitting on the toilet with your laptop with nothing on your mind other than what your son is falling witness to on the evil Internet. By adding all of these obstacles to your son's internet experience, you are forcing him to educate himself further and further into how to bypass security. Whatever you tell a kid not to do, is exactly what they will do. Perhaps you could just sit down with him while browsing these evil areas and traumatize him with awkwardness, sort of like how parent's make their kids smoke an entire pack of cigarettes to teach them smoking is bad.
  13. If your son is capable of this, then it shouldn't take long for him to google around your keylogger, or firewall. Kids are much more inclined to excel in the digital age than the generation from a decade ago. The internet is always crawling with trolls, naughty pleasures, and debauchery. I don't want to tell anyone what to do with their children, but IMO, if you don't want him to witness the evils of the internet, then don't let him use the internet. He will eventually find a way to get access though because the internet is everywhere. He's just one question away from using any restaurant or book stores' or libraries' wifi,...... "Can I get the wifi password?" If they say no, then just head down to the next hotspot, lather, rinse, and repeat.
  14. echo "<pre>", print_r($_GET), "</pre>"; This is just a start. It will show you what $_GET contains, in a clean, readable format. To get the values, simply grab it with $_GET['thekeyname']
  15. But that is exactly what you asked for right? Someone to tell you, why, what, where, and how. I can see your main question in the title of this thread, that is great, but your post contains nothing but your code(s). Apparently, members.php is not displaying the username. Are you sure that your query is correct? Are you sure that the SESSION is right? gerkintrigg mentioned only one helpful thing, debug. He forgot to mention and educate you on some basic debugging techniques. For instance, to check your SESSION contents, use this snippet echo "<pre>", print_r($_SESSION), "</pre>"; You will want to use this snippet to check out most of your variables. There is also error_reporting, display_errors, var_dump, and just plain echo statements. If you can't successfully get the username, then either your query isn't returning anything, which should return an error, or your logic is all wrong. EDIT: Also, why are you using fetchColumn() when you could just use fetch() which would give you everything in that row as an array?
  16. If your child is using the same computer as you, then just setup a limited account for him. He doesn't have to use the same account as you, that would be the source of your problems right there. The honor system is a horrible security measure. Another option is to edit your hosts file, automatically redirecting bad sites to nothing. That would also mean that you couldn't go to them, so if you don't want your children checking our your favorite porn/weather site, you might have to write a script that will edit your hosts file on the fly. There are several ways to accomplish this, but ..... they will all take a lot of time and effort on your part. This generation of kids have grown up with the Internet, they do not know what the world is like without it, they are essentially better than us at using the Internet anyways. Several young people make quite a bit of revenue simply from uploading their cell phone videos.
  17. It also helps us tremendously to have code written beforehand. Otherwise, you might as well ask "Is this a good car?" To answer you question without you having given code, just use the SELECT HTML tag, with OPTION tags inside.
  18. No idea what's wrong. It must be on your end. Put a carriage return \r in there, maybe that'll fix it? $iframe = "<iframe src='menu_new.php' width='65%' name='menu' id='menu' title='Menu Frame' ></iframe>\r\n"; Are you sure that this happens exclusively when you put the newline character?
  19. Could you be any less specific? And surely you've got more code than that.
  20. I can't believe I missed that detail. I meant to write Hypertext Preprocessor
  21. There's no need to create a form in a loop, making several forms. I'm surprised that you get the "second" value, and not the last one. Maybe you only have two loop iterations. Put the form tag before the while loop, and the end form tag after the loop.
  22. No. Just as you read, it used to stand for Personal Home Page, but they then changed it to something called a reverse acronym or something. So, anyway, PHP stands for Hypertext Preprocessor. -edit for -pre
×
×
  • 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.