?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?~ database counter script~
Author:??(---.gla.ac.uk)
Date:???07-03-03 01:35

Hi there

Quick question i want to have a database counter that will keep track off of bookings, i have a table called count and the field within the table is called counter, i want the user to press a button called add me and i want to increment the counter and will it reaches 4 , i want to display a message to say that no seats avaliable how can i do this, code snippet would be helpful...thanks in advance...indy

?Re: ~ database counter script~
Author:??(---.cpe.net.cable.roger)
Date:???07-03-03 13:04

i would not suggest this course as when there are simultaneous users, this will create problems...

better to simply query the particular set of data that you want and count the number of rows returned by the query with mysql_num_rows($result)

hth

?Re: ~ database counter script~
Author:??(---.gla.ac.uk)
Date:???07-04-03 01:46

hi balstein

thanks for the response, could u please give me a code snippet....much appreciated...thanks in advance....indy

?Re: ~ database counter script~
Author:??(---.cpe.net.cable.roger)
Date:???07-05-03 08:07

okay, lets set it up like this...you have a row of seats (like on an airplane or bus) with seat numbers (A,B,C,D)

now your user is looking to book a seat in row 37 so

$item=$_GET['item']; //this is compromised of two elements
//a row number and a seat number so the
//data looks like 37-A passed by href
//using a link

$data=explode("-",$item); //take apart the data element

$row=$data[0];
$seat=$data[1];

$sql="select * from booking where row_no = $row";

//connection information goes here

$result=mysql_query($sql) or die ("can't connect because ".mysql_error());

if (mysql_num_rows($result))==4){

//all seats in row taken
echo "No seats available in this row";
}else{

//seats free so reserve or something

} //end if

?>

hth

Go to Top??|??Go to Topic??|??Threaded View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??

Provided By
Phorum