Forum Replies Created

Adan Member

What you need is a datatable, something like this should work: Might not be 100% accurate but should be close

Public Function GetProducts() As DataTable

Dim query As String = "SELECT ProductID, ProductName, Type, Make, Description, Price, QtyOnHand FROM Products ORDER BY Price, Description"

Dim dtaTable As New DataTable
Dim dtaAdapter As New OleDb.OleDbDataAdapter(query, connection)

dtaAdapter.Fill(dtaTable)

Return dtaTable

End Function

Then call it using this code

Dim ProductID$, ProductName$

Dim Products As DataTable = GetProducts()

Dim ProductRow As DataRow

' Cycle thru Each Row in dataTable, like an Excel SpreadSheet
For Each ProductRow In Products.Rows

ProductID$ = ProductRow.Field("ProductID")
ProductName$ = ProductRow.Field("ProductName")
.
.
.
.
.

'Add Each Value to a List, Listview etc
Adan Member

Have you got this straighten out yet if not here is a small solution to your question:

    "; foreach($message as $key=>$error){ echo "".$error.""; } echo "

"; } //Lets test the login and log user in if the have the correct info otherwise forward them to login form //LOGIN: if(isset($_POST['login'])){ $username=$_POST['username']; $password=$_POST['password']; if(empty($username)){$message[].="username is required to login";} if(empty($password)){$message[].="Password is required to login";} /* FAIL SAFE IN OLDER BROWSERS: if the page is used in newer browsers that support html5, the two above code would never appear because if used the html to rquire fields. In older browser, however, user can submit form without enetering data. */ if($username !==BASIC_USER AND $password !==BASIC_PASS){$message[].="Invalid username or password"; }else{ $_SESSION['username']=$username; // successfully logged in. } } //We will user a $_GET veriable to logout user. //LOGOUT: if(isset($_GET['logout']) AND $_GET['logout']=="t"){ unset($_SESSION['username']); session_destroy(); header("location: ?=login"); } ?> Saamon's entry

Hello , Welcome to this securecd area of my page

Here is other cool stuff you can do here

Logout - Yep you can do that too.




Adan Member

“Login” usually means there’s a password (or rather, one-way-encoded password, like a hash) that get’s compared to user provided password (or rather, the userpass gets to be encoded using the same algorithm, and then compared).

So:
– HTML form sends data to the server
– PHP gets the data as POST
– you get the username and search if there is actually a user with that name,
– if not – error out with “no username or password wrong” – usually you don’t want to giveaway that the provided username is valid
– if so – you extract (from database?) some basic details, amongst that there’s encoded pass *
– you encode provided password using the same algorithm used at registration
– you compare the two and if their different you error out
– if pwd is valid, you set some session variables and show success page

on whatever other page you just start session and see if your session variables are set – if so, the user was logged in. Of course then you can add validation, maybe the user had different IP, browser/special cookie last request? If so, it’s possible (but not surely!) that it’s a session hijack taking place. But you can read about that on your own. Wink

*) this is actually usually the point were you either get some valid data back, or not, and you know if username is valid. I’ve split it to steps for clarity.

Adan Member

w3schools.com is a very good way to start. read EVERYTHING there. then you can use PHP or JSP (two very different technologies) to test out stuff and build web pages. If you choose JSPs, Google offers free hosting with Google AppEngine Smile

Adan Member

I haven’t seen one that does them all but they are available separately, python to exe, php to exe etc.
They are designed to run whatever script you ask it to not run as a server environment

For a full windows server environment then use something like easyphp or xampp but wont work as a standalone desktop app

Adan Member

since it is a java game, create a jar file instead of an exe. A jar file is able to run on any OS, i.e. linux, osx, provided that java virtual machine(JVM) is installed. If you still want exe, see the following link:

www.jar2exe.com/

If you want to create jar, view the following:

http://docs.oracle.com/javase/tutorial/deployment/jar/build.html

Adan Member

It is definitely possible to have the data from the text fields written plainly to some kind of text file as opposed to there being some kind of requirement to have them emailed to you…

What you’re asking for would require some programming or at least a basic understanding of PHP, however. Even if someone here was to specifically *write the code* that does this for you, and gave it to you, you’d still need to have some kind of online website to run it on, or at least your own private server to run the PHP component for you.

It’s difficult to tell what level you’re at but the general gist is that the information from the form you’ve posted will be sent to your web server where a PHP script will process it. You will code that PHP script to put that data *wherever you want* be that in an email, a text file, a database, whatever.

Adan Member

I have two data sources, and I want to create my own database which pulls data from both sources. Both data sources, get updated every day, so I must keep my own database up to date as well. How should I go about updating my own database? I was thinking of doing nightly updates. How do I go about this?

in reply to: PHP Display array data
Adan Member

Here’s a solution…

 $name)
{
   switch($key)
   {
      case count($names)-2:
      $seperator = ' and ';
      break;

      case count($names)-1:
      $seperator = '';
      break;

      default:
      $seperator = ', ';
      break;
   }
   echo $name.$seperator;
}
Adan Member

I don’t know that book in particular, but I’ll reply anyway. In my opinion, there is no absolute best book to start learning. There are several good ones. There are even excellent sites that help you get started. Aiming for one book that has all the good treats with no flaws is a bit unrealistic.

If you’re considering buying the book, I’d google for the best book if I were you, just to get some useful book titles on your mind. However, what is good for another person might not be tailored for you.

Amazon reviews might or might not be useful/sincere. But the book descriptions always help you figure out at least the target public, the knowledge requirements and the topics covered by the book.

I believe buying a book nowadays isn’t absolutely essential to learn something like C++ programming. Tutorials, lessons and references are already scattered all over the Internet.

One more thing. If you’re just starting programming, many might consider C++ as a bad language to start with. Very, very complex! But it’s your choice

Adan Member

I suggest using PDO instead of the mysql_* functions, they are not being maintained anymore. PDO offers a FETCH constant to fetch a column – PDO::FETCH_COLUMN. That’s exactly the one you need. Visit the link provided by

If you don’t want to move to PDO, then this is the mysql_ function you need:

http://php.net/manual/en/function.mysql-result.php

Adan Member
switch (choice) {
case 'C': System.out.print("Enter the radius of the circle: ");
double radius = Double.parseDouble(scan.nextLine());
double area = Math.PI * radius * radius;
System.out.println("Area of the circle is: " +Math.round(area));
break;
case 'S': System.out.print("Enter the square's length: ");
side = scan.nextInt ();
double area = side * side;
System.out.println("Area of the Square is: " +Math.round(area));
break;
case 'R': System.out.print("Enter the rectangle's height: ");
height = scan.nextInt ();
System.out.print("Enter the rectangle's width: ");
width = scan.nextInt ();
double area = height * width;
System.out.println("Area of square is: " +Math.round(area));
break;
default: System.out.println("Incorrect value");
break;
}

Make sure to change “String choice;” to “char choice”
The reason you use a ‘ ‘ instead of ” ” is simply because you check for chars. Checking for chars must be done with ‘ ‘.

If you want to keep it a String, change every ‘ in your switch to ”

Also: I saw in your code this: reader.readLine(). I changed this to scan.nextLine() simply because I prefer to work with Scanner. It’s your choice though, you can re-edit it if you like.

Adan Member

I personally learned CSS and JavaScript from this site:

http://www.codecademy.com

Adan Member

I figured out how to recurse through a folder, but to write to all files in the folder I can’t find out how to do that. If I put a wildcard like *.js or *.php it don’t work, I get a bad filename or number error, if I remove the wildcard and replace that with the actual name, it will work. Any other suggestions?

Adan Member

You can get eclipse from this website:

http://www.eclipse.org/downloads/

Just choose your OS. Then you have to download the android plugin for eclipse. This is how:

http://developer.android.com/sdk/installing/installing-adt.html

Then just write your app in Java, test, debug, over and over again and you’re done Smile (WARNING: This might be a tiny oversimplification of the process).

You can also download the whole bundle at once here:

http://developer.android.com/sdk/index.html

Viewing 15 posts - 1 through 15 (of 80 total)
en_USEnglish