Jump to content

musicradiolive

Members
  • Posts

    63
  • Joined

  • Last visited

Everything posted by musicradiolive

  1. HiyaThat didn't work, however, i did play with it slightly and it worked: If StrComp(Trim(rsShow1Avail("status")),"Booked") = 1 Then That seemed to have worked! lolThanks for that, very much appreciated.
  2. http://www.musicradiolive.com/databasetable.bmp
  3. All the links are gone with that?!
  4. SORTED!I have used a slightly different way and it works fine, the only thing now is the first page that shows the seats, if the seat is booked it still links, is there anyway i can change that? <html><head><title>Seating Availability</title></head><body><style type="text/css"><!--.style1 { color: #CCCCCC; font-family: Verdana, Arial, Helvetica, sans-serif;}body { margin-top: 0px;}body,td,th { font-family: Verdana, Arial, Helvetica, sans-serif;}--></style><table width="720" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#333333"><p> </p> <h1 align="center" class="style1">STAGE</h1> <p align="center" class="style1"> </p></td> </tr></table><table width="700" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#333333"> </td> </tr></table> <table width="710" height="30" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td> </td> </tr> </table> <p> <% Dim adoCon 'Holds the Database Connection ObjectDim rsShow1Avail 'Holds the recordset for the records in the databaseDim strSQL 'Holds the SQL query to query the database Set adoCon = Server.CreateObject("ADODB.Connection")adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("show1.mdb")Set rsShow1Avail = Server.CreateObject("ADODB.Recordset")strSQL = "SELECT tblSeats.Seat, tblSeats.Status FROM tblSeats;"rsShow1Avail.Open strSQL, adoConResponse.Write "<table width=700 border=0 align=center>"'While NOT rsShow1Avail.EOF' If rsShow1Avail("status") = "Booked" Then' col = "Red"' Else ' col = "Green"' End IfWhile NOT rsShow1Avail.EOF If sLetter <> Left(rsShow1Avail("seat"), 1) Then If sLetter <> "" Then Response.Write "</tr>" End If Response.Write "<tr>" sLetter = Left(rsShow1Avail("seat"), 1) End If If rsShow1Avail("seat") = "A6" Then Response.Write "<td rowspan=20 width=40></td>" End If If rsShow1Avail("status") = "Booked" Then col = "Red" Else col = "Green" End If Response.Write "<td><table width=80% border=1 align=center><tr><td bgcolor=""" & col & """><div align=center class=style3><font face=verdana><a href=update_form.asp?ID=" & rsShow1Avail("seat") & ">" & rsShow1Avail("Seat") & "</a></font></div></td></tr></table></td>" rsShow1Avail.Movenext()WendResponse.Write "</tr></table>"rsShow1Avail.CloseSet rs = NothingSet adoCon = Nothing%> <style type="text/css"><!--body,td,th { color: #FFFF33;}a:link { color: #FFFF00;}a:visited { color: #FFFF00;}a:active { color: #FFFF00;}--> </style> </p></body>
  5. <html><head><title>ADO - Submit DataBase Record</title></head><body><h2>Submit to Database</h2><%'on error resume nextset conn=Server.CreateObject("ADODB.Connection") conn.provider="Microsoft.Jet.OLEDB.4.0"conn.open(server.mappath("show1.mdb"))if Request.querystring("action")<>"Save" then seat=Request.Form("seat") 'sql="UPDATE tblseats SET status='" & Request.Form("status") & "',"UPDATE tblseats SET status='',cust_forename='',cust_surname='',cust_book_id='',cust_address='',cust_postcode='',cust_area_code='',cust_tel_number='',cust_cc='' WHERE seat = '" & Request.Querystring("seat") & "'" sql=sql & "cust_forename='" & Request.Form("cust_forename") & "'," sql=sql & "cust_surname='" & Request.Form("cust_surname") & "'," sql=sql & "cust_book_id='" & Request.Form("cust_book_id") & "'," sql=sql & "cust_address='" & Request.Form("cust_address") & "'," sql=sql & "cust_postcode='" & Request.Form("cust_postcode") & "'," sql=sql & "cust_area_code='" & Request.Form("cust_area_code") & "'," sql=sql & "cust_tel_number='" & Request.Form("cust_tel_number") & "'," sql=sql & "cust_cc='" & Request.Form("cust_cc") & "'," 'sql=sql & "cust_cc='" & now() & "' WHERE tblseats.seat=" & noconn.Execute sql, RecordsaffectedResponse.Write(sql) if err <> 0 then Response.Write("You do not have permission to update this database!") 'else 'Response.Write("Record number " & no & " was updated.") end if 'Response.Redirect("showavail.asp")end if'if Request.Form("action")="Delete" then 'no=Request.Form("no")' conn.Execute "DELETE FROM tblGuestBook WHERE tblGuestBook.[no]=" & no, Recordsaffected' if err <> 0 then' Response.Write("You do not have permission to delete a record from this database!")' else ' Response.Write("Record number " & no & " was deleted.")' end if 'Response.Write("Deleting records has been disabled from this demo")'end ifconn.close%></body></html> Thats the ENTIRE page
  6. they will only be reserving one seat at a time, yes, I did think about adding funcions for reserving a number of seats, but decided against it (mainly cos its more work lol)urmm, i run the form so it now sends me to:http://127.0.0.1/bookseat_process.asp?acti...ave&seat=a1So then it specifys a seat and the action in the query string.The code i updated now looks like: UPDATE tblseats SET status='',cust_forename='',cust_surname='',cust_book_id='',cust_address='',cust_postcode='',cust_area_code='',cust_tel_number='',cust_cc='' WHERE seat = '" & Request.Querystring("seat") & "'" I get the error:Microsoft VBScript compilation (0x800A0401)Expected end of statement/bookseat_process.asp, line 17, column 16
  7. i dont know, you told me to add a where so i added that, i thought thats what you meant lol.
  8. if Request.querystring("action")<>"Save" then seat=Request.Form("seat") 'sql="UPDATE tblseats SET status='" & Request.Form("status") & "',"UPDATE tblseats SET status='',cust_forename='',cust_surname='',cust_book_id='',cust_address='',cust_postcode='', cust_area_code='',cust_tel_number='',cust_cc='' WHERE tblseats.seat=" & no sql=sql & "cust_forename='" & Request.Form("cust_forename") & "'," sql=sql & "cust_surname='" & Request.Form("cust_surname") & "'," sql=sql & "cust_book_id='" & Request.Form("cust_book_id") & "'," sql=sql & "cust_address='" & Request.Form("cust_address") & "'," sql=sql & "cust_postcode='" & Request.Form("cust_postcode") & "'," sql=sql & "cust_area_code='" & Request.Form("cust_area_code") & "'," sql=sql & "cust_tel_number='" & Request.Form("cust_tel_number") & "'," sql=sql & "cust_cc='" & Request.Form("cust_cc") & "'," 'sql=sql & "cust_cc='" & now() & "' WHERE tblseats.seat=" & noconn.Execute sql, Recordsaffected Thats what i am now running and i now get the error:Microsoft VBScript compilation (0x800A0401)Expected end of statement/bookseat_process.asp, line 17, column 16UPDATE tblseats SET status='',cust_forename='',cust_surname='',cust_book_id='',cust_address='',cust_postcode='', cust_area_code='',cust_tel_number='',cust_cc='' WHERE tblseats.seat=" & no---------------^
  9. UPDATE tblseats SET status='',cust_forename='',cust_surname='',cust_book_id='',cust_address='',cust_postcode='',cust_area_code='',cust_tel_number='',cust_cc='',
  10. Line 26 is out because thats: ' conn.Execute sql, Recordsaffected I assume you mean: Response.Write("You do not have permission to update this database!") else Response.Write("Record number " & no & " was updated.") <<THIS LINE HERE ? end if 'Response.Redirect("showavail.asp")end if After taking that out out and obviously the else i dont get any errors come up
  11. i took out the redirect and got:Submit to DatabaseRecord number was updated. Went to the main screen and it hasn't updated it, so the script lies! lol
  12. perhaps i forgot to post this change: <form method="post" action="bookseat_process.asp?action=save"> So a query string is now being passed.No errors anymore, it just goes straight to the: Response.Write("Record number " & no & " was updated.") end if Response.Redirect("default.asp")end if and takes me straight back to the default.asp page
  13. didn't bring up an errors, just done the same thing again,however, i did make a slight change bearing in mind what you said earlier. if Request.querystring("action")="Save" then BECAME if Request.querystring("action")<>"Save" then and all of a sudden i got the errorMicrosoft JET Database Engine (0x80040E14)Syntax error in UPDATE statement./bookseat_process.asp, line 26Line 26 is: conn.Execute sql, Recordsaffected
  14. Ok, that works too So i now got the form up, and i have got the process page written as well, but the update doesn't take place so obvilously another bit i gotta change, AGAIN!Have i missed a <> somewhere?? <html><head><title>ADO - Submit DataBase Record</title></head><body><h2>Submit to Database</h2><%on error resume nextset conn=Server.CreateObject("ADODB.Connection") conn.provider="Microsoft.Jet.OLEDB.4.0"conn.open(server.mappath("-------------------------------.mdb"))if Request.querystring("action")="Save" then seat=Request.Form("seat") sql="UPDATE tblseats SET status='" & Request.Form("status") & "'," sql=sql & "cust_forename='" & Request.Form("cust_forename") & "'," sql=sql & "cust_surname='" & Request.Form("cust_surname") & "'," sql=sql & "cust_book_id='" & Request.Form("cust_book_id") & "'," sql=sql & "cust_address='" & Request.Form("cust_address") & "'," sql=sql & "cust_postcode='" & Request.Form("cust_postcode") & "'," sql=sql & "cust_area_code='" & Request.Form("cust_area_code") & "'," sql=sql & "cust_tel_number='" & Request.Form("cust_tel_number") & "'," sql=sql & "cust_cc='" & Request.Form("cust_cc") & "'," 'sql=sql & "cust_cc='" & now() & "' WHERE tblseats.seat=" & no conn.Execute sql, Recordsaffected if err <> 0 then Response.Write("You do not have permission to update this database!") else Response.Write("Record number " & no & " was updated.") end if Response.Redirect("default.asp")end if'if Request.Form("action")="Delete" then 'no=Request.Form("no")' conn.Execute "DELETE FROM tblGuestBook WHERE tblGuestBook.[no]=" & no, Recordsaffected' if err <> 0 then' Response.Write("You do not have permission to delete a record from this database!")' else ' Response.Write("Record number " & no & " was deleted.")' end if 'Response.Write("Deleting records has been disabled from this demo")'end ifconn.close%></body></html> All i get is the heading again, so i go back to the main screen to see if the seat has turned red and it hasn't!GRRRRR lol
  15. Among other things.... mmmm, think best we leave that one there On the screen that shows the seats it generates a link called:<a href=bookseat.asp?seat=" & rs("seat") & ">" & rs("Seat") & "</a> Which then opens http://127.0.0.1/bookseat.asp?seat=A1I then want it to bring up the form for the customer to make the reservation.:::::::::: UPDATE ::::::::::mmm, interesting, i just thought i would have a quick mess around with the script, and i made the form come up. cid=Request.Querystring("seat")if Request.Querystring("seat")="" then set rs=Server.CreateObject("ADODB.Recordset") rs.open "SELECT tblseats.seat, tblseats.status FROM tblseats WHERE seat='" & cid & "'",conn %> GOT CHANGED TO: cid=Request.Querystring("seat")'if Request.Querystring("seat")="" then set rs=Server.CreateObject("ADODB.Recordset") rs.open "SELECT tblseats.seat, tblseats.status FROM tblseats WHERE seat='" & cid & "'",conn %> Notice how the if got a ' so it doesn't runI then had to put ' in the following parts to get rid of the traces: <%else sql="UPDATE seats SET " sql=sql & "seat='" & Request.form("seat") & "'," THAT BECAME <%'else sql="UPDATE seats SET " sql=sql & "seat='" & Request.form("seat") & "'," 'response.write("Record " & cid & " was updated!") 'end if end ifconn.close BECAME 'response.write("Record " & cid & " was updated!") 'end if 'end ifconn.close[code]The form then started appearing, i am now going to do the process page, so fingers crossed!!
  16. I am now setting up the reserve seat feature.One note i want to make to poeple, dont get fooled, you need to UPDATE the record, not make a new one (i done that originally and ended up adding more seats lol)I have just got this from w3schools: <%set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open "-----------------------------------------.mdb"cid=Request.Querystring("seat")if Request.Querystring("seat")="" then set rs=Server.CreateObject("ADODB.Recordset") rs.open "SELECT tblseats.seat, tblseats.status FROM tblseats WHERE seat='" & cid & "'",conn %> <form method="post" action="demo_update.asp"> <table> <%for each x in rs.Fields%> <tr> <td><%=x.name%></td> <td><input name="<%=x.name%>" value="<%=x.value%>"></td> <%next%> </tr> </table> <br /><br /> <input type="submit" value="Update record"> </form><%else sql="UPDATE seats SET " sql=sql & "seat='" & Request.Querystring("seat") & "'," 'sql=sql & "contactname='" & Request.Form("contactname") & "'," 'sql=sql & "address='" & Request.Form("address") & "'," 'sql=sql & "city='" & Request.Form("city") & "'," 'sql=sql & "postalcode='" & Request.Form("postalcode") & "'," 'sql=sql & "country='" & Request.Form("country") & "'" sql=sql & " WHERE seat='" & cid & "'" on error resume next conn.Execute sql 'if err<>0 then 'response.write("No update permissions!") 'else 'response.write("Record " & cid & " was updated!") 'end if end ifconn.close%></body></html> But for some reason all i got was Update Record as a heading, no form appeared, This is really annoying!I will admit, this is the first upodate record script i have used that hasn't produced an error, so i am part of the way there :)Oh, by the way aspnetguy, you dont work for pepsi do you? lmao!!
  17. YOU DONT WANT THAT CHEAP STUFF!! EWWWWW*Passes aspnetguy A PROPER BRAND (Coca Cola {NOT DIET ETC})
  18. No worries mate Just so you know, i took what you said and tried it, didn't work.I noticed elsewhere in my script, when i have used rs( i have done rs(" no rs('So i put: rs("seat") = That kind of worked, the error went but the gap didn't appear so i put:[/code]if rs("seat") = "A5" Then Response.Write <td rowspan=3>H</td>" That way i can see where it's putting the H.It was putting the H BEFORE A5, so i simply changed it to A6 and the H appeared in the right place! All i had to do then was make the cell a Width i wanted.End result :[code] If rs("seat") = "A6" Then Response.Write "<td rowspan=3 width=40></td>" End If Note to anyone who uses the code: Make sure you change the rowspan=3 to however many rows will appear, otherwise it wont work correctly Thanks aspnetguy for your help, very much appreciated. WHOOOOOOOOOOOOOO *Passes aspnetguy a beer*
  19. I have had problems with Norton as well.NIS 2006, i have 2 machines, i cant access network resources unless i disable NIS, thats a really big pain! lol
  20. While NOT rs.EOF If sLetter <> Left(rs("seat"), 1) Then If sLetter <> "" Then Response.Write "</tr>" End If Response.Write "<tr>" sLetter = Left(rs("seat"), 1) End If If rs('seat') == "A5" Then Response.Write "<td rowspan=3></td>" End If If rs("status") = "Booked" Then col = "Red" Else col = "Green" End If Like that?????? It wont work, i get:Microsoft VBScript compilation (0x800A03EA)Syntax error/showavail.asp, line 39, column 16If rs('seat') == "A5" ThenI have obviously done something wrong!?!?
  21. Thanks for your help, i got this : While NOT rsShow1Avail.EOF If sLetter <> Left(rsShow1Avail("seat"), 1) Then If sLetter <> "" Then Response.Write "</tr>" End If Response.Write "<tr>" sLetter = Left(rsShow1Avail("seat"), 1) End If If rsShow1Avail("status") = "Booked" Then col = "Red" Else col = "Green" End If This worked without any problems.The only thing i want to do now is create a gap down the middle.This HTML code demonstartes what i mean: <table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td>A1</td> <td>A2</td> <td>A3</td> <td>A4</td> <td>A5</td> <td rowspan="3"></td> <YOU CAN SEE I HAVE GOT A MERGED CELLS HERE TO CREATE THE GAP DOWN THE MIDDLE <td>A6</td> <td>A7</td> <td>A8</td> <td>A9</td> <td>A10</td> </tr> <tr> <td>B1</td> <td>B2</td> <td>B3</td> <td>B4</td> <td>B5</td> <td>B6</td> <td>B7</td> <td>B8</td> <td>B9</td> <td>B10</td> </tr> <tr> <td>C1</td> <td>C2</td> <td>C3</td> <td>C4</td> <td>C5</td> <td>C6</td> <td>C7</td> <td>C8</td> <td>C9</td> <td>C10</td> </tr></table>
  22. musicradiolive

    Table Loop

    Hi. I am writing a reservation system for a theatre and need a quick bit of help with the table to shows the seats. I have got a database that has got the following tables: Seat ¦ Status ¦ (Customer info (for when they book the seat) In the seat one i put the seats (A1 - A10, B1 - B10 etc) I want A1 - A10 to appear on the first line, then start a new row and do B1 - B10 etc etc for as many rows as i want (it will only go up to T10, but it would be nice to know i can make it easily expandable should more seats be added)Here is the code i am using so far: --------------------------------------------------- strSQL = "SELECT tblSeats.Seat, tblSeats.Status FROM tblSeats;" rs.Open strSQL, adoCon Response.Write "<table width=700 border=0 align=center><tr>" While NOT rs.EOF If rs("status") = "Booked" Then col = "Red" Else col = "Green" End If Response.Write "<td><table width=80% border=1 align=center><tr><td bgcolor=""" & col & """><div align=center class=style3><font face=verdana><a href=make_booking.asp?seat=" & rs("seat") & ">" & rs("Seat") & "</a></font></div></td></tr></table></td>" rs.Movenext() Wend Response.Write "</tr></table>" Any help anyone can offer on this would be greatly appreciated.Thanks
×
×
  • Create New...