minitauros 151 Junior Poster Featured Poster

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)?

minitauros 151 Junior Poster Featured Poster

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!

minitauros 151 Junior Poster Featured Poster

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

minitauros 151 Junior Poster Featured Poster

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.

minitauros 151 Junior Poster Featured Poster

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"?

minitauros 151 Junior Poster Featured Poster

What is in $birth[1]?

minitauros 151 Junior Poster Featured Poster

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.

minitauros 151 Junior Poster Featured Poster

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.

minitauros 151 Junior Poster Featured Poster

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?

minitauros 151 Junior Poster Featured Poster

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.

minitauros 151 Junior Poster Featured Poster

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

minitauros 151 Junior Poster Featured Poster

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.

cereal commented: +1 +13
diafol commented: +1 +15
minitauros 151 Junior Poster Featured Poster

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
minitauros 151 Junior Poster Featured Poster

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 :).

minitauros 151 Junior Poster Featured Poster

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 :).

minitauros 151 Junior Poster Featured Poster

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.

minitauros 151 Junior Poster Featured Poster

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).

minitauros 151 Junior Poster Featured Poster

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

minitauros 151 Junior Poster Featured Poster

"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.

minitauros 151 Junior Poster Featured Poster

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

minitauros 151 Junior Poster Featured Poster

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

(function($) {

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

})(jQuery);
minitauros 151 Junior Poster Featured Poster

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

minitauros 151 Junior Poster Featured Poster

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']);.

minitauros 151 Junior Poster Featured Poster

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

minitauros 151 Junior Poster Featured Poster

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

minitauros 151 Junior Poster Featured Poster

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?

minitauros 151 Junior Poster Featured Poster

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();
}
minitauros 151 Junior Poster Featured Poster

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?

minitauros 151 Junior Poster Featured Poster

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

minitauros 151 Junior Poster Featured Poster

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
minitauros 151 Junior Poster Featured Poster

It's cool that you are constantly developing Daniweb, but I feel that it's time to mention some things that I feel are missing since the last overhaul:

  1. Can't easily jump to subforums (like "PHP") any more. This isn't really a problem, because I used to just open the "Web development" section anyway, but I think it would be nice to include some tag filtering at the top of a forum now (or maybe in a fixed sidebar).
  2. Can't see who posted the last reply to a discussion. Usually when I see/saw someone of whom I know has knowledge about a subject reply last to a thread, I knew my help probably wasn't really needed there. Now I need to open the dicussion and find the last post to see what is going on.
  3. Too much spacing. There is just so much spacing right now that I don't really see any coherence between what information is related to what other information. Need more borders or clear section separtors. This applies at least to board overviews & discussions.
  4. What is that status bar doing at the top of a discussion (with the x views, 1 reply, etc.)? That is not information I need when I open a discussion. It is nice information but to place it so overly present at the top of the page might be a bit too much. I want to get down to business fast. See the question, see the first reply/replies, see if I can help. It …
joshl_1995 commented: So true! +0
dtpp commented: true; +1 +0
minitauros 151 Junior Poster Featured Poster

What exactly is not working? Are you getting an error? What are you trying to achieve?

minitauros 151 Junior Poster Featured Poster

nor that every non OOP PHP project isn't great (wow, I hope that triple negative phrase makes sense)

+1

minitauros 151 Junior Poster Featured Poster

You mean a thesis about the web? Or a thesis built with the web?

In either case, I think you will need to come up with at least SOME kind of idea about which you could ask us feedback and/or questions to elaborate on, because we cannot invent the wheel for you ;).

minitauros 151 Junior Poster Featured Poster

Nope. One request will be handled with each call. You will only run into problems if for example request A changes a session var that request B needs as well.

minitauros 151 Junior Poster Featured Poster

I think something like this should work:

document.getElementById('submit').click();

But why the hell are you creating a countdown redirect if nothing actually happens during the countdown? :p

minitauros 151 Junior Poster Featured Poster

So if there is more than one occurence of the same product with the same percentage, you don't want it listed?

minitauros 151 Junior Poster Featured Poster

Ahhh, so what you want to achieve is that when the user clicks the link, a popup (modal) opens up with a form that can be used to edit the record that was clicked?

If so, I think you should either look in the library that you use to open that modal (if you use one) how you can pass on data to that modal window. Or, if you are using some kind of custom implementation, you will probably need to write some Javascript to set the ID of the clicked element and then use more Javascript to pass it on to the modal window that is opened.

If you need help with that last part, let me know, and let's then also see what you can write/have written yourself :).

minitauros 151 Junior Poster Featured Poster

Sorry, forgot to explain that other bit. Thanks Diafol! Nice addition.

minitauros 151 Junior Poster Featured Poster

I am a bit confused. Which ID is it that you want to use? An HTML ID? To pass to a script that handles your AJAX call?

Maybe it would help if you would highlight the lines your question is about?

minitauros 151 Junior Poster Featured Poster

Well, a quick search on Google seems to result in an answer to your question.

See http://stackoverflow.com/questions/3366895/group-by-month-and-year-in-mysql

minitauros 151 Junior Poster Featured Poster

Well, if you submit a form, the data doesn't just become available in regular variables (like $id), it becomes available in a special var. Depending on your form's method (get or post), it becomes available in $_GET or $_POST.

Seeing that your form's method is post, your data would be available under the $_POST array, e.g. $_POST['id']. You could try if that works?

Also a notice here: using the global indicator in a function is generally considered to be bad practice, because you never know which files may alter the variable you're importing from the global scope. Rather you'd pass the variable to the function, so that you're always certain that you have the right data available. For example, your function would then become function links($id, $connection). Even better, you could create a class that groups all database functions and data. See this link for the first tutorial I could find on using classes in PHP.

minitauros 151 Junior Poster Featured Poster

Maybe you're trying to redirect to a local page while not working locally?

minitauros 151 Junior Poster Featured Poster

Well, you can't "just" pass it to PHP. You will need to work with it in Javascript. If you need it in PHP, maybe you shouldn't be handling this stuff with AJAX at all?

minitauros 151 Junior Poster Featured Poster

Maybe you're ending up in an infinite redirect loop? Have you tried disabling all redirects and see if anything happens?

minitauros 151 Junior Poster Featured Poster

What error does the browser say is occuring?

minitauros 151 Junior Poster Featured Poster

You can't specify target table 'telefonisti_podaci' for update in FROM claus

This looks like a non-default MySQL error. Maybe it's a custom error triggered by your CustomQuery function? If so, then you could check that function to see when and thus why it is thrown/given.

minitauros 151 Junior Poster Featured Poster

If you know how to do one AJAX request, what is it that prevents you from doing two? :)

Any code that you have written that we can check for errors or give suggestions on?

minitauros 151 Junior Poster Featured Poster

Are you sure you are asking about PHP? Because creating a dropdown menu is usually done using CSS. Filling it is what you can use PHP for. So which are you asking about? :)

minitauros 151 Junior Poster Featured Poster

You may be able to find it in include lines. Usually it is used - like pritaeas says - to specify a path where for example files to include can be found (which is mostly in your project's directory).