CodeLobster IDE

Free cross-platform PHP IDE (HTML, PHP, CSS, JavaScript code editor) with support Drupal, Joomla, Twig, JQuery, BackboneJS, LaravelJS, Node.js, Fhalcon, CodeIgniter, CakePHP, Laravel, Magento, MeteorJS, Phalcon, Symfony, VueJS, WordPress, Yii
It is currently Mon Nov 23, 2020 7:17 pm

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: update database
PostPosted: Thu Mar 12, 2020 1:34 am 

Joined: Tue Jun 16, 2015 1:03 am
Posts: 14
[b][/Hi,someone tell what's wrong with this code
// error_reporting(0);
error_reporting(E_ALL ^ E_NOTICE);
require 'homedb-connect.php';

            $id = $_POST['id'];                   
            $target = $_POST['target'];
            $email = $_POST['email'];
            $visits = $_POST['visits'];
            $lastused = $_POST['lastused'];
            $saved = $_POST['saved'];
            $sql = "UPDATE lookuptbl ". "SET visits = visits+1, lastused = (NOW);
saved = "y".
               "WHERE date = '0000-00-00'" ;
            $retval = mysql_query( $sql, $conn );
            if(! $retval ) {die('Could not update data: ' . mysql_error());}
            echo "Updated data successfully\n";           

 Post subject: Re: update database
PostPosted: Tue Mar 24, 2020 2:32 pm 
Site Admin

Joined: Wed Sep 12, 2007 2:18 pm
Posts: 3590

You have a syntax error in your SQL query (; instead of .)

It should be:

$sql = "UPDATE lookuptbl ". "SET visits = visits+1, lastused = (NOW)".
"saved = 'y'".
               "WHERE date = '0000-00-00'" ;

Codelobster Team.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 19 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2016 phpBB Group