hericles 289 Master Poster Featured Poster

I think he was refering to an app that is nothing more than an in-app browser (a web view) that points to your website. Meaning the app wouldn't work without an internet connection (probably not an issue).

hericles 289 Master Poster Featured Poster

You only set the sql statement once but at line 17 you're using it as part of an IF statement:
If sql = "SELECT Usertype FROM [db_dole].[dbo].[tbl_user] WHERE Usertype = 'Admin'" Then
Which will never be true so that's part of the problem.

Otherwise you're on the right track. You just need to pull out the user's role from the database when they log in and adjust your form accordingly.
And, remember, every time you pass unfiltered text into an SQL query a little puppy dies.

ddanbe commented: Your last sentence! :) +15
Miurei commented: acctually I used almost the same code and got the result right... :) thanks anyway +0
hericles 289 Master Poster Featured Poster

Try this (untested by me)

DELETE FROM data2 where id in (
    SELECT id
    FROM data
    WHERE no_2 = no_1 + 1
      AND no_3 = no_2 + 1
      AND no_4 = no_3 + 1
      AND no_5 > no_4 + 1
  UNION
    SELECT id
    FROM data
    WHERE no_2 > no_1 + 1
      AND no_3 = no_2 + 1
      AND no_4 = no_3 + 1
      AND no_5 = no_4 + 1
)

I guessed at 'id' being a column, use whatever is appropriate to return one column for the 'in' clause.

hericles 289 Master Poster Featured Poster

echo "<select name='name' id='name' <?php if ($stat =='a'){ echo ('disabled');} ?> >";

I haven't actually tested that but the main point is you need the <?php ?> tags otherwise you're just going to echo out the if statement as text.

hericles 289 Master Poster Featured Poster

You can do one search but you'll need to add in WHERE clauses, one for each word in the search string. E.g.
SELECT * FROM [SearchTable] WHERE [key_Word] LIKE '%get%' OR [key_Word] LIKE '%red%' OR [key_Word] LIKE '%cat%';
That can get reasonably big when searching for a lot of words of course.

hericles 289 Master Poster Featured Poster

If you want it to be cross-platform on mobile you can look at using Cordova (Phonegap) or Xamarin. Both can be used via Visual Studio once you've installed some extras and you'll be able to build using your javascript knowledge. Any server side components can still be down in PHP if you wanted to, using whatever IDE you prefer.

hericles 289 Master Poster Featured Poster

In the source I can see that the flickty-slider has this CSS transform specified:
transform: translate(791px);
Turning that off pulled the slider over to the correct position.

And I only just saw this has already been answered. Excuse me.

hericles 289 Master Poster Featured Poster

No errors in your console log? Or is c never greater than d (the onblur is firing but your output never happens)?

hericles 289 Master Poster Featured Poster

You can load up what is called a CSS reset file first, this is just a standard CSS file but it resets a lot of display properties to default. You then apply your site's CSS and you should achieve a level of consistency across browsers.
You don't have to write a reset file yourself, google css reset and you'll find ones ready to download.
That may not fix all of your problems however - if you have specific issues after using the reset file you can post them up.

hericles 289 Master Poster Featured Poster

You need to give us more information. What exactly are you stuck on? What is going wrong?

hericles 289 Master Poster Featured Poster

If your code example here is the same as your actual code you have several problems.
Line 17:
echo "<table>";
Line 18:
echo "<tr><th>Airport</th><th>City</th><th>Code</th></tr>";
Line 21: your inner arrays only have 3 items so you don't need to loop to 10
for ($col = 0; $col < 10; $col++) {
And, lastly, you don't have a closing </tr> inside you col loop, which is probably making your table present itself in a way you don't intend.

hericles 289 Master Poster Featured Poster

The only problem I had with this code is that you ask for a seven digit number to be input but your check in GetInput looks for whether the input string is of length 8, not 7.
Enter an 8 digit number and everything works just fine.

hericles 289 Master Poster Featured Poster

Do you mean you want to hide the actual numbers themselves?
CSS:
.bx-default-page {display: none;}
If you're after something else I think you'll need to be more specific...

hericles 289 Master Poster Featured Poster

I'd suggest learning coding first if you need to pick one. Give yourself an understanding of how to code and do some small projects, etc. Then when you come to learn algorithms you'll be able to see how your code could be improved. Your previous mistakes and in-efficient code will help the new stuff make sense.

hericles 289 Master Poster Featured Poster

Are you trying to swap various CSS style rules on a click event or do you want to switch to another stylesheet altogether?
if you want to alter the appearance of only a couple of elements then jQuery's .addClass or .css will be all you need.
If you want to switch to an entirely different stylesheet you can look online for 'stylesheet switching' and find js code that does that.

hericles 289 Master Poster Featured Poster

You can loop through the numberList examining each number and its count. Take the first number as being the highest and store it in another variable e.g. int highestCount.
For each number in the list, compare it's count to highestCount. If it is higher, replace highestCount with the new count and store the number as well.
If a number has the same count as highestCount you'll want to keep it as well, dumping it only when highestCount is again replaced but another higher value.

hericles 289 Master Poster Featured Poster

Cordova/Phonegap. I've built a couple of apps this year using Cordova and maintained a couple of others. It's a pretty easy learning curve, heaps of plugins and dev tools to help you - I do my cordova programming in visual studio 2015.
The down side of cross platform, if you're oding it yourself, is that at some point you still need a mac to build the iOS version (if you work on Linux or windows).

hericles 289 Master Poster Featured Poster

Most systems would create the menu by checking which elements should show. Typically that would entail checking if the user was logged in or not and displaing the log in/register stuff if the they weren't.
So, you wouldn't need to create a whole new menu, you just use the checks to determine which <li> elements get created.
But, essentially, you're on the right track.

hericles 289 Master Poster Featured Poster

You can store the current login attempts in a session variable and then check that variable on each attempt, incrementing by one for each failure.
When it hits 3, you can echo out the submit button with the 'disabled' attribute

<?php if($_SESSION['failedLogins'] == 3) {
 echo "<td><button type="submit" name="btn-login" disabled>Sign In</button></td>";
 } else {
  echo "<td><button type="submit" name="btn-login">Sign In</button></td>";
 }
hericles 289 Master Poster Featured Poster

Use jQuery's addClass to apply a new CSS style.

hericles 289 Master Poster Featured Poster

The key is in the line "none of the labels are on the right box".
When you pull one fruit out of each box you're going to get 2 apples and 1 pear or 2 pears and 1 apple.
For example, if you reach into the box labeled apples and pull out an apple you know it is the mixed box because it can't be the apple box (the label is wrong). Alternatively, the same result works for the box marked pears. Given you only have three boxes, one must give you a fruit that it says it can't. You can re-label all of the boxes after that.

hericles 289 Master Poster Featured Poster

You haven't mentioned what form sub_marks takes so I'm going to assume it is a 1d array of marks, the first 5 elements belonging to student id 1, the next 5 to student ID 2, etc.
So, adding a counter and using that as the the sub_marks index will work

$std_id = $_REQUEST['std_id'];
$sub_id = $_REQUEST['sub_id'];
$sub_mark=$_REQUEST['sub_mark'];
$total=$_REQUEST['total'];
$counter = 0;
for($i=0;$i<count($std_id);$i++)
{
   for($j=0;$j<count($sub_id);$j++)
   {
     mysql_query("INSERT INTO mark_tbl(std_id,sub_id,mark)VALUES('$std_id[$i]','$sub_id[$j]','$sub_mark[$counter]')");
     $counter++;
   }
}
hericles 289 Master Poster Featured Poster

You don't want to be using submark[$j] as that just repeats the first values (0 through to whatever size j is).
You want to have another counter that starts at zero and increments at the end of each inner loop. Or structure your marks array to be two dimensional and then refer to submark[$i][$j]

hericles 289 Master Poster Featured Poster

Nice trick, I had to sit down and figure out how that worked or it would have bothered me for the rest of the day.

hericles 289 Master Poster Featured Poster

You can use the 'required' html attribute by adding it to the necessary fields.
Or you can use a javascript function on the click event of the submit button to check all inputs and only if all pass validation does the function return true and let the submit continue.
Or you can still submit the form but use PHP code to check the passed parameters and either process the form or pass errors back to the page.

hericles 289 Master Poster Featured Poster

Are you getting any error messages or output you don't expect?
First step is to make sure you're getting something back from your query and then step through from there.
I did notice in your explanatory table you had 'qty' but in your code you use 'quantity' - do the column names match what is in the database?

hericles 289 Master Poster Featured Poster

More information needed. Why do you need AJAX to do a countdown and what do you intend to save to the database?

hericles 289 Master Poster Featured Poster

PHP is server side code, it needs to be ran on a server (Apache running on your PC for instance). A collection of PHP files sitting on your PC won't run correctly. A browser will serve up the HTML ok but any PHP won't do anything.

hericles 289 Master Poster Featured Poster

Sorry, but to check something, when you say "At the moment if I just make a simple html page" you mean you make a page with a .php extension and run it on a server right?

hericles 289 Master Poster Featured Poster

First step is to check what $info actaully contains.
Below
$info = fetch_server_info($config['server']['ip'], $config['server']['port'];
add
var_dump($info);die();
Run the page and the contents of $info will get output to the screen.
Ou tof curiosity what does get put onto the page now?

hericles 289 Master Poster Featured Poster

Cloud computing, big data and security would all be good fields to get into so I'd give them so special consideration.
I'm not sure what you would do for a security project though...
Cloud computing would probably offer the most scope for coming up with something possible but sufficiently challenging. But,as to what to do exactly, I don't know...

hericles 289 Master Poster Featured Poster

In mysql a blob has a maximum size of 65 kilobytes whereas I believe the mysqlite version of a blob is significantly more than that (I'm assuming you are using mysqlite when you say you're saving the image to android).
You'll need to increase your MySql blob type to mediumblob or longblob.

hericles 289 Master Poster Featured Poster

Alert boxes can't be customised too much. I would suggest looking into some of the javascript libaries that do that for you. SweetAlert is one I've used but there are others. You can vary the text and add images into the message.

hericles 289 Master Poster Featured Poster

Is current undefined or is eventInfo?
Where are you creating the datepicker object? E.g. where is this line:
var datePicker = new WinJS.UI.DatePicker(element, options);
I only looked into this briefly just now so what I'm asking is, is line 8 and 9 in your code the same as the object instantiation above?

hericles 289 Master Poster Featured Poster

Look into the jQuery .change() method. You can attach it to a select element with something like this:

$( "#myselect" ).change(function() {
  // your code to run on a change event
  // in your case, getting the 'cover' element and changing its src
});
hericles 289 Master Poster Featured Poster

It depends how you are handling the data but, for example, if you were pulling each record from the database as it was needed your first and last buttons would be queries that extracted the first and last matching record respectively - use order by asc/desc limit 1 (for mysql) to get the single record.
If you have the records stored in some form of data store then you just need to access index 0 or index length - 1.
BindingContext(DataSet11, "students").Position = 0
or
BindingContext(DataSet11, "students").Position = DataSet11.Rows.Count - 1

hericles 289 Master Poster Featured Poster

I don't mean to sound like I'm brushing you off but examples of database queries are pretty common online. You should be easily able to find something in your preferred language that you can then adapt or extend to what you need.
Once you have the basic outline you can post back on here about any particular problems you have.

hericles 289 Master Poster Featured Poster

It seems to me you are adding a parameter called TotalPrice to your parameter collection but you never give it a value.
You can either use:
constr.Parameters.AddWithValue("Total price", 'Some value');

or
constr.Parameters.Add("Total price");
constr.Parameters["Total price"].value = some value

hericles 289 Master Poster Featured Poster

That would be the script that accesses the database. Say for example it was a php file called getInvoices.php then you would have the full path to the script. This can also be a web URL e.g http://

hericles 289 Master Poster Featured Poster

Run a CRON job every day that reads the database for all invoices that have a submission date of 30 days ago. Email out only those emails.
So, your cron job will look like this:
30 1 * * * /call-your-script

That will run at 1:30 every day - you can change the time to suit what you need.

hericles 289 Master Poster Featured Poster

Firstly, why use javascript and AJAX to call a PHP script in the first place? You could just have PHP code in your HTML that handles the database stuff on the post back of the form.
Secondly, you could jQuery or similar to do the AJAX stuff much more easily.

But, if you want to figure out what is wrong with the code you have you need to know which part is failing. Either debug your PHP code or alter it to write to a file when called so you can check that the AJAX call to the script is working OK.
Then you need to check your database connection. And if that works then you need to check the values being returned. Once you know where the problem lies you can do something about it.

hericles 289 Master Poster Featured Poster

Your code looks OK, there is nothing that immediately stands out anyway.
So you need to tick off everything is working correctly.
Can you connect successfully to the database (does another query provide the correct results)?
Do the username/password variables hold actual values?
In your login function do both of the queries work and return values?
If you can't debug it at least dump out the variable values and the SQL statements so you confirm what is happening. Run the SQL into against the the database in the command line or similar to make sure that gives you what you would expect to see.

hericles 289 Master Poster Featured Poster

Alter your URL to be just the path with no parameters
<?php echo base_url('Register/get_countries')?>
As you have it, the post parameters don't include a parameter called 'q', only $_POST['queryParam'] should exist.
So, you can either edit the script to read the correct $_POST variable or take out the query from your URL and remove the default parameter name (the queryParam: q part)

hericles 289 Master Poster Featured Poster

Your <table> tags are wrong. it is incorrect to do this:

<table>
some value
</table>

You need the <tr> and <td> elements as well. You also can't have a <table> positioned the way you have it at line 48.
Move your PHP code from where it is currently (between two <tr>'s) and put it at the top of the page. You might see different results.

hericles 289 Master Poster Featured Poster

I just started using the same library for a project too.
You haven't mentioned what the parameter matches in the database so I'll assume you want to check for a country name that equals the q parameter (not the correct case I know).
In this case you can do this:
$sql = 'SELECT country_name FROM nm_country where country = '" . $_GET["q"] . "';

hericles 289 Master Poster Featured Poster

Have you hard coded the connection string in the app but the path doesn't existon the target machine?

hericles 289 Master Poster Featured Poster

Where the interviewers referring to natural keys? Or composite keys? Thats a unclear question.
If you don't know already, a natural key is a column in a table that uniquely identified the records but is part of the natural data, say, a social security number or employee number, something that dircetly relates to the row in the way that a primary key doesn't but is still distinct among the records.
A composite key is a key made up of several fields from the table, the result of which is a unique key e.g. someone's phone and email combined.
Or they could have been after GUIDs...?
Hope that helps.

hericles 289 Master Poster Featured Poster

PHP generated HTML arrives at the client's browser the same as any other server generated HTML - that is, it presents itself as nothing but HTML. There are <?php ?> tags in what is received. So the answer to your first question is yes, CSS and javascript can be used to target classes/IDs you generate in PHP because CSS and javascript can't tell the difference.
You may find it useful to get into the style followed by most open source PHP platforms where actual processing PHP (database operations/ calculations, etc) are done in a class while outputting PHP (making HTML) is in a template file. The separation will help kep things in order. Have a look at Smarty and similar templates to get an idea.

hericles 289 Master Poster Featured Poster

Magento - it is free for the community edition, it works pretty well out of the box without customisation, there are many extensions that you can add, there are a heap of good looking themes around and if you do want to add special functional that you can't find an extension for, its bit of learning curve but very powerful. And it has a good API should you need to connect to other websites/apps/etc.

hericles 289 Master Poster Featured Poster

That works for me and I can't see anything wrong. But you should check for whitespace on line 7 though. Extra white space can interfere with <<< functionality.
Putting a space at the end of line 7 broke what was working for me just now.