0
<?php
include "conection.php"; 

$checknumber=mysql_fetch_array(mysql_query("SELECT MAX( number ) FROM tqueue WHERE get_ticket >= CURDATE( ) GROUP BY services"));

 $one=$_GET['services'];
 $two=$_GET['services_abjact'];
 $three=1+(int)$checknumber;

 $query="INSERT INTO tqueue (services, services_abjact, number) values ('$one', '$two','$three')";
 $exe=mysql_query($query);

  echo"<a href='index.php'>Input again</a></br>";
?>

i want to input link like this http://localhost/pehape/input.php?services=1&services_abjact=A&submit=save

When I input that link I'll get sequential number of queue with using +1 in $three or number column but I'm still failing in result please help me

I want result in number column something like this table

-----------------------------------------------------------
 services   |   services abjact  | number   |  get_ticket
-----------------------------------------------------------
     1                   A            12           21:04:24
     1                   A            11           20:00:00
     1                   A            10           19:02:40
     1                   A            9            18:36:01
     1                   A            8            18:01:00
     1                   A            7            17:45:30
     1                   A            6            16:50:20
     1                   A            5            16:34:56
     1                   A            4            16:03:04
     1                   A            3            15:00:00
     1                   A            2            11:56:00
     1                   A            1            09:12:34
7

1 Answer 1

3

mysql_fetch_array() returns array not string. Here is reference http://php.net/manual/en/function.mysql-fetch-array.php

In your case: $three = 1 + (int)$checknumber[0]['number']; Or you can use while or foreach loop.

You could set auto incremental column in your database. Also you should use PDO or MYSQLi.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.