PHP kullanarak MySQL DB içine insert ile sorun

0 Cevap php

I have strange problem that I have a PHP page used to insert data into Mysql DB. the problem is that when I execute the code, nothing added to db and no errors is appeared although I set display errors codes

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

Bu sorun hakkında herhangi bir fikir!

Burada eklemek için benim kullanılan kod

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}


include("Connections/mzk_mdc.php");
                $ext = 1;
                $website = "mzk";
                $mzk_sql=sprintf("INSERT INTO downloads (image, `by`, `rapid_title`, title, `description`, category, div_id, topic_url, down_times, ext, `website`) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                    GetSQLValueString($topic_thumb_image, "text"),
                     GetSQLValueString($topic_by, "text"),
                       GetSQLValueString($topic_des, "text"),
                       GetSQLValueString($topic_title, "text"),
                     GetSQLValueString($forum_content, "text"),
                     GetSQLValueString($topic_category, "text"),GetSQLValueString($topic_div, "text"),GetSQLValueString($forum_link, "text") ,GetSQLValueString($topic_down_times, "int"),GetSQLValueString($ext, "int"), GetSQLValueString($website, "text"));
                       mysql_select_db($database_mdc, $mdc);
                       $mzk_result = mysql_query($mzk_sql, $mdc) or die("can not do more");

                       mysql_close($mdc);

0 Cevap