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 Sun Sep 20, 2020 7:46 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 
Offline

Joined: Tue Jun 16, 2015 1:03 am
Posts: 14
[b][/Hi,someone tell what's wrong with this code
Code:
      <?php
// 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'" ;
            mysqli_select_db('homedb');
            $retval = mysql_query( $sql, $conn );
           
            if(! $retval ) {die('Could not update data: ' . mysql_error());}
            echo "Updated data successfully\n";           
            mysql_close($conn);
         
            ?>
b]


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

Joined: Wed Sep 12, 2007 2:18 pm
Posts: 3569
Hi.

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

It should be:

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

Regards,
Codelobster Team.


Top
 Profile  
 
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 26 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:  
cron
Powered by phpBB © 2016 phpBB Group