CodeIgniter Forums
Invisible mysql row - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Invisible mysql row (/thread-1794.html)



Invisible mysql row - El Forum - 06-27-2007

[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.


Invisible mysql row - El Forum - 06-27-2007

[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.


Invisible mysql row - El Forum - 06-28-2007

[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?


Invisible mysql row - El Forum - 06-28-2007

[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.