Jump to content

How do I Auto insert to db without a form


Parabolundertow

Recommended Posts

Hi there,

 

I am trying to run a counter so when a person clicks on a banner, it updates the db with a new number.

I have called the banner link:  ad_counter.php?id=1

I have a field in my table called ad_counter

 

Then im setting a recordset to GET the data.

I am using:

 

$last = $row_Recordset1['ad_counter'];

$add = 1;

$ad_counter = $last + $add;

 

What I want to do is auto form fill and update the database, and proceed to their website without this process even being seen.

 

Is this possible without having to push the form submit button.

 

A basic statistics gatherer for businesses who wish to advertise.

 

Thankyou

Link to comment
Share on other sites

I have called the banner link:  ad_counter.php?id=1

 

Modify this link to

 

modify banner link to:   ad_counter.php?id=1&do=update

On your ad_counter.php page

if($_GET['do']=='update && !empty($_GET['id']){
  //update your database counter.
}

 

 

 

 

 

Link to comment
Share on other sites

Hi guys,

 

Im still trying to make this work ...

Im hoping to call the ad_counter from the table using $_GET, add 1 and update, then go to a url.

 

here is my script:

<?php require_once('Connections/Farout.php'); ?>

<?php

if (isset($_GET['id'])) {

  $colname_rsBusinessclick = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);

}

mysql_select_db($database_Farout, $Farout);

$query_rsBusinessclick = sprintf("SELECT * FROM hub_directory WHERE id = '%s'", $colname_rsBusinessclick);

$rsBusinessclick = mysql_query($query_rsBusinessclick, $Farout) or die(mysql_error());

$row_rsBusinessclick = mysql_fetch_assoc($rsBusinessclick);

$totalRows_rsBusinessclick = mysql_num_rows($rsBusinessclick);

 

 

 

$ad_counter = $row_rsBusinessclick['ad_counter'];

 

if($_GET['do']=='update' && !empty($_GET['id']){

  mysql_query('update hub_directory set ad_counter = ad_counter +1 where id = {$_GET['id']}');

 

 

  $updateGoTo = "http://www.mywebaddress.com.au";

  if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {

    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";

    $updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];

  }

  header(sprintf("Location: %s", $updateGoTo));  }

 

?>

 

 

 

Where am I going wrong ... ??

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.