• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Invisible mysql row

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

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

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

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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.