karljv
-
Posts
4 -
Joined
-
Last visited
Never
Posts posted by karljv
-
-
Hello
I have a simple question. How to have the case statement execute more than one command? My code
Case x = 1
TubaTemp = ((TubaTemp) + (RadikaTemp / (TubaTemp * 3))) + SoojusKadu
Rad.Enabled = True
RadikaTemp = CDec(Rad.Text)
TTemp.Text = TubaTemp.ToString("N2")
RTemp.Text = RadikaTemp
So it seems tu execute only the first mathematical thingy. All the rest ( Rad.enabled = true and downward) do not execute.
Thanks
-
well forgive me I started a week ago, twas my homework.
Thanks a billion tho!
-
So I am new to all this coding and I am making a small website, which has to have a login and something is not working properly. My login user/pass processing code looks like this
<?php
$host = 'xxxx'; // Host name Normally 'LocalHost'
$user = 'xxxx'; // MySQL login username
$pass = 'xxxx'; // MySQL login password
$database = 'members'; // Database name
$table = 'members'; // Members name
$username = $_POST["username"];
$password = $_POST["password"];
$connection = mysql_connect("xxxx", "$user", "$pass");
if (!$connection) {
die("Database connection failed: " . mysql_error());
}
else {
echo "Everything is fine!<br />";
}
mysql_select_db("xxxx",$connection) or die(mysql_error());
$result = mysql_query("SELECT * FROM members WHERE usr='$username' and pass='$password'",$connection) or die(mysql_error());
$count=mysql_num_rows($result);
if($count==1){
session_start();
session_register("myusername");
session_register("mypassword");
header("location:Login_Success.php");
}
else {
echo "Wrong Username or Password";
}
?>
So it all continues well and transfers me to Login_Success.php, where the code looks like this
<?
if(!session_is_registered(myusername)){
header("location:MainPage.htm");
}
?>
<html>
-----my html code here, which makes no difference----
The problem is that it sends me to MainPage.htm and I can't really figure out why. As ive said im new to all of this. I figured that the session did not stay logged in, when it changed pages for some odd reason?
THANK YOU!
Visual basic simple Case statement question
in Other Programming Languages
Posted
Okei, so i understood it completely wrong, instead of running only one line of code, it runs my entire timer1_tick code line. Why does it not select a case on every tick?
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Select Case x
Case x = 0
TubaTemp = ((TubaTemp) + (RadikaTemp / (TubaTemp * 3))) + SoojusKadu
If SwitchCold > TubaTemp Then
RadikaTemp = 40
End If
If SwitchWarm < TubaTemp Then
RadikaTemp = 30
End If
Rad.Enabled = False
TTemp.Text = TubaTemp.ToString("N2")
RTemp.Text = RadikaTemp
Case x = 1
TubaTemp = ((TubaTemp) + (RadikaTemp / (TubaTemp * 3))) + SoojusKadu
Rad.Enabled = True
RadikaTemp = CDec(Rad.Text)
TTemp.Text = TubaTemp.ToString("N2")
RTemp.Text = RadikaTemp
End Select
End Sub
taking into account that (Dim x as integer) and on Form load x=0