Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeigniter - MySQL variable wrong
    primarykey
    data
    text
    <p>When I try to add a column in codeigniter, I add this column correctly but the value is not the value at the variable... </p> <p>When I define:</p> <pre><code>&lt;?php $hwid = "123893944"; ?&gt; </code></pre> <p>The Hardware-ID in the Database: "2147483647"</p> <p>I dont know why... Please help me!</p> <p>Model:</p> <pre><code>&lt;?php class Prometheus_model extends CI_Model { var $tables = array( 'bots' =&gt; 'bots', 'users' =&gt; 'users' ); function __construct() { parent::__construct(); } public function tablename($table = NULL) { if(! isset($table)) return FALSE; return $this-&gt;tables[$table]; } public function insert($table, $data) { $this-&gt;db-&gt;insert($this-&gt;tablename($table),$data); return $this-&gt;db-&gt;insert_id(); } public function num_rows($table, $where = NULL) { if(isset($where)){ $this-&gt;db-&gt;where($where); } $q = $this-&gt;db-&gt;get($table); return $q-&gt;num_rows(); } } ?&gt; </code></pre> <p>Controller:</p> <pre><code>public function add_bot() { $bot_data = json_decode($this-&gt;input-&gt;post('bot_data')); if($this-&gt;prometheus_model-&gt;num_rows('bots', array('bot_ip' =&gt; $_SERVER['REMOTE_ADDR'])) == 0){ $to_insert = array( 'bot_id' =&gt; NULL, 'bot_add_date' =&gt; time(), 'bot_last_update' =&gt; time(), 'bot_os' =&gt; $bot_data-&gt;{'bot_os'}, 'bot_architecture' =&gt; $bot_data-&gt;{'bot_architecture'}, 'bot_ip' =&gt; $_SERVER['REMOTE_ADDR'], 'bot_port' =&gt; $_SERVER['REMOTE_PORT'], 'bot_version' =&gt; $bot_data-&gt;{'bot_version'}, 'bot_name' =&gt; $bot_data-&gt;{'bot_name'}, 'bot_hw_id' =&gt; $bot_data-&gt;{'bot_hw_id'} ); echo $to_insert['bot_hw_id']; //HERE IT IS CORRECT, BUT WRONG IN DATABASE! $this-&gt;prometheus_model-&gt;insert('bots', $to_insert); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload