Page 1 of 1

Query not occuring

Posted: Wed Mar 28, 2007 12:38 pm
by FluxNYC
Solved. Thanks for help.

Re: Query not occuring

Posted: Wed Mar 28, 2007 1:37 pm
by volka
FluxNYC wrote:No errors come up whatso ever the page loads as if the insertion occured. Any ideas?
Sounds like the script works fine ...unless it doesn't?

try

Code: Select all

<?php
error_reporting(E_ALL);
ini_set('display_errors', true);

if ( !isset($_POST['cname']) ) {
  die('cname not set');
}
else {
  $link = mysql_connect($hostname,$username, $password) or die(mysql_error());
  mysql_select_db($dbname, $link) or die(mysql_error());

  $query = "INSERT into $campaigns_table (campaign_name) VALUES ('".mysql_real_escape_string($_POST['cname'])."')";
  echo '<div Debug: ', htmlentities($query), "</div>\n";               
  mysql_query($query, $link) or die(mysql_error());
  echo 'affected rows: ', mysql_affected_rows($link), "<br />\n";
}