Jump to content

frankriedel

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

frankriedel's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=325266:date=Dec 7 2005, 05:26 AM:name=morpheus.100)--][div class=\'quotetop\']QUOTE(morpheus.100 @ Dec 7 2005, 05:26 AM) 325266[/snapback][/div][div class=\'quotemain\'][!--quotec--] $query_Recordset2 = sprintf("SELECT * FROM userbuy WHERE uge = '%s'", $colname_Recordset2); Your SQL is for a select here not an insert. THX Prob solved
  2. Is it possible to make a PHP code that redirect to another page if a recordset is EMPTY ?? If so - give an example please ;o) Regards Frank
  3. I FOUND THIS www.kartcare.com.au/tuts/multi/ Is there som hardcore coder that can convert ASP to PHP then it rocks ..... Regards Frank
  4. Hi All ! Is there a hardcore programer that will bring an example on how to add a record to a DB and if the record is existing makes modification to it and update the DB Regards Frank
  5. Hi All - Please take a moment to help me ! I have a page with 2 table with 2 forms, one for UPDATE and one for INSERT the update works fine - but when there is no record in the DB and i then use the insert form the error - QUERY IS EMPTY comes up??? What do i do ??? <?php 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; } $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"] == "form2")) { $updateSQL = sprintf("UPDATE userbuy SET bruger=%s, WHERE uge=%s", GetSQLValueString($HTTP_POST_VARS['bruger'], "text"), mysql_select_db($database_DBZ, $DBZ); $Result1 = mysql_query($updateSQL, $DBZ) or die(mysql_error()); $updateGoTo = "tak.php"; if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } $editFormAction1 = $HTTP_SERVER_VARS['PHP_SELF']; if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $editFormAction1 .= "?" . $HTTP_SERVER_VARS['QUERY_STRING']; } if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO userbuy (bruger) VALUES (%s)", GetSQLValueString($HTTP_POST_VARS['bruger'], "text"), mysql_select_db($database_DBZ, $DBZ); $Result1 = mysql_query($insertSQL, $DBZ) or die(mysql_error()); $insertGoTo = "tak.php"; if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } $colname_Recordset1 = "1"; if (isset($HTTP_SESSION_VARS['aktuel_uge'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $HTTP_SESSION_VARS['aktuel_uge'] : addslashes($HTTP_SESSION_VARS['aktuel_uge']); } mysql_select_db($database_DBZ, $DBZ); $query_Recordset1 = sprintf("SELECT * FROM kokken WHERE k_uge = '%s'", $colname_Recordset1); $Recordset1 = mysql_query($query_Recordset1, $DBZ) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); $colname_Recordset2 = "1"; if (isset($HTTP_SESSION_VARS['userN'])) { $colname_Recordset2 = (get_magic_quotes_gpc()) ? $HTTP_SESSION_VARS['userN'] : addslashes($HTTP_SESSION_VARS['userN']); } mysql_select_db($database_DBZ, $DBZ); $query_Recordset2 = sprintf("SELECT * FROM userbuy WHERE uge = '%s'", $colname_Recordset2); $Recordset2 = mysql_query($query_Recordset2, $DBZ) or die(mysql_error()); $row_Recordset2 = mysql_fetch_assoc($Recordset2); $totalRows_Recordset2 = mysql_num_rows($Recordset2); ?>
×
×
  • 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.