1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Fatal error: Call to undefined function: getsqlvaluestring()

Discussion in 'PHP' started by nephites, Jan 31, 2006.

  1. #1
    im kinda new in using php, I have a script here that have an eror Fatal error: Call to undefined function: getsqlvaluestring() on line 10. Hope somebody can help me with this.


    <?php
    $currentPage = $HTTP_SERVER_VARS["PHP_SELF"];
    $editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
    if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
    $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
    }

    if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
    $updateSQL = sprintf("UPDATE stud SET s_fname=%s, s_mname=%s, s_lname=%s, user_name=%s, pass_word=%s WHERE s_num=%s",
    GetSQLValueString($HTTP_POST_VARS['s_num'], "int"),
    GetSQLValueString($HTTP_POST_VARS['s_fname'], "text"),
    GetSQLValueString($HTTP_POST_VARS['s_mname'], "text"),
    GetSQLValueString($HTTP_POST_VARS['s_lname'], "text"),
    GetSQLValueString($HTTP_POST_VARS['user_name'], "text"),
    GetSQLValueString($HTTP_POST_VARS['pass_word'], "text"));


    mysql_select_db($database_vino, $hotel_vino);
    $Result1 = mysql_query($updateSQL, $hotel_vino) or die(mysql_error());
    }

    $maxRows_Recordset1 = 1;
    $pageNum_Recordset1 = 0;
    if (isset($HTTP_GET_VARS['pageNum_Recordset1'])) {
    $pageNum_Recordset1 = $HTTP_GET_VARS['pageNum_Recordset1'];
    }
    $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

    mysql_select_db($database_vino, $hotel_vino);
    //$query_Recordset1 = "SELECT * FROM stud where agency_id = $current_agency_id";
    $query_Recordset1 = "SELECT * FROM stud";
    $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
    $Recordset1 = mysql_query($query_limit_Recordset1, $hotel_vino) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    SEMrush
    if (isset($HTTP_GET_VARS['totalRows_Recordset1'])) {
    $totalRows_Recordset1 = $HTTP_GET_VARS['totalRows_Recordset1'];
    } else {
    $all_Recordset1 = mysql_query($query_Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
    }
    $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

    $queryString_Recordset1 = "";
    if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
    $params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
    $newParams = array();
    foreach ($params as $param) {
    if (stristr($param, "pageNum_Recordset1") == false &&
    stristr($param, "totalRows_Recordset1") == false) {
    array_push($newParams, $param);
    }
    }
    if (count($newParams) != 0) {
    $queryString_Recordset1 = "&" . implode("&", $newParams);
    }
    }
    $queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
    ?>
     
    nephites, Jan 31, 2006 IP
    SEMrush
  2. mad4

    mad4 Peon

    Messages:
    6,989
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need a seperate function called GetSQLValueString, if you don't have this the script won't work.
     
    mad4, Jan 31, 2006 IP
  3. nephites

    nephites Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    well, tnx for the reply but i have used this same script in my previous program and that work. the only thing that changed is the value and the and variable. here is the script that works.

    <?php
    $currentPage = $HTTP_SERVER_VARS["PHP_SELF"];
    $editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
    if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
    $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
    }

    if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
    $updateSQL = sprintf("UPDATE seaman_agency_jobpostings SET agency_id=%s, job=%s, salary_range=%s, posted=%s, expiry=%s WHERE job_id=%s",
    GetSQLValueString($HTTP_POST_VARS['agency_id'], "int"),
    GetSQLValueString($HTTP_POST_VARS['job'], "text"),
    GetSQLValueString($HTTP_POST_VARS['salary_range'], "text"),
    GetSQLValueString($HTTP_POST_VARS['posted'], "date"),
    GetSQLValueString($HTTP_POST_VARS['expiry'], "date"),
    GetSQLValueString($HTTP_POST_VARS['job_id'], "int"));

    mysql_select_db($database_seaman_com, $seaman_com);
    $Result1 = mysql_query($updateSQL, $seaman_com) or die(mysql_error());
    }

    $maxRows_Recordset1 = 1;
    $pageNum_Recordset1 = 0;
    if (isset($HTTP_GET_VARS['pageNum_Recordset1'])) {
    $pageNum_Recordset1 = $HTTP_GET_VARS['pageNum_Recordset1'];
    }
    $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

    mysql_select_db($database_seaman_com, $seaman_com);
    $query_Recordset1 = "SELECT * FROM seaman_agency_jobpostings where agency_id = $current_agency_id";
    $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
    $Recordset1 = mysql_query($query_limit_Recordset1, $seaman_com) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);

    if (isset($HTTP_GET_VARS['totalRows_Recordset1'])) {
    $totalRows_Recordset1 = $HTTP_GET_VARS['totalRows_Recordset1'];
    } else {
    $all_Recordset1 = mysql_query($query_Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
    }
    $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

    $queryString_Recordset1 = "";
    if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
    $params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
    $newParams = array();
    foreach ($params as $param) {
    if (stristr($param, "pageNum_Recordset1") == false &&
    stristr($param, "totalRows_Recordset1") == false) {
    array_push($newParams, $param);
    }
    }
    if (count($newParams) != 0) {
    $queryString_Recordset1 = "&" . implode("&", $newParams);
    }
    }
    $queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
    ?>
     
    nephites, Jan 31, 2006 IP
  4. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,220
    Likes Received:
    778
    Best Answers:
    0
    Trophy Points:
    0
    #4
    There must be a file you included that defines that function. You must have forgotten to include that in the new script.

    By the way, use the VB [php][/php] tag around code to make it readable for us.

    Looks like you need this:

    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
    }
    
    PHP:
     
    T0PS3O, Jan 31, 2006 IP
  5. nephites

    nephites Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5

    Dude! thanks you so much. You are right, I forgot to include that function. Now works like a charm.
     
    nephites, Jan 31, 2006 IP