CodeIgniter Forums

Full Version: Invisible mysql row
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]xwero[/eluser]
When i do an insert with the same code but other values the row doesn't get displayed in the table but the auto_increment has gone up a number and the code igniter affected_rows function displays 1.

I have seen this behaviour before but i never knew what caused this, it disappeared somehow. I'm working with mysql version 3.23 (shared hosting)

I hope someone can explain this and offer a solution, i searched for it but i haven't found one.

El Forum

[eluser]xwero[/eluser]
I hunted the problem down to a variable that is like the following code

Code:
$query = $this->db->query('select nr from table'):
$row = $query->row_array();
$count = $row['nr']+1;

The insert query breaks on the count variable. I tried to cast it but with no luck.

El Forum

[eluser]xwero[/eluser]
i'm back to mysql for the problem. The fieldtype is int(10) ,it was varchar(200). The field takes the value 0 and it takes 1 sometimes but nothing above one.

Any mysql guru who can solve the problem?

El Forum

[eluser]xwero[/eluser]
Another change in the problem

Code:
$this->db->query('select name from table where id=?',array($id));
$row = $query->row_array();
$name = $row['name']; // exampe output : test
$query->free_result();
$query = $this->db->query('select count(*) as tel from table where name=?',array($name)):
$row = $query->row_array();
$count = $row['tel']+1;
$query->free_result();
$this->db->query('insert into table (name,count) values (?,?)',array($name,$count));
It is the name value that is the problem, which made the count field react weird so that's why i thought that was the problem.

So there is a value for the name variable but it breaks the insert statement somehow. i tried (string)$row['name'] but with no result.