CodeIgniter Forums
update setting all fields to zero - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: update setting all fields to zero (/showthread.php?tid=50881)

Pages: 1 2


update setting all fields to zero - El Forum - 04-13-2012

[eluser]mflammia[/eluser]
Guess that could very well be likley as I'm currently developing this using EasyPHP5.3.9, not sure what database driver that uses?

Unless you have any other ideas I can try running this on a live server to find out.


update setting all fields to zero - El Forum - 04-13-2012

[eluser]Aken[/eluser]
If you're using a database in CodeIgniter, you have to configure the database settings in your application/config/database.php file. How can you configure that without knowing what driver you're using?


update setting all fields to zero - El Forum - 04-13-2012

[eluser]mflammia[/eluser]
Sorry, Ok, sure, maybe I'm reading into this more then I need to - mysql?

Code:
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'questionnaire';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;



update setting all fields to zero - El Forum - 04-13-2012

[eluser]mflammia[/eluser]
Tried something in this link

Remove backticks

to remove the backticks from the mysql_driver.php but really strangly it don't cure the issue?

I'll keep at it and post any new findings.


update setting all fields to zero - El Forum - 04-13-2012

[eluser]LifeSteala[/eluser]
If I recall some time ago, CI added ability to get past the back ticks. Take the following as an example:

Code:
$this->db->query('UPDATE QUERY GOES HERE', FALSE);

We send FALSE as the second parameter which escapes the ticks, does it not? Usually it's required when you do MySQL functions in the queries, for example, DATE_FORMAT().

-----------------------------------------------------------------------------------------
EDIT: Sorry this was covered in the link above.


update setting all fields to zero - El Forum - 04-15-2012

[eluser]mflammia[/eluser]
Managed to work out the problem, but its really strange and can't understand why!

In my view, under the header section I have the following html:

Code:
class="header"><a href="#"><img src="" alt="Insert Logo Here" name="Insert_logo" width="180" height="90" id="Insert_logo" /></a>
    &lt;!-- end .header --&gt;</div>

And its the the src="" bit thats causing the problem, as soon as I remove that I can updated to Database with no problem!

I have been able to do everything up to this point with that code intact, create records, display records, just an update resets all the records to 0.

Any ideas?




update setting all fields to zero - El Forum - 04-15-2012

[eluser]Aken[/eluser]
That can't possibly be causing errors in your PHP, unless it is corrupting the file when you save it or your code elsewhere is incorrect. HTML will not affect PHP in that way.


update setting all fields to zero - El Forum - 04-16-2012

[eluser]mflammia[/eluser]
I know, strange right.

But its a fact, soon as I remove

Code:
src=""

or change it to something like:

Code:
src="&lt;?php echo base_url();?&gt;image/banner.jpg"

it works fine?

Code:
src="#"

Did not work.

It's probably down to my coding somewhere as I'm still finding by feet with PHP and codeigniter - but happy to share my code or demonstrate it in someway.

Anyway, hopefully it may be of use to someone else so please post if it is.