Skip to content

Tag: mysql

How to fetch 3 columns from the same row in the result?

I’m trying to fix a code in an osCommerce store which is giving the following error on PHP 5.4: mysql_result(): supplied argument is not a valid MySQL result resource This is the code: I tried to change it and there are no more errors, but it’s still not working. Is this the correct way to do it? …

How to Save HTML to mysql using PHP?

I am trying to post some html though a form to a php page and then trying to save that html into database the problem which I am facing is that when I save this to database it includes many html …

Is minus (negative) zero equivalent to 0 in PHP?

I have a very basic MySQL query that reads rows from a database table and adds or subtracts the row value to a PHP string defined as $total_balance. For example; My question is, what is the difference between -0 and 0? Answer In PHP, there is no real difference: Float: Int:

Get primary key of Eloquent model instance

I’m happy enough to work on a project with (not) very consistent column names in our MySQL database. We have camelCase, PascalCase, ‘Id’, ID and it’s driving me nuts. I’ve decided to start using Eloquent in our application (which is NOT Laravel). I would love to have a method of …

Default value for username in SQL database

I’m writing a Laravel application, and for testing in sqlite you need to specify ->nullable() or ->default(“123”) for all fields in your migration. This confuses me as my User-migration currently looks like this: Many of these make no sense to add neither ->default(“123”…