0

How would i go about trying to call enum value from SQL for my SQL Query below if someone could assist and point me in the right direction it would be great.

$insertLogSQL = $odb -> prepare("INSERT INTO `logs` 
    VALUES (NULL, :user, :ip, :port, :time, :method, UNIX_TIMESTAMP(), :stopped, :server)");

$insertLogSQL -> execute(array(
    ':user' => $_SESSION['username'], 
    ':ip' => $host, 
    ':port' => $port, 
    ':time' => $time, 
    ':method' => $method, 
    ':stopped' => 0, 
    ':server' => )
);

My code work fine i'm just trying to implement server rotation but wouldn't know how to go about enum ?

M. Eriksson
  • 13,450
  • 4
  • 29
  • 40
Private
  • 5
  • 5
  • 1
    Your question is _very_ unclear. What do you mean by "call enum"? Please add a proper explanation including expected result and what result you're currently getting. How is the above code (which you say works) related to the issue? – M. Eriksson Mar 04 '19 at 15:38
  • I got the enum values set for example (1,2,3,4,5) i wanna call them from Database for example ':id' => $id would return user ID, But i wanna grab a value for enum from database – Private Mar 04 '19 at 15:46
  • I think this question might answer your question: https://stackoverflow.com/questions/20863547/php-function-for-mysql-enum-selected – Martin Burch Mar 04 '19 at 15:48
  • So select that column? Enum is just a string with some restrictions about what values it can contain. When selecting a record that has an enum column, there's no difference from selecting a varchar column. Or are you asking how to get all the available values? I also don't get your example with `':id' => $id` or how that is remotely relevant to the posted code? – M. Eriksson Mar 04 '19 at 15:53

0 Answers0