Seating Reservation System - PHP + MYSQL

  • (6 Pages)
  • +
  • « First
  • 4
  • 5
  • 6

82 Replies - 17852 Views - Last Post: 23 March 2013 - 09:19 AM Rate Topic: -----

#76 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,237
  • Joined: 08-June 10

Re: Seating Reservation System - PHP + MYSQL

Posted 21 March 2013 - 08:37 AM

I assume you know what the substr() function does?

then you could do this very easily yourself:
- dump every variable when it is (re)assigned
- dump every function return value (you will need to save it in a temporary variable for that)

the resulting output should be quite self-explanatory.

This post has been edited by Dormilich: 21 March 2013 - 08:38 AM

Was This Post Helpful? 1
  • +
  • -

#77 carmex  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 21-February 13

Re: Seating Reservation System - PHP + MYSQL

Posted 23 March 2013 - 06:47 AM

View PostDormilich, on 21 March 2013 - 08:37 AM, said:

I assume you know what the substr() function does?

then you could do this very easily yourself:
- dump every variable when it is (re)assigned
- dump every function return value (you will need to save it in a temporary variable for that)

the resulting output should be quite self-explanatory.

Had a look at the php documentation anyway and it cleared it up!


Realized I forgot to add much validation to my program. How would you suggest dealing with posted names. at the moment they get posted into the following code whether anythings there or not. I would like it to not accept numbers and also make sure the post isn't actually empty. Had a look around havnt found anything i can actually get to work with my code:
/ Update Query
		$statusB = $_POST['statusB'];
		$statusA = $_POST['statusA'];
		$fName = $_POST['fname'];
		$lName = $_POST['lname'];
		
		
		$changeStatus = "UPDATE seats set status=$statusB, firstName='$fName', lastName='$lName' where( "; // UPDATE 
		$count = 0;
		foreach($_POST['seats'] AS $seat) 


on a side note, look how many views this topic has racked up! lol!
thanks again Dormilich

This post has been edited by carmex: 23 March 2013 - 06:47 AM

Was This Post Helpful? 0
  • +
  • -

#78 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3480
  • View blog
  • Posts: 11,876
  • Joined: 12-December 12

Re: Seating Reservation System - PHP + MYSQL

Posted 23 March 2013 - 07:18 AM

Quote

Had a look around havnt found anything i can actually get to work with my code

I'm not sure how this is possible(?). There is isset(), empty(), is_numeric(), intval() and MANY other functions, and examples/tutorials, to be found. If you read one page of the docs or, at least, beyond the first few paragraphs you will find examples and links to other pages.

Plus, use prepared statements, aka parameterized queries.

This post has been edited by andrewsw: 23 March 2013 - 07:20 AM

Was This Post Helpful? 0
  • +
  • -

#79 carmex  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 21-February 13

Re: Seating Reservation System - PHP + MYSQL

Posted 23 March 2013 - 07:29 AM

View Postandrewsw, on 23 March 2013 - 07:18 AM, said:

Quote

Had a look around havnt found anything i can actually get to work with my code

I'm not sure how this is possible(?). There is isset(), empty(), is_numeric(), intval() and MANY other functions, and examples/tutorials, to be found. If you read one page of the docs or, at least, beyond the first few paragraphs you will find examples and links to other pages.

Yeah iv been reading through and trying to change and use it with my code however i find it difficult because all the validation tutorials seem to post to a different error page. I need the error to be found on the page the data is submitted and then pass the data (if not errors are found obviously) through to the code i have posted above. This is simply due to my inexperience I know which is why i was just asking for advice.

Quote

Plus, use prepared statements, aka parameterized queries.

Iv tried this, finding it once again very difficult to make it work how my above code does.
Was This Post Helpful? 0
  • +
  • -

#80 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3480
  • View blog
  • Posts: 11,876
  • Joined: 12-December 12

Re: Seating Reservation System - PHP + MYSQL

Posted 23 March 2013 - 07:48 AM

It is extremely unlikely that you will find code that will exactly match the requirements of your page. You will need to study the documentation and adapt code samples, and functions, to fit your code. Have you studied all the fundamentals of PHP? If not, you should do this before you go any further.
Was This Post Helpful? 0
  • +
  • -

#81 carmex  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 21-February 13

Re: Seating Reservation System - PHP + MYSQL

Posted 23 March 2013 - 08:19 AM

View Postandrewsw, on 23 March 2013 - 07:48 AM, said:

It is extremely unlikely that you will find code that will exactly match the requirements of your page. You will need to study the documentation and adapt code samples, and functions, to fit your code. Have you studied all the fundamentals of PHP? If not, you should do this before you go any further.

well yeah there's obviously not going to be the exact code out there to meet my code but if you remember:

Quote

How would you suggest dealing with posted names.
I would like it to not accept numbers and also make sure the post isn't actually empty

was my general question, i just wanted advice and suggestions in the right direction.
Was This Post Helpful? 0
  • +
  • -

#82 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3480
  • View blog
  • Posts: 11,876
  • Joined: 12-December 12

Re: Seating Reservation System - PHP + MYSQL

Posted 23 March 2013 - 09:09 AM

You could use preg_match to check if a string contains any numbers and empty() in combination with isset() to discover if a variable is empty.

if (preg_match('#[0-9]#',$str)){ 

Was This Post Helpful? 1
  • +
  • -

#83 carmex  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 21-February 13

Re: Seating Reservation System - PHP + MYSQL

Posted 23 March 2013 - 09:19 AM

View Postandrewsw, on 23 March 2013 - 09:09 AM, said:

You could use preg_match to check if a string contains any numbers and empty() in combination with isset() to discover if a variable is empty.

if (preg_match('#[0-9]#',$str)){ 

Thanks! Will look at the documentation and implement
Was This Post Helpful? 0
  • +
  • -

  • (6 Pages)
  • +
  • « First
  • 4
  • 5
  • 6