Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
haekz008
Starting Member
10 Posts |
Posted - 2012-01-16 : 22:02:08
|
| i am new to database thing so i dont know how to solve my problem. i created a function that has a query which is$query = "SELECT COUNT(stud_id) FROM tbl_stud_reservation WHERE stud_id = '$studid' AND reservation_stat = '1'";.,my problem is, how am i going to create an if statement that allows the user to continue if he/she have made a reservation and blocks him if he dont have any reservation transaction in the database. i need a help. this is my project. help me pls,here is the codes of mine$studid = $_POST['studid']; if(empty($studid)){ $_SESSION['message']['type']="error"; $_SESSION['message']['content']="Please scan id"; header("Location: ../index.php?page=reservedAccounts"); exit; } $query = "SELECT COUNT(stud_id) FROM tbl_stud_reservation WHERE stud_id = '$studid' AND reservation_stat = '1'"; $result = mysql_query($query); $thisrow=mysql_fetch_row($result); if ($thisrow){ $_SESSION['message']['type']="success"; $_SESSION['message']['content']="You are reserved"; header("Location: ../index.php?page=reservedAccounts&load=viewReservation"); exit; }else{ $_SESSION['message']['type']="error"; $_SESSION['message']['content']="You are not reserved"; header("Location: ../index.php?page=reservedAccounts"); exit; } } haekz008 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-01-17 : 03:40:01
|
Your post is about MySQL and PHP and here we are on MS SQL Server only.So you can get better help if you will post your question in another forum about PHP/mysql. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
haekz008
Starting Member
10 Posts |
Posted - 2012-01-17 : 09:47:41
|
| thankyou for your suggestions:)haekz008 |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|