You are here: What is wrong with my syntax?? « PHP SQL « IT news, forums, messages
What is wrong with my syntax??

Posted by Nosferatum on 03/30/07 08:46

This processing script is supposed to check users submitted customer
number and customer pass and see if these are equal to the data in my
MySQL db. Associated with each customer number and customer pass are a
destinationID (a fixed number, 10,20,30,40 or 50) which should
redirect the user.
But the processing script just hangs and displays the destinationID,
no redirect.
Can anyone see anything wrong with the syntax?



<?php
session_start();

//register user session
$_SESSION['customer_number'] = "$customer_number";
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
$_SESSION['rabkat'] = $row['destinationID'];

$kundenummer = $_POST['customer_number'];
$orgnummer = $_POST['customer_pass'];


//my mysql login details
$host="mi.ip.details";
$username="username";
$password="password";
$db_name="my_database";
$tbl_name="my_table";

// connect and choose db
mysql_connect("$host", "$username", "$password")or die("I cant
connect");
mysql_select_db("$db_name")or die("I can't choose db");

//process search
$sql="SELECT destinationID FROM $tbl_name WHERE
customer_number='$customer_number' AND
customer_pass='$customer_pass'";
$result=mysql_query($sql);


if ($result && (mysql_num_rows($result)!= 0)) {
$row = mysql_fetch_array($result);
echo $row['destinationID'];

}


//choose correct destination based upon users data from mysql

switch($row['destinationID']) {
case '10':
header("location:http://www.mysite.com/customers/cat10/
index.php");
break;
case '20':
header("location:http://www.mysite.com/customers/cat20/
index.php");
break;
case '30':
header("location:http://www.mysite.com/customers/cat30/
index.php");
break;
case '40':
header("location:http://www.mysite.com/customers/cat40/
index.php");
break;
case '50':
header("location:http://www.mysite.com/customers/cat50/
index.php");
break;
default:
printf("Wrong customer number or customer pass<br>\n<a
href='javascript:history.go(-1)'>Back</a>");
}


?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация