Query not occuring
Moderator: General Moderators
Query not occuring
Solved. Thanks for help.
Last edited by FluxNYC on Wed Mar 28, 2007 3:28 pm, edited 1 time in total.
Re: Query not occuring
Sounds like the script works fine ...unless it doesn't?FluxNYC wrote:No errors come up whatso ever the page loads as if the insertion occured. Any ideas?
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";
}