close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Insert won't wok on remote server - Incorrect integer value: '

Thread began 10/11/2016 6:24 pm by mrs | Last modified 10/14/2016 10:20 am by Ray Borduin | 3586 views | 8 replies |

mrs

Insert won't work on remote server - Incorrect integer value: '

I'm getting this error when I submit the page on the remote server:

Incorrect integer value: '
Notice: Undefined index: bookingID in /home/website.com/user/htdocs/pb/book-a-cycling-tour.php o' for column 'b_bookingid' at row 1

This works on my localhost, and it was working on the remote before I inserted the Universal Email. The only change that I think I have made to my insert code is remove the URL redirect which is now handled by the email code.

I have searched this and it seems to imply that I am trying to insert a number into the column b_bookingid and that can't be done because it is an auto increment column, BUT IT'S NOT... the auto increment primary key column is b_id. I've double checked the insert behaviour by double clicking it in the server behaviours panel, and b_id has no value being posted to it.

I'm at a loss for this! I'd really appreciate anybody's help on this if you could.

File attached.

Attached Files
book-a-cycling-tour.php
Sign in to reply to this post

mrs

Just to let you know, I tried removing the Universal email and replacing the URL redirect in the insert code, but the error still persists!

Sign in to reply to this post

mrs

With a bit more investigation, I decided to do a show if on the hidden field that is populating b_bookingid and it seems that b_booking id MUST have a value, even if it's '0' rather than be blank when being posted to the DB.

Now, I have other fields that are INT within the DB table that have no interaction from the insert page, however, it would seem the error is now being caused on a DB column (within the same table) called b_totalcustomers! As I say, this isn't being submitted to by this insert, and therefore I can only assume that the DB is causing the problem.

Setting INT to a default of '0' has no effect, it seems I have to actually submit content to every INT column even I am expecting other pages in the CMS to handle these columns for admin/business requirements.

Have you got any idea of how to overcome this?

This is my DB code:

CREATE TABLE `tbl_bookings` (
`b_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`b_bookingid` int(11) DEFAULT '0' COMMENT 'Copy of b_id for extra person',
`b_tripid` int(11) DEFAULT '0' COMMENT 'ID of Tour booked',
`b_title` varchar(25) DEFAULT NULL,
`b_first` varchar(255) DEFAULT NULL,
`b_last` varchar(255) DEFAULT NULL,
`b_dob` varchar(100) DEFAULT NULL,
`b_nationaility` varchar(100) DEFAULT NULL,
`b_gender` varchar(12) DEFAULT NULL,
`b_tel` varchar(20) DEFAULT NULL,
`b_mob` varchar(20) DEFAULT NULL,
`b_email` varchar(100) DEFAULT NULL,
`b_password` varchar(100) DEFAULT NULL,
`b_address` text,
`b_notes` text,
`b_emergencyname` varchar(255) DEFAULT NULL,
`b_emergencytel` varchar(20) DEFAULT NULL,
`b_roomtype` int(1) DEFAULT '0',
`b_promo` varchar(50) DEFAULT NULL,
`b_hire` int(2) DEFAULT '0',
`b_transfer` int(2) DEFAULT '0',
`b_referrer` int(2) DEFAULT '0',
`b_referrerinfo` varchar(150) DEFAULT '0',
`b_totalcustomers` int(2) DEFAULT '0',
`b_deposit` decimal(10,2) DEFAULT NULL,
`b_balance` decimal(10,2) DEFAULT NULL,
`b_bookdate` datetime DEFAULT CURRENT_TIMESTAMP,
`b_timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`b_id`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=latin1;

Sign in to reply to this post

mrs

More investigation has led me to import all of the tables into an old database on an old server at Fasthosts where none of the tables are duplicated, I have connected the website to this old database and the insert has worked.

What I have found out is that although the MySQL versions are the same, the old server is not set to strict, whereas the new server is. As a result, if no content is being posted to an INT column, then the insert fails. As far as I can tell, if a checkbox isn't checked when I submit, then the insert fails because nothing is being passed on insert. I've got the default value for the column in the DB set to 0 if the check box isn't checked, but this isn't overcoming the issue... strict mode seems to require a value of any INT column, otherwise it fails.

So first things first, when inserting, how do I get a check box to pass zero over to the DB if it is unchecked?

Secondly, how do I overcome getting a value into an INT column if it exists in the database table, but isn't actually being used or inserted into by the webpage with the submitting form?

Is this standard MySQL practice now to abort an insert if not all columns of the table are being utilised by the insert?

How do I resolve this?

Sign in to reply to this post

Ray BorduinWebAssist

If it has a default of zero set in the database then it will set the value to zero if it isn't included in the form.

If you set the data type in the insert to "Checkbox: 0.1" then it should insert the zero when the checkbox is unchecked. If you still have issues please send a copy of the page you are working on and I can take a look.

Sign in to reply to this post
Did this help? Tips are appreciated...

mrs

Using a checkbox was just an example for explanatory purposes.

Setting a value to default of 0 is exactly how I thought I would get around the problem, but it doesn't work... not with fasthosts in the UK anyway.

`b_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`b_bookingid` int(11) DEFAULT '0' COMMENT 'Copy of b_id for extra person',

They're saying that strict requires an input and they're suggesting I use a hidden field. Well, if this was a record that required admin authorisation before it went live, then all a hacker would need to do is show source, find the hidden field change the records visibility and they could post anything they wanted.

As far as I am aware, it only seems to be happening on INT columns.

So Ray, as far as you're aware, strict should still allow an insert if the column has got a default value applied; is that right? That's not how it's happening though!

I've had to get around it by making sure that my insert behaviour has a value in it for every column whether it is being used or not.

Sign in to reply to this post

Ray BorduinWebAssist

You don't need a hidden field... you can always just put the value in for the binding without referring to a field to make it un-hackable.

Sign in to reply to this post
Did this help? Tips are appreciated...

mrs

Yeah, I've done that with the bindings, but I just can't believe that the hosting service, and even some developers are telling me it's an easy get around by using hidden fields!

So, for future reference in the bindings panel, how would I do an if/else value?

If I wanted a session to be checked if it wasn't empty, and if it was then apply a value of 0. I assume the structure will look something like this, but I'm not entirely sure of the correct code:

{
if $_SESSION["sessionName"] <> "" then $_POST $_SESSION["sessionName"]
}
ELSE
{
0
}

I think my logic is about right, but I have no idea of how to apply this in the binding panel of DA's insert record behaviour. I don't know if the brackets would throw it out or not

Sign in to reply to this post

Ray BorduinWebAssist

php:
<?php echo((isset($_SESSION["sessionName"]) && $_SESSION["sessionName"] != "")?$_SESSION["sessionName"]:"0"); ?>
Sign in to reply to this post
Did this help? Tips are appreciated...

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...