php - If searched number exists in MySQL database, go to a certain link -


I have a company where we issue invoices to people, then with this "ticket number" and "date" Upload an invoice

I think logging is quite simple, but my brain wraps around MySQL and I can not find the tutorial for it

I have a form like this Which works like a search, where it takes "search ticket number" and it "goes ahead .php"

If the ticket Khya has been found in my database and the date of the ticket number submitted is less than 72 hours of the present time, the date and time I have submitted, Goto Link A, if more than 72 hours Goto Link B, If the search is not able to find anything in the Goto link,

I hope anyone write it for me if this is complicated but maybe I should give instructions for the tutorial that I want to I am Or tell me what I want to find in However, if you think that this script is enough for me then I can see what I should have done that would be very appreciated.

Now I have gone ahead. Php file:

   

My preferred method of creating questions is a prepared statement, this is the safest way. It is recommended that you look at another up-to-date approach to talking to SQL (Mysore's tenure these days Quite a favor in favor of In the minimum, you should "save" the strings given by your user: $ user = "data1"; $ database = "data"; $ mysqli = new mysqli ( "Localhost", $ username, $ password, $ database); // If this is a string, do this // // ticket number = $ mysqli- & gt; real_cape_string ($ _ POST ['ticket number ']); // Because it should be an integer, we can do better: $ ticketNumber = intval ($ _POST [' ticket number ']); $ Rinam = $ mysqli- & gt; query ( "select plate WHERE ticket, number = $ ticket number"); if (! $ Result & gt; Num_rows) {header ("location: /scriptC.php"); Die (); } $ Ticket = $ Result-> Fetch_assoc (); $ Tickettime = strottetime ($ ticket ['date']); $ Requesttime = strotomat ($ _ POST ['date']); If (($ Request Time - $ Ticket Time) & lt; 72 * 60 * 60) {Header ("Location: / Scripte.F.P."); Die (); } Header ("Location: /scriptb.php"); Die (); $ Mysqli- & gt; near ();

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -