Traevel 216 Light Poster

still not add to cart

    <?Php
        $_SESSION['cart']=array(); // Declaring session array
        array_push($_SESSION['cart'],'flight_time'); // Items added to cart
        echo "Number of Items in the cart = ".sizeof($_SESSION['cart'])." ";
    ?>

Does that not result in a 1 being printed? You've added the word 'flight_time' to the cart. But, you're doing it inside the search page itself, not via a post to the update-cart page.

From the tutorial:

 <form method="post" action="cart_update.php">

This line would be in the search page, it will post all the form contents to cart_update.php. Then, in cart_update.php you will do things like:

foreach($_POST["product_qty"] as $key => $value){
    if(is_numeric($value)){
        $_SESSION["cart_products"][$key]["product_qty"] = $value;
    }
}

for instance to add a $_POST variable called 'product quantity' (sent by the search page) to the session cart.

Traevel 216 Light Poster

im still newbie to php

Then I suggest following a simple shopping cart tutorial like this one for instance and work your way up from there. It uses mysqli and covers the basics. You can download the files from the bottom there, but the best way of learning is by doing.

And if you just meant the action method part, I was referring to <form method="post" action="">. It's empty, so it won't post anywhere. From the tutorial: <form method="post" action="cart_update.php"> would post your form to cart_update.php. The logic for handling the form would reside there.

Traevel 216 Light Poster

The form has no action, so it's not sending anything anywhere. You'll need a page to act as "cart" and process/validate the selected flight there.

Also, do not use the deprecated and insecure mysql API, but instead use PDO or mysqli. You can find more information here.

There's also no reason to use $_REQUEST here, use $_POST instead and check if it is set or not.

Traevel 216 Light Poster

You're using JOptionPane.showMessageDialog inside the loop, which is why you'll get a lot of dialog windows. The input String you defined is not being filled, so it stays blank. Replace the method calls inside the loop and store the information in input instead.

Secondly, by using the integer type for fahrenheit and celsius the values are being rounded and thus you're losing accuracy. Use a double (for both) instead.

Also, you're increasing Celsius by one before printing, resulting in a wrong output for celsius.

FYI, the variable names Celsius and Fahrenheit, by convention, should not start with a capital letter. If you're using an IDE you can easily rename them all at once by right clicking on them, selecting "refactor" and then "rename".

Traevel 216 Light Poster

Empty the receipt String at the beginning of the actionPerformed. Each order you run by all the checked items and, if checked, append their value to the already existing String.

You can set the value of a JTextArea by using its setText() method. You could call that at the end of the same actionPerformed.

Traevel 216 Light Poster

It's in the zip.

2015-04-17--1429300746_779x460_scrot.png

If you have a lot of different file types to work through, perhaps Apache Tika is an alternate solution to your problem. It uses POI and many others, but combines them into a single API for mimetype detection and metadata/content extraction.

Alternatively, if you're using Maven you can just add

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>3.11</version>
</dependency>

for POI or

<dependency>
    <groupId>org.apache.tika</groupId>
    <artifactId>tika-app</artifactId>
    <version>1.7</version>
</dependency>

for Tika.

No need for manual downloads that way. You can read up on Maven in Eclipse here.

Traevel 216 Light Poster

matter of fact they were patient and helpful.

If they were you wouldn't have had to ask again here.

i did declare it as stated and it was still doing the same thing.

I never read my telepathy book. You did not declare it in the part you posted.

But let's move on.

You declared the variable. So it's not throwing an error on that. Read what you are writing:

if(Character.toUpperCase(inputChar) ==('F'){
    inputChar = input.next().charAt(0);

    // do stuff
}

Those two lines. What is happening? In what order is it happening? What is supposed to happen? And in what order is it supposed to happen?

It's not executing because inputChar is not containing f or F. Why is it not containing f or F?

Ask the user's input first, then check that input. What you're doing is checking first, then asking.

Traevel 216 Light Poster

thanks traevel for the help and insults.

It wasn't an insult, it was meant to stimulate a little thought on your end as to what you were actually writing there.

when you also in your learning stages of java

When I was learning Java I at least took the time to read the very first chapter of my textbook. And I did not ignore people's answers to my questions. Or did you forget you already posted this same part of code last time. Read James' comment again. Declare the variable before using it. It's chapter 1, paragraph 1 of any Java book.

Or keep posting the same question everywhere and see if someone will eventually write it for you.

Traevel 216 Light Poster

if(Character.toUpperCase(inputChar) ==('F') || Character.toLowerCase(inputChar) ==('f'))

Are you the chairman of the Department of Redundancy Department?

Traevel 216 Light Poster

Same as you did with the <td>'s.

echo '<td><a class="btn btn-success" href="update.php?id='.$row['img_id'].'">Update</td>';

Also, don't use the mysql API, it's deprecated. Go with mysqli or PDO.

Traevel 216 Light Poster

HTML is not a protocol.

Follow a tutorial on REST. Learn how web pages can interact with a REST API and start simple.

Traevel 216 Light Poster

Java has GUI's yes.

1.) keep a list of all the movie available.

In what?

3.) On the program itself. Call VLC to play the movie.

That's possible in VB.NET, Java and even in web.

4.) Online capability is not needed.

Then why consider web?

It seems like you want to keep everything local. Web and local can cause problems, which may require workarounds, and since you're not mentioning any web languages I'd reckon you're better off with one of the other two. Why not pick the one you're best at?

Traevel 216 Light Poster

Try to change it into like this follows:

$result = $conn->mysql_query($sql);

You're advising him to use mysql_query? Wow. Maybe read up a little on PHP before you sell another website to one of your vict.. eh.. customers.

The use of query() is perfectly fine, it's mysqli which unlike the deprecated mysql you're advising is a good choice.

@Stefan

where should i place this code in which file

Same spot where you're storing the user session variable. Where you determine to whom the user has to pay.

broj1 commented: I actually agree, mysql ext is outdated +11
Traevel 216 Light Poster

It looks good without it as well, scaling ok here. What was the feature you wanted to use jQuery mobile for, the sliding divs?

Traevel 216 Light Poster

Well according to this very interesting presentation their DBA's gave back in 2006 even at that time they had 26 billion SQL executions per day, hundreds of coders keeping the application servers running, and were "hitting compiler limits on number of methods per class". That's not in the "one or more tables"-league.. it's not even in the same sport.

You don't have to start like they did, each item in its own file, but "how to build something like ebay and do a fast search through its items" is a silly question. They did and do it differently than you ever should, especially for a first website.

Follow a tutorial like this one and start at the beginning. Keep categories in a table separate from products, use proper keys, create indices if you want to search through large text volumes, etc. Worry about speed when you're done with all the other problems you'll face, like proper web design, back-end coding, user login, shopping carts, payment services and so on.

If you really want to learn about large, scalable storage designs (and I misread your question about wanting a website) you can look into (and tinker with) projects like Hadoop or OpenStack. They're open source, very well documented, and have large communities.

Traevel 216 Light Poster

Well, disabling JavaScript for starters.

But also altering your page through the browser, creating my own version of the page and having it send data to yours, or even bypassing the front-end altogether and just send data to the server. Never let the server trust what's coming in.

Assume the data that reaches the server can be wrong, and validate at a point where it can't be changed anymore. Right before it goes into the database for example.

Traevel 216 Light Poster

Any JavaScript validation is vulnerable. Use server side validation on all fields before allowing it.

Traevel 216 Light Poster

I don't know what you mean. But if it works for you then use it in this way.

Though I reckon the double printing comes from the loop-within-loop part.

Traevel 216 Light Poster

I don't get the whole Gender_Array part. You store the results from the query in a multidimensional array only to retrieve it again in the same loop? And the rows_count? Are you doing a double loop then countering the double loop with row count? Why not one loop.

    while($Query->fetch()){
        $Selected = "";
        if($_REQUEST["Gender_Selector"] == $idGender){
            $Selected = "selected";
        }
        echo "<option ".$Selected." value=".$idGender.">".$Gender_Name."</option>";
    }

Would that not suffice?

Traevel 216 Light Poster

$Query-bind_result it needs a ->, so $Query->bind_result.

Traevel 216 Light Poster
$.ajax({
    type: "POST",
    url: "a.php",
    data: postData,
    success: function(data){
        window.open("a.php");
    }
}); 

Instead of doing something with the response you open a.php again but without sending any data.

If you just want a different button to do the submitting you can use submit().

Traevel 216 Light Poster

In addition to the above, be sure to check input again before sending the actual input data. There are users who, when they can't type what they want, will copy-paste their garbage input (with the mouse obviously, how could they ever press two keys at once, that's just madness). Then when they don't get a result they'll call you in the middle of the night (because that's when "you guys" work right) telling you to come fix their mouse, because the "mouse inputs" are not getting results.

<heavy breathing>

Traevel 216 Light Poster

Create a page which, given a keyword, will search your data set and print the results. Test that until it works. Then, go back to this page and use Ajax to send a POST to the search page with the keyword as parameter. Attach a success handler to the Ajax call so that the data from the search page can be displayed on the current page.

Traevel 216 Light Poster

If receiver_id is in the session, then that should work the same as it does for user yes.

Traevel 216 Light Poster

Do what you're doing in getUserData() except instead of the session name/id you use the receiver's. Then

$receiverTotal = $receiver_mBalance + $howMuch;

and

$query = "UPDATE `users` SET `payCheck`='".$receiverTotal."' WHERE `First Name`='".$receiver."'";
Traevel 216 Light Poster
if($result->num_rows > 0) {
    echo "Username doesn't exist.";
} else if($result->num_rows > 1){

If it's larger than 1 it's also larger than 0.

If the amount of results is 0 the user name probably does not exist. If it is 1 it does, if it's larger than 1 you'd have the problem of multiple people with the same name.

Traevel 216 Light Poster

It prints that if $result->num_rows > 0. So if results has more than 0 rows.

Traevel 216 Light Poster
      if($result === false) {
        trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);

        if($row = $result->num_rows > 0) {
          echo "Username doesn't exist.";
        } else {
          $sender = getUserData('First Name');
          if($where == $sender) {
            echo "You can't donate to your self!";
          } else {
            $total = $user_mBalance - $howMuch;
            $query = "UPDATE `users` SET `payCheck`='".$total."' WHERE `First Name`='".$sender."'";
            $res = $conn->query($query);
            printf("You have donated $ %d to %s", $howMuch, $where);
          }
        }
        $conn->close();
      }

That is all in one block, if result is false you do all that.

broj1 commented: Well spotted :-) +11
Traevel 216 Light Poster

I'm still getting the three typerrors on the homepage, but clicking a link works and the header then stops resizing. If I however go to that page directly, the header does resize so it's not something on that page specifically.

How do you fetch a new page exactly? Through Ajax it seems to me. It could be that you are retrieving the entire new page, but then not binding the resize listener again to the new header perhaps.

Traevel 216 Light Poster

What if you added it as none to the transparent div and as auto to the elements in the transparent div that need clicking?

I don't know why internet explorer would allow it when the others don't.

Traevel 216 Light Poster

syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in

in.. the suspense is killing me.

One of those variables in the queries is probably not set properly. You should also not be using the deprecated mysql but one of the improved mysqli or PDO API's.

By using prepared statements you can prevent variables messing up your syntax. By allowing variables to be set directly into the query you're open to security risks.

edit: I see what you mean by using comma separator now

$list_id = implode('","', $m_id);

You're splitting on "," and not just ,. So do implode(',', $m_id) if there's only a comma or implode(', ', $m_id) if there's a comma and a space. And consider not storing it as a comma separated string in your database but in its own table.

Traevel 216 Light Poster

tempq is a list of some sorts? If it contained a1, b1, c1 like stultuske posed. You loop through all the list elements, but does it not play a1 three times? You're not checking the current element but all elements, it finds a1 then stops.

the problem is the sounds are overlapping

You could solve that issue by adding the tracks to a queue on a separate thread with a player to play the sounds in order, for instance. mp.isPlaying() will return true if it's playing at the moment.

Be sure to check the other parts here and here of the tutorial jalpesh posted for more insight on all the options.

Traevel 216 Light Poster

It's unclear (to me anyway) what you mean. Do you want to move an id from one database table to another? Move a cell from one HTML table to another? And the comma separator is supposed to do what, exactly? Split the id's?

Traevel 216 Light Poster

In the sense of "I have a cinema app and I want IMDB's movie data for the films playing" or more like "let's see what the NSA is up to these days"? (don't scrape us, we'll scrape you!)

2015-01-21--1421827025_100x30_scrot.png

Nice try NSA, nice try.

In all seriousness, some sites (like this one) provide public API's for their data.

cereal commented: lol! +13
Traevel 216 Light Poster
Traevel 216 Light Poster

You can use pointer-events:none in the css of that transparent div to "ensure" it won't be the target of mouse events.

Ensure between air-quotes because it will depend on what's below the div. Also, it won't work in old IE (but what does).

Traevel 216 Light Poster

No worries

is there a quick and easy way to increment a counter for that record in the process of selecting it that would keep track of how many times it has been selected?

The easy way would be to store the amount of selections in that table (or a separate one). However, if you don't use the amount of previous selections during the selection process it would only serve a statistical use.

Traevel 216 Light Poster

It does yes, but at a larger cost.

To compare:

SELECT * FROM `person` ORDER BY RAND() LIMIT 1
Query took 1.1831 sec

It's still managable I suppose, depending on how often you need to use it.

Traevel 216 Light Poster

Get a random number between 0 and the amount of records using count x rand, then use LIMIT offset, amount.

So for instance, let's say the random number is 5.

SELECT * FROM foo LIMIT 5,1

would give you the 6th row (starts at 0). You could also just select the ID if you need it.

On a table with 1.1M records:

 SELECT CAST((COUNT(*)*RAND())-1 AS UNSIGNED) FROM `person`
 Query took 0.1211 sec

 SELECT * FROM `person` LIMIT 521541, 1
 Query took 0.1884 sec

Managable I'd reckon.

pixelsoul commented: Good suggestion +8
Traevel 216 Light Poster

I would yes, if you click a link in the menu the console will show:

TypeError: $ is not a function
$( "#mypanel" ).trigger( "updatelayout" );

So you have parts relying on the $. Was the problem before only with the non-fixed header? That seems like a less worse situation, and if the rest of the jQuery dependant parts kept running at that time it could just be a problem unrelated to jQuery/jQuery Mobile.

Traevel 216 Light Poster

I checked again, in the console there are a couple of errors and the links aren't working like yesterday. Are you sure you need to relinquish the $? jQuery and jQuery mobile should not have an issue with eachother using $. Other libraries might, but jQuery is pretty common these days.

The fact that you did relinquish the $ might even be why other libraries (that require jQuery) stopped working.

One of the errors in the console is that jQuery is not defined in:

http://www.m.keybench.com/wp-content/themes/keybenchmobile/js/scripts.js?ver=1.0.0

which seems a custom script.

And neither is it on line 27:

jQuery(document).ready(function($) {

If you use the above you would need $.noConflict(); above it, according to the API guide. You don't have that until line 211.

Traevel 216 Light Poster

"my script" ?

I looked at your other question yesterday, went to your site, after a menu click the header would indeed stop scrolling. There's a ton of scripts on there from all sorts of frameworks, themes and Google. Which one is not working? Or which one is supposed to do whatever it is that gets broken?

jQuery Mobile requires jQuery, so that's not it

Traevel 216 Light Poster

One/multiple of those trigger## do not exist when you try to set the onclick. Why not make it a lot easier by just putting the show form call in the href of <a href='#'id='trigger" . $i . "'>".

Traevel 216 Light Poster

Ah ok, I just noticed you use $table.html('<table>'), $table.html('<tr>'); and so on. You're overriding its contents? From the API:

When .html() is used to set an element's content, any content that was in that element is completely replaced by the new content

Considering $table.html('</table>') is the last one, that would be what's printed. Assuming $table is indeed correctly referring to <table class="table" width="100%">. That's what I meant with perhaps give it an id. It only has a class, so even if you do find it, any other table with that class would also be selected.

Traevel 216 Light Poster

I understand the concept of your question but want to know

  1. is this homework
  2. what was unsatisfactory about the answers you found

You might want to glance over the rules once more.

Traevel 216 Light Poster

[
Nome: Interior;
IdDireta: 2;

Nome and not name?

if (p === "Name") {

var _this = this, $div = _this.$div, opts = _this.settings, $table = $div.find(opts.tableSelector);

What is this? your $table is this.$div.find(this.settings.tableSelector) and $div = this.$div?

It only has a class <table class="table". Try an id or something simpler to check, this construct is overly complicated for debugging.

Traevel 216 Light Poster

Have you tried attaching the call to the link you click to show the form?

If you're looking for a true angular approach you could have a look at this very interesting response on a similar question.

Traevel 216 Light Poster

From that page you posted:

$.store.book[*].author
the authors of all books in the store

Wouldn't this

$result = jsonPath($jsonobj , "$.[1]");

be more easier if you wrote it as

$result = jsonPath($jsonobj , "$.photos.photo[*]");

You'd have just the photos in an array then, no?

Out of curiosity, what does this do
$keys = explode(';', $path);
There are no ;'s anywhere, does jsonPath add those?

Looks interesting anyway.

Traevel 216 Light Poster

$("#degree_name_id").focus(); will set focus in jQuery.

document.getElementById("degree_name_id").focus(); will set focus the old fashioned way.

Traevel 216 Light Poster

You have a validation when you lose focus (blur) and you have one when you press submit. When you press submit it works. My guess is you're mixing up what gets fired at blur and what gets fired at submit. None of your blurs seem to have focus calls.

FYI, you're not using jQuery's .focus() but the native version.