Thanks for your reply! Completely agree with what you're saying, but I think that even though it might not be 100% valid CSS that the Sass compiles to, if it doesn't break down it means there is at least a style sheet that works. CSS errors could be there even without Sass, I don't think Sass is the problem there :).

A bigger question for me is though: how do I actually get to automating all this? Do I install tools on the server on which the projects run? Or do I use another server that builds and checks and validates everything and then pushes the valid built package to the server that serves the application (website)?

Hello there. I'm at a point where I have to set up a continuous integration environment. I have contributed to projects using CI before, but I have never set it up. I roughly know what it is supposed to do, but I could definitely use some help.

In my head I'm thinking something like this is what should happen (I'm using this for a PHP project):

pre-commit

  • run unit tests
  • check if Sass compiles
  • check if JS compiles (using Webpack)
  • if everything goes well: commit

post-push

  • run the same checks as before (as we cannot be sure that a client has actually tested his code before pushing)
  • composer install
  • compile Sass
  • compile JS (using Webpack)
  • if everything goes well: deploy

deployment

  • Move the whole build to the web server root so that our new build is now live.

Now the questions that I have: how do I automate these processes? Do I locally just use a task runner? What tools could I use to set-up CI on our webserver? Thanks for the feedback!

For starters, I don't see any code where you are actually displaying something that you fetched from your database.

I ran the same code locally and it's working (the code I submitted as an example, that is). So if that's not working for you we may have bigger problems at work here :p.

Try this:

<?php 
$month=array("Jan","Feb","Mar","Apr","May","June","July","Aug","Sep","Oct","Nov","Dec"); foreach($month as $m)
{ 
    printf('$m = %s, $birth[1] = %s, same? %s', $m, $birth[1], $m == $birth[1] ? 'yes' : 'no');
} 

Is there any record that says "yes"?

What is in $birth[1]?

Something like this should be working:

<?php
$interests = array();

if (!empty($_POST['interests'])) {
    $interests = $_POST['interests'];
}

if ($interests) {
    echo 'Interests:<br>';
    foreach ($interests as $i => $interest) {
        echo 'Interest: ' . $interest . '<br>';
    }
} else {
    echo 'No interests submitted.<br>';
}

?> 
<!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content="text/html"><meta name="author" content="Kevin Robinson"><title>Untitled 2</title> </head> <body> <form method="post"> <table width="900"> <tbody> <tr> <td width="900"><input name="interests[]" id="option1" value="option1" type="checkbox"><p style="font-size:+1;">option1</p></td> <td width="900"><input name="interests[]" id="option2" value="option2" type="checkbox">option2</td> <td width="900"><input name="interests[]" id="option3" value="option3" type="checkbox">option3</td> </tr> </tbody> </table> <input type="submit" value="Show my Items" name="save"></body> </html> 

Your code shouldn't be giving any errors for as far as I can see. Only thing that could happen is that a notice is triggered because you aren't checking if $_POST['interests'] actually contains a value before using it.

On the first line of your file with the error, type 'use strict' followed by a newline. That should fix it. Some stuff in Javascript is only supported if you use strict mode.

You want to know the value of the style attributes? Or? You'd have to write a regex PHP parser for that, or maybe you can do some nice stuff parsing it using Javascript?

Yes it does.

(function($) {

    // Code

})(jQuery);

simply defines an anonymous function and executes it right away, passing it jQuery as argument for $. You can put everything inside there.

I know, that's why I posted the solution above. Look at it again ;). Do you see a document.ready anywhere?

JOIN works if tables have different column names.

Example:

SELECT table_a.name, table_b.username FROM table_a JOIN table_b ON table_a.user_id = table_b.user_id WHERE table_a.user_id = 1

In the ON part of the query you tell the query which column in the first table matches the which column in the second table.

diafol commented: +1 +15
cereal commented: +1 +13

Why don't you use a JOIN? :)

shany0786 commented: thnks for reply does join work if have table having some columns different names.can you give link how to use it +0

Depends on what you want to achieve. You don't need to reinvent the wheel but building something yourself from scratch gives you important insights, insights that you will probably need if you want to be a web developer.

As soon as you find out how you can make a wheel that works, you can choose to use a wheel that someone else made or that is made by an open source community and even help making that wheel better. Focus on where your qualities lie. No need to do everything from scratch over and over again :).

Well if you want to hear why it didn't work, I think we need some more code of you to review, but if you have it working and if you're happy with that, I'm happy too :).

I've cleared up some code for you as it seems to be in random order. Try this out and let us know what the debug messages say, as your code does not appear to be wrong at first glance.

<input type="file" name="ft_img" style="margin: 0 !important;"><input type="file" name="download" style="margin: 0 !important;">

<?php
// Image 1
$imgname1 = $_FILES["ft_img"]["name"];
$imgtype1 = $_FILES["ft_img"]["type"];
$imgtemp1 = $_FILES["ft_img"]["tmp_name"];
$path1 = "./uploads/".$imgname1;
$status = move_uploaded_file($imgtemp1, $path1);

// Debug image 1:
printf(
    'Image 1 should have been moved from %s to %s. $status = %s',
    $imgtemp1,
    $path1,
    $status ? 'true' : 'false'
);

// Image 2 (download)
$download  = $_FILES["download"]["name"];
$file_type = $_FILES["download"]["type"];
$file_temp = $_FILES["download"]["tmp_name"];
$file_path1 = "./uploads/".$download;
$status = move_uploaded_file($file_temp, $file_path1);

// Debug image 2:
printf(
    'Image 2 should have been moved from %s to %s. $status = %s',
    $file_temp,
    $file_path1,
    $status ? 'true' : 'false'
);

By the way, you do not need to add !important to inline style tags, as inline CSS always overrides existing CSS rules.

you may remove ads by installing AdblockPlus; Id not change anything on main page - its ok....

And it got worse and worse and worse each day. Less traffic also means less advertising revenue, and it got so bad that I've had to spend a huge portion of my savings just being able to afford our hosting bills to keep the site up over the past 2 years.

This is why I don't use things like Adblock. People hosting great sites don't have to do that for free, how could they? At least give them a fair chance of getting some income to play even (at the least).

Nice one! I think I've learned pretty much all I know about HTML and CSS using that website.

"Have you tried turning it off and on again?"

Kidding, but seriously, if this is a new installation, just reinstall and it will probably fix your problems.

Yes of course :). Google around a bit and if you have questions, come back here and ask about it.

You could place your functions inside an anonymous functions like so:

(function($) {

    $('#fancy_jquery_element').doFancyStuff();

})(jQuery);

If you mean the name attribute of a meta tag: that's to indicate what the meta tag is indicating ;).

Mate, do you have any idea what you are doing at all? :P What is is that you are trying to do? Are you trying to get an array of unique phone numbers or are you trying to output a comma separated list? Because if it is the latter, the only thing you'd need is echo implode(',', $_POST['numbers']);.

Could you formulate that as a full-scentence question? Maybe some context?

I only included the PHP to remove the duplicate numbers. You will have to print them yourself ;).

Ok because I do not fully understand from which directory you are calling your scripts, let's make clear we're on the same line here :).

So let's say you have directory C:\wamp\www\x. In x, you have src\autoload.php, i.e. C:\wamp\www\x\src\autoload.php. So when you are now inside directory x in your terminal, calling phpunit --bootstrap src/autoload.php tests/MoneyTest directs to folder src in your current folder, and to autoload.php in the src folder. Is this what you are trying, and is this where you are getting your "autoload.php cannot be opened" message?

Your code with comment:

$myarray = array();
$myarray['numbers']=$_POST['numbers'];
foreach($myarray as $num){
       $numbers=$num; // You aren't creating an array here. You are giving $numbers the value of the CURRENT number in the loop. PLUS your numbers are stored in $myarray['numbers'], not in $myarray ;).
}
$unique = array_unique($numbers); 
$output=implode("<br />",$unique);

What it should be:

// Assign $_POST['numbers'] to $numbers if it exists, otherwise make it an empty array.
$numbers = !empty($_POST['numbers']) ? $_POST['numbers'] : array();

// Output the result.
$output = implode('<br>', array_unique($numbers));

Nice find on the array_unique by the way :). If you need more explanation, let me know! Some explanation on the $var = $condition ? true : false line I used:

// This line..
$numbers = !empty($_POST['numbers']) ? $_POST['numbers'] : array();

// ..is shortcode for:
if (!empty($_POST['numbers'])) {
    $numbers = $_POST['numbers'];
}
else {
    $numbers = array();
}

Well first thing that comes to mind: did you check if src/autoload.php points at something that exists from the directory you're in? :p And do you have permission to read it?

Oeh but the "Discussion starter" button next to a discussion starter's name is nice though :)

Oh I have another one! (Hopefully you don't take this as bad criticism because that is not the way I mean it :))

On the homepage, there's this enormous "post a new article" box, while 99% of the times I just want to read and see where I can contribute. I think most people usually tend to read first (especially regular visitors). Maybe it would be an idea to make that form hidden by default and slide down or something when you click a "post new article" button? And if possible, place the subforum/section selection section (yay what a name) a bit more to the top (unfortunately the ad is there, and I don't want to say "remove the ad", because you might need it there, but it's just a thought!) - that would help people get to where they want to go faster.

dtpp commented: you may remove ads by installing AdblockPlus; Id not change anything on main page - its ok.... +0