close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

mysqli update

Thread began 10/19/2016 4:43 am by Jamie | Last modified 10/20/2016 6:38 pm by Ray Borduin | 1949 views | 4 replies |

Jamie

mysqli update

Hi Ray

Am trying to get a msqli update to work on a couple of pages. One is a simple dingle update (user_message.php) the other is to do a multiple update (user_messages.php) which I dont know how to do (or convert from a mysql version) both of which pages are attached.

Both pages are trying to use the checkbox 'Message Read' to update db the column MessageRead in the db messages - just one is a single update, the other is a multiple

Thanks in advance

Jamie

Sign in to reply to this post

Ray BorduinWebAssist

The single update is updating based on the $_GET variable, but you aren't passing it through the form post. The easy solution is to just remove the form action and the url parameters will be automatically forwarded.

You can convert the multiple update by:
1) rename the checkbox to: MessageRead[]
2) set the value of the checkbox to the unique ID for the table
3) apply the update server behavior. Set the ID to update to: <?php echo($loopID); ?>
4) manually wrap the update code in a for loop like:

<?php
if (isset($_POST['Update'])) {
$updateIDs = $_POST['MessageRead'];
for ($x=0; $x<sizeof($updateIDs); $x++) {
$loopID = $updateIDs[$x];
?>

/// update code here ///

<?php
}
}
?>
Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

thanks for all that.

I had tried the single without the form action earlier and it didnt work - just redirected to itself but didnt update the db - just tried it again and still doing the same.

(Will take a look at the multiple tomorrow and see how i get on)

Sign in to reply to this post

Jamie

OK, have tried the multiple update but its not working and the checkboxes are no longer visible...

have also been trying to get the single to work but it doesnt nor does it redirect to the page specififed in the update server behaviour

both files attached so you can see where I have gone wrong?

thanks mate

Sign in to reply to this post

Ray BorduinWebAssist

We figured this out in a premier support ticket.

You had a few issues:
1) You still had form validation from another page on the top preventing any form submits from going through
2) You had wrapped the checkbox instead of the update server behavior with the for loop I suggested

We corrected those two issues and the page is working now.

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