hericles 289 Master Poster Featured Poster

That should work, assuming you wanted the second parameter to be the start point at which the pattern is matched.
Of course, in your post you have an extra ')' but I'm assuming that is a typo. What is the error?

hericles 289 Master Poster Featured Poster

Then you just answered your question didn't you?

hericles 289 Master Poster Featured Poster

I would guess that you want one loop to be inside the other:

for(i=0; i<=5; i++)
        {
            System.out.println("factors of "+num[i]);
            System.out.println("");
           for(n=1; n<=num[i]; n++) the problems is here also 
           {
               if(num[i]%n == 0)
               {
                   System.out.println(n);
               }
           }
        }

Otherwise you're printing "factors of..." 5 times and then moving onto a loop where i isn't what you think it is.

hericles 289 Master Poster Featured Poster

Huh, I'd completely forgotten about INSERT INTO ... SET :)
The code segment you've shown us should work fine (I can't see any errors anyway) so if you mean that the first INSERTION is completely replaced by the second in the database there must be something else going on. In particular there must be an UPDATE somewhere, or the first INSERT isn't getting called or is failing.
You mention a maximum of 4 records. What happens at reaching four? Are no more possible or is a previous one removed? You could have a logic error in that code.

hericles 289 Master Poster Featured Poster

I'm not an expert in the requirements of recording financial transactions but I wonder why two tables would be needed, they'd each mostly be a duplication of the other.
One table listing buyer, seller, date, auction, sale amount and whatever other details are needed would seem adequate.

hericles 289 Master Poster Featured Poster

Some things that can be wrong
1) That user doesn't exist
2) the username is wrong
3) the password is wrong
4) User exists but doesn't have access to that database

If you have direct access to the database you can check all of those out.

hericles 289 Master Poster Featured Poster

Without giving away too much, you need the two loops, one for the rows and one for the columns. You need to figure out how to organise the loops so for each row you put in the correct number of columns. Try to think of it in terms of what actions you need to carry at at each step of the way - it should become apparent.

if you're wondering why I didn't just give you code, well, this sounds like an progamming homework/assignment stuff and you need to be able to figure how to create algorithms yourself or you'll never be good at this.
Having said that, if you show us a pretty good attempt that isn't quite right, I'm sure someone would help you finish it off.

hericles 289 Master Poster Featured Poster

Do you mean something like the Regex.Match() method? You intend to search a string for a pattern correct?

rproffitt commented: Was looking into that. Yes, that's it. +7
hericles 289 Master Poster Featured Poster

Could you use the response.redirect to open the page in the current tab and from there, using javascript window.open, make opening the new tab one of the first things your second page does. That's almost what you're doing now, just the flow is different.
In your current example it looks like you're not calling the script you set up (maybe, been a while since I did registerstartupscript stuff).

hericles 289 Master Poster Featured Poster

And what problem are you having?
Is it the typo in 'select producs.' in your SQL statement? Or something else?
Seeing as your only using a few of the selected columns you can change your query from selecting all to just the ones you need. ut that won't fix the undescribed problem you're having, it's just a tip - Selecting all every time is just lazy ;)

hericles 289 Master Poster Featured Poster

As with a lot of people that post on coding forums, you need to help us to help you.
The statement "the checkboxes don't work" is hopelessly vague. You would be better off telling us exactly what the expected behavior should be and what you actually see. Then we have something to work with.
You say your checkboxes don't work but your form doesn't even include any, you've got radio buttons only.

Edit your question with what you really need to achieve please.

hericles 289 Master Poster Featured Poster

You haven't included the CSS style rules for the classes used or any media queries that you are set up. Without those we're flying blind.
You do have media queries right?

hericles 289 Master Poster Featured Poster

You haven't mentioned what is happening or included your code class so we don't have much to go on. I would suggest adding code to output PHP errors on the page and see what errors/warnings you get.

hericles 289 Master Poster Featured Poster

What search terms are you targeting? If you're trying to compete on terms like 'web design' you've got long road ahead of you...
Having just checked your meta tags it appears you are. If you're trying for local business only you can add 'India' or your city after each term as that is what local customers will search for.
I ran an SEO tool against your site and you scored 61.
The main problems were uncompressed js and css and a large amount of uncompressed HTML, all adding to a slow load time - which affects how google views your site. It also got flagged for no social media activity.

hericles 289 Master Poster Featured Poster

You didn't include the schema for the loan table in the initial post but all you need to do is include another join on the loan table. If the loan table has a customer ID (which I'm assuming it does), then turn the select statement into this:

SELECT c.*, i.*, loan.* FROM customer c 
JOIN income i ON c.customer_id = i.customer_id 
JOIN loan ON loan.customer_id = c.customer_id
WHERE c.customer_id NOT IN (SELECT customer_id FROM income WHERE date = CURDATE()) and loan.loan_status = <WHATEVER INDICATES UNPAID>
hericles 289 Master Poster Featured Poster

Turns out that was my bad, put quotes around the input seeing as its a string.
$q = "INSERT INTO Owners(Names) VALUES('$t');";

Without the quotes MySql didn't recognise $t as a string of characters.

hericles 289 Master Poster Featured Poster

Have you confirmed that the dataTable actually has some rows in it? The usual steps for a problem like this are: catch any errors (which you'll doing), confirm your sql statement works directly against the database and returns results, check your result in your code holds some data, double-check your display tool.
Somewhere along the way you're find what is going wrong.

hericles 289 Master Poster Featured Poster

If you want but you implied you wanted today's transaction and NOW() gives you the current date. It's just simplier than passing in a variable you don't need.
If you wanted to check for a particular date then, yes, you can pass in whatever date you need.

hericles 289 Master Poster Featured Poster

It's missing a closing }, ad another one at line 22 (making the ?> on line 23).
Is the code in the comment above in the exact same format as in your IDE? I'm refering to where each line starts in relation to the others here.
If it is you would benefit greatly from correctly indenting your code. Mistakes like missing } show up much easier.
If that was just the result of pasting it into the editor here then ignore that last part :)

hericles 289 Master Poster Featured Poster

These don't match:
<input type="text" id="Username" placeholder="Username">
user = document.getElementById("User").value;

The <Us> element has an ID of User so you're selecting the wrong element.

hericles 289 Master Poster Featured Poster

I think this will work (not tested). The important part is the inner select that returns all customer who DO have a record made against today's date and then you want to select the customers that are not in that list.

SELECT c.*, i.* FROM customer c 
JOIN income i ON c.customer_id = i.customer_id 
WHERE c.customer_id NOT IN (SELECT customer_id FROM income WHERE date = NOW())
hericles 289 Master Poster Featured Poster

Your exploding the textarea variable but not using your array anyway for one thing.
You'd want to get array after checking if the POST varibable exists and then, if each element is to be an insertion of it's own, do a foreach through the array, with your prepare and execute inside that.

    if(isset($_POST['textarea'])){
         $textarea= $_POST['textarea'];
         $textarray = explode("\n",$textarea);
        foreach($textarray as $t) {
           $q = "INSERT INTO Owners(Names) VALUES($t);";
           $query = $odb->prepare($q);
           $results = $query->execute();
    }
hericles 289 Master Poster Featured Poster

Your signatures for the userExit method don't match. You're calling it with no parameters but the method signature expects a variable called empCode.

hericles 289 Master Poster Featured Poster

Right, I should have seen the code you linked in your first post, my bad. You have this line:
$dbh = new PDO('mysql:host=localhost:1433;dbname=ItemAssetDB', '', '');
which is, obviously, using PDO to connect to a mysql instance - which isn't what you're trying to do.
First step is to switch that line to:
mssql:host=localhost;dbname=testdb
and see what happens.

hericles 289 Master Poster Featured Poster

This is a bit confusing, you seem to be jumping from referring to MySql databases to SQL Server databases.
What db type are you trying to connect to, what is the exact error you are getting now and is it for all connections or when you are trying to a certain thing (like insert or date records)?

hericles 289 Master Poster Featured Poster

You'll have to double check each x item in your list. One of them doesn't have a value for the name property. The null pointer exception really only means one thing: the value it refers to is null.
Step through the loop in the debugger, wait for it to error and go back a couple of lines, check which item in the loop you're up to and confirm it's values.

hericles 289 Master Poster Featured Poster

It shouldn't be much different from what that article contained, the idea is fairly well explained. Is there something in particular that is causing you trouble?

hericles 289 Master Poster Featured Poster

I'm not an expert in Mongo at all but have you tried it with double quotes around the text string instead of singles?
Single quotes can be an escape character in SQL and may be in mongo too, in which case the ) isn't being read as such.

hericles 289 Master Poster Featured Poster

The PHP manual has this to say about the mysql_select_db method's second parameter (called the link identifier):
Link Identifer:
The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() was called with no arguments. If no connection is found or established, an E_WARNING level error is generated.
It loks more, like you have your parameters in incorrect order in that line, In the previous musql_select_db you have a string and then the connection.
And kulcsarb has a point, you refer to $this->cnx and $this->cnxSP. That's not a typo?

hericles 289 Master Poster Featured Poster

Any errors showing in the console?

hericles 289 Master Poster Featured Poster

And do you have the ability to access the site via FTP or similar?

hericles 289 Master Poster Featured Poster

Is the actual error "Error establishing a database connection"? And has the support guy been able to give you any further information from the server logs?

hericles 289 Master Poster Featured Poster

That error would generally happen because the select statement has returned an empty set, which is why the row count is zero. Double check your sql statement is working as expected by running it directly against the database.

hericles 289 Master Poster Featured Poster

Given the easy nature of the string you can split on the '%' character and end up with an array of the text you are after.
The hard part is if the inputs aren't in the same order as the string or any kind of dynamic sorting is required. That's a fairly simple answer though, is that what you were after or did you have an tougher, more specific problem?

hericles 289 Master Poster Featured Poster

I'm not familar with tha particular tool but I've found the device mode option available in Chrome Inspector is pretty good and I've never had issues with a page not matching between the device and the inspector.
Having said that, nothing beats testing it on the actual device.

hericles 289 Master Poster Featured Poster

If the sql files is a list of INSERT, SELECTS, etc, read the file via a stream reader and execute each line as a standard query i.e. the text in each line becomes the string that makes up the command text.
Alternatively, you can execute a command line process with something similar to this:
"C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin\mysql.exe" -C -B --password=[password] -P 3306 --user=[username] --host=localhost --database=[database] -e "\. C:\Backups\Mybackup.sql"

That came from this SO article: http://stackoverflow.com/questions/13648523/how-to-import-large-sql-file-using-mysql-exe-through-streamreader-standardinp. Most the command should be obvious and the -e bit is the important part, it points to the file you want to execute.

hericles 289 Master Poster Featured Poster

Where in the page is the script running? If it is before the element then your script is looking for an element that doesn't exist exist yet.
If you were using jQuery you'd wrap it in the document ready method. In plain javascript you'd call the function in the onLoad call in the body tag.
But seeing your code would help too.

hericles 289 Master Poster Featured Poster

Could you define 'not working' and which IE version? I just copied your code and it worked in both Chrome and IE 11.

hericles 289 Master Poster Featured Poster

I think the amount of data and how you need to interact with it should be the deciding factor. The avantage of databases is that selecting the information is easy, depending how complex your data is this may not be the case for an array.
The answer to your second question is yes, either storage method will allow you to do that but, again, the database will be easier to deal with and probably involve less code.

hericles 289 Master Poster Featured Poster

You haven't mentioned what language you intend to be using for this but the answer is yes, it's possible. Depending on what functions you have available in your chosen language you need to determine the location of the last \ and then create a substring from position 0 to the that last '\'.
A lot of languages have methods that will provide you with the file name, the thing.exe part of a path as well, which would allow to do a replace, swapping the file name with an empty string. Or alternatively return the path with the file name removed automatically.
If we knew what language you were using we could provide actual examples.

hericles 289 Master Poster Featured Poster

You could start by telling us what you intend to build it in (lanuage, platform, etc) and what bits you actually need help with (please don't say all of it). It's even better if you reach an actual specific problem that you can't solve and post a question about that.
Questions like this are way too open to be of any use to anyone.

hericles 289 Master Poster Featured Poster

Does the error message provide useful information? If you have another way of accessing the database, control panel or ssh, etc, you can test out connecting via those means.
But the basics you have there look right from a code perspective so the problem might lie in the username/password or configuration that your host hasn't set up right.

hericles 289 Master Poster Featured Poster

In the code you've posted the sub method whoWins never gets called. Call that method after both hands have picked and it should work

hericles 289 Master Poster Featured Poster

you might want to look at using a service like MailChimp. They have plenty of tools for auto responding emails, coupons, etc. There are quite a few options out there but I've used MailChimp a bit and it's a very good system (I'm not affiliated with them in any way).

hericles 289 Master Poster Featured Poster

Is the PHP process started via AJAX? If it is, you can display a spinner gif when the AJAX call is first made (using jQuery or similar) and switch it off when the reponse comes back.
If the page starts the script and then redirects you can just have a spinner without worrying about the AJAX part.

hericles 289 Master Poster Featured Poster

You could either do another AJAX query to return all of the conversations and use the result to update the comment area (could be slow depending on the amount of data) or you could use javascript to inject the new comment into the page, at the correct location, after the post has been saved.

hericles 289 Master Poster Featured Poster

Move your code into the click or change event of the checkbox.
You'll want to refer to the parent of the checkbox to make sure you are targeting the correct td.

$("td input['type=checkbox']").change(function() {
     if($(this).prop('checked')) {
         $(this).parent().css('background-color', '#somecolour');
     }
});

that should work, I haven't tested it myself but at the least, it points you in the right direction.

hericles 289 Master Poster Featured Poster

I'm assuming the user's have their roles stored in the database and you extract them out when the user logs in successfully. Once you have that stored in the session (or wherever you keep it).
Then you have options. If the edit profile pages are quite different you can create the required templates and use a switch statement to recirect to the correct one based on the role.
Or, you can have one template with all of the controls needed, and when it is loaded only the relevant options for each role get displayed.
The same logic can work for adding links to menus, etc.

shany0786 commented: ah thnks this solved my problem +0
hericles 289 Master Poster Featured Poster

In your constructor you're setting $this->db to be equal to $DB_con, and using $this->db in your login method.
So two questions: is $DN_con a valid connection when you pass it through to the class? And does the login method work?

if the login method works use $this->db and tour problem is solved. Otherwise make sure $DB_con is an open and valid connection and make sure it is available to the getShouts method.

hericles 289 Master Poster Featured Poster

There is no difference. You would be creating an app that would display HTML, using whatever view in that language achieved that effect.
For example, a native iOS app that was just a view of a web site would use an UIWebView, in Android it would be a WebView and if you were building in Cordova/Phonegap you need to add the inAppBrowser plugin (which is simply Cordova's way of generating the two above for those platforms).