Php form field inserts return empty string

hello -
i've created a form that has multiple inserts. it inserts the data fine if i manually parse the data to it but when i use the form to test the inserts it errors out.
i've used echo $_post variable and the variable is their. but its not being inserted into the database.
it says that the string cannot be null?
where do i go from here for debugging?
thanks, in advance for your help!
theo werntz ii

I've tried entering data but it doesn't insert i've change the column type to longblob from varchar and it still doesnt insert.
here is my code: ignore the numbers and line ending with $
  1 <?php require_once('Connections/upics.php'); ?>$
  2 <?php$
  3 if (!function_exists("GetSQLValueString")) {$
  4 function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") $
  5 {$
  6   if (PHP_VERSION < 6) {$
  7     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;$
  8   }$
  9 $
10   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);$
11 $
12   switch ($theType) {$
13     case "text":$
14       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";$
15       break;    $
16     case "long":$
17     case "int":$
18       $theValue = ($theValue != "") ? intval($theValue) : "NULL";$
19       break;$
20     case "double":$
21       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";$
22       break;$
23     case "date":$
24       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";$
25       break;$
26     case "defined":$
27       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;$
28       break;$
29   }$
30   return $theValue;$
31 }$
32 }$
33 $
34 $
35 $uname="guest";$
36 $uname_id = '1' ;$
37 $pt="pictures";$
38 $picPath="pt/img_0.gif"; $
39 $picSize="1024";$
40 $
41 $editFormAction = $_SERVER['PHP_SELF'];$
42 if (isset($_SERVER['QUERY_STRING'])) {$
43   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);$
44 }$
45 $
46 if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {$
47 $
48 $insertSQL_0 = sprintf("INSERT INTO album (album_id, album_nm, album_dt, album_pt) VALUES ( %s, %s, curdate(), '$pt')",$
49                        GetSQLValueString($_POST['album_id'], "int"),$
50                        GetSQLValueString($_POST['album_nm'], "text"),$
51                        GetSQLValueString($_POST['album_dt'], "date"),$
52                        GetSQLValueString($_POST['album_pt'], "text"));$
53 $
54 $insertSQL_1 = sprintf("insert into album_has_user (album_album_id, user_user_id, user_admin_id) values (last_insert_id(), '$uname_id', '$uname_id')",$
55 GetSQLValueString($_POST['album_has_user'], "int"),$
56 GetSQLValueString($_POST['user_user_id'], "int"),$
57 GetSQLValueString($_POST['user_admin_id'], "int"),$
58 $
59 $insertSQL_2 = sprintf("insert into title (title_id, title_title, title_dt, album_album_id, title_memo) values (last_insert_id(), %s, curdate(), last_ins    ert_id(), %s)",$
60 GetSQLValueString($_POST['title_id'], "int"),$
61 GetSQLValueString($_POST['title_title'], "text"),$
62 GetSQLValueString($_POST['title_dt'], "date"),$
63 GetSQLValueString($_POST['album_album_id'], "int"),$
64 GetSQLValueString($_POST['title_memo'], "text"));$
65 $
66 $
67 $insertSQL_3 = sprintf("insert into picture (picture_id, picture_dp, picture_sz, picture_df, title_title_id) values  (last_insert_id(), '$picPath', '$pic    Size', 'N', last_insert_id())", $
68 GetSQLValueString($_POST['picture_id'], "int"),$
69 GetSQLValueString($_POST['picture_dp'], "text"),$
70 GetSQLValueString($_POST['picture_sz'], "text"),$
71 GetSQLValueString($_POST['picture_df'], "text"),$
72 GetSQLValueString($_POST['title_title_id'], "int"));$
73 $
74 echo $_POST['title_title'];
75 $
76 //insert users album if null$
77   mysql_select_db($database_upics, $upics);$
78   $Result1 = mysql_query($insertSQL_0, $upics) or die(mysql_error());$
79 $
80 //insert users many data$
81   mysql_select_db($database_upics, $upics);$
82   $Result2 = mysql_query($insertSQL_1, $upics) or die(mysql_error());$
83   $
84 //insert users title and comments  $
85   mysql_select_db($database_upics, $upics);$
86   $Result3 = mysql_query($insertSQL_2, $upics) or die(mysql_error());$
87   $
88 //insert users picuter path$
89   mysql_select_db($database_upics, $upics);$
90   $Result4 = mysql_query($insertSQL_3, $upics) or die(mysql_error());  $
91 $
92   $insertGoTo = "picture_edit.php";$
93   if (isset($_SERVER['QUERY_STRING'])) {$
94     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";$
95     $insertGoTo .= $_SERVER['QUERY_STRING'];$
96   }$
97   header(sprintf("Location: %s", $insertGoTo));$
98 }$
99 ?>$
100 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">$
101 <html xmlns="http://www.w3.org/1999/xhtml">$
102 <head>$
103 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />$
104 <title>Untitled Document</title>$
105 </head>$
106 $
107 <body>$
108 <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">$
109   <table align="center">$
110     <tr valign="baseline">$
111       <td nowrap="nowrap" align="right">Album Name:</td>$
112       <td><input type="text" name="album_nm"  id="album_nm" value="default" size="32" /></td>$
113     </tr>$
114     <tr valign="baseline">$
115     <td nowrap="nowrap" align="center">Title:</td>$
116     <td><input name="title_title" id="title_title" type="text" value="" size="32" /></td>$
117     </tr>$
118     <tr valign="baseline">$
119     <td nowrap="nowrap" align="center">Date:</td>$
120     <td><input name="title_dt" id="title_dt" type="text" value="" size="32" /></td>$
121     </tr>$
122     <tr valign="baseline">$
123     <td nowrap="nowrap" align="center">Comments:</td>$
124     <td><textarea name="title_memo" cols="32" id="title_memo"></textarea></td>$
125     </tr>$
126     <tr valign="baseline">$
127       <td nowrap="nowrap" align="right"> </td>$
128       <td><input type="submit" value="Insert record" /></td>$
129     </tr>$
130   </table>$
131   <input type="hidden" name="album_id" value="" />$
132   <input type="hidden" name="album_dt" value="" />$
133   <input type="hidden" name="album_pt" value="" />$
134   <input type="hidden" name="MM_insert" value="form1" />$
135 </form>$
136 <p> </p>$
137 </body>$
138 </html>$
this is echo:    this is the error:
default           Column 'title' cannot be null
thanks in advance for you help

Similar Messages

  • Min aggregate function returns empty string

    I have a data set with a column named "month" which contains string values like 1,2,3... etc. including empty string. When I apply an aggregate Min function like below, it returns empty string instead of 1. or the lowest month number.
    Min(Fields!month.Value, "Financial")
    Please if any one can assist me on this.
    Regards

    Hi ABDUL-HAFEEZ,
    As you know the Min() function returns the minimum value of all non-null numeric values specified by the expression, because you have null string in the field and also the field type is string but not numeric, so this function will not works fine.
    I have tested on my local environment that we can get the first convert the string to numeric type value and then get the min value of the month field by using the query not the expression.
    Details information below for your reference:
    Create an new dataset(DataSet2) to get the minimum value from the Month and the query like below:
    SELECT     Min(CAST(Month AS INT)) as NewMonth
    FROM         TableName
    Using below expression in the main dataset will display the minimum value of the month:
    =Sum(Fields!NewMonth.Value, "DataSet2")
    If you still have any problem, please feel free to ask.
    Regards
    Vicky Liu
    If you have any feedback on our support, please click
    here.
    Vicky Liu
    TechNet Community Support

  • Setting input fields to an empty string BIG PROBLEM

    Hi Rob, thanks for your rerply, It makes sense alright, but I am using 2 seperate input fields. I have discovered what is causing the problem .
    After the user types into the inputfield and moves on to a different frame, I have set the input field to an empty string and this is what is causing the problem.
    I have tried setting the input field to an empty string in a movie script and on individual sprites and the first right answer is not excepted.I have to type in the right answer twice to get get a right response. I am actually using three seperate input fields in total, each with a different name and behavior. Even If I use one input field I still have the same problem. Its driving me crazey. Any Ideas.
    Anne

    I believe that the FIM Service always does trims on string, so you may be out of luck.
    What is your scenario / what are you trying to accomplish by setting a space in an attribute? A space is not an empty string in my definition.
    Regards, Soren Granfeldt
    blog is at http://blog.goverco.com | facebook https://www.facebook.com/TheIdentityManagementExplorer | twitter at https://twitter.com/#!/MrGranfeldt

  • WINE err:"wine cmd.exe /c echo '%ProgramFiles%' returned empty string"

    So as the tittle states WINE is throiwng this error:
    wine cmd.exe /c echo '%ProgramFiles%' returned empty string
    As for what might have caused it? probably the last system update which was performed a few days ago, my old prefix works fine but I have a habit of creating new prefixes for troublesome applications, or applications I am unsure of whether they will cause trouble or not.
    Hence I created a new prefix using:
    export WINEARCH=win32
    export WINEPREFIX=~/.problematic
    winecfg
    As for how wine is run, it's run as a normal, unprivileged, user.
    Oh and I also tried generating yet another prefix like this:
    $ WINEARCH=win32 WINEPREFIX=~/.problematic-new winetricks steam
    Executing w_do_call steam
    wine cmd.exe /c echo '%ProgramFiles%' returned empty string
    Didn't work either.
    I'm at loss, any suggestion on how to fix it?
    Last edited by CubeGod (2014-06-29 15:48:05)

    $ WINEARCH=win32 WINEPREFIX=~/testprefix notepad.exe
    bash: notepad.exe: command not found
    So obviously I need to correct the command
    $ WINEARCH=win32 WINEPREFIX=~/testprefix wine notepad.exe
    wine: created the configuration directory '/home/shiina/testprefix'
    err:module:load_builtin_dll failed to load .so lib for builtin L"winemp3.acm": libmpg123.so.0: cannot open shared object file: No such file or directory
    fixme:ntdll:NtLockFile I/O completion on lock not implemented yet
    err:mscoree:LoadLibraryShim error reading registry key for installroot
    err:mscoree:LoadLibraryShim error reading registry key for installroot
    err:mscoree:LoadLibraryShim error reading registry key for installroot
    err:mscoree:LoadLibraryShim error reading registry key for installroot
    fixme:ntdll:NtLockFile I/O completion on lock not implemented yet
    fixme:iphlpapi:NotifyAddrChange (Handle 0xece880, overlapped 0xece88c): stub
    wine: configuration in '/home/shiina/testprefix' has been updated.
    Wine cannot find the ncurses library (libncursesw.so.5).
    why is ncurses a dependency anyway? besides, wicd-curses works so this shouldn't be the case.
    Anyway, trying winetricks in the same prefix
    $ WINEARCH=win32 WINEPREFIX=~/testprefix winetricks steam
    Executing w_do_call steam
    wine cmd.exe /c echo '%ProgramFiles%' returned empty string
    Anyway, I expected notepad to work since it resides in %WINDOWS% not %ProgramFiles%
    Is there any registry key I can set for this? all my google searching says this can cause with a mismatch of wine versions but why would that happen?
    Either way checking wine --version outputs wine-1.7.20 which is the same as it was pre-update (when it still worked).

  • LicenseServer property in Company object alway return empty string

    Hi everyone,
    When I use Company object and LicenseServer property to get LicenseServer, both in SBO 2004 & SBO 2005 all return empty string, who can help me get the correct LicenseServer name.
    Thanks in advance.
    Kathy

    Jose Xabier,
    Thanks for your reply, actually I need the License server name, but in SLIC table it saves Local hotost and port number some times like below:
    [localhost:30000]
    who knows how to get the name instead of Localhost,
    why licenseserver return empty sting? doI need set other property to get license server name for company object?
    Thanks,
    Kathy

  • Cfexchangemail fromID returns empty string

    I'm trying to create a "Reply with Template" bit of code and since Outlook 2007 doesn't have this capability, I thought I'd try the cfexchange tags to view the mail, pick a reponse and cfmail to send.
    We're using SBS 2008 & CF8 with all hotfixes
    I have the following basic code
    <cfexchangemail action="get"  name="weeksmail" connection="myconn" />
    <cfdump var="#weeksmail#">
    This returns email correctly (can read the messages) but in something like 1/2 of the messages the Fromid reads [empty string]The other half is populated correctly.
    If I can't get the fromID I can't populate the TO: in cfmail so I can't do what I'm trying to do.
    I can't see anything in the email themselves that would account for this. Any Ideas?

    Can you please post your query / stored procedure you are using? Very possible reason includes one among your substring (within the concat) is null and making the final output to be null. Size, esp 800 shouldn't matter.

  • Acrobat 6 filled form fields show up empty in Acrobat X

    I've been using Acrobat 6 to create fillable forms some time back and now I'm having some issues trying to correct some fields they are showing up empty in Acrobat X. Is there a way to still view or edit my saved Acrobat 6 filled forms in Acrobat X?
    Any help would be appreciated

    Hi,
    Would you take a look at Darrell's reply #4 in the following discussion to see if it answers your question?
    Re: Utilizing Adobe Reader version 11.6.3 in Ipad running IoS 8.1
    Thank you.

  • PHP form field not displayed [was: Newbie problem.]

    Hello good people.
    I have a very basic question to ask.
    Here is my index.html
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>PHP Test</title>
    <style>
    body {
        margin:50px;background-color:#232323; font-family:sans-serif; color:#B7B7B7; font-size:13px;
    input, textarea {
        border: #464646 solid 1px; background-color:#1C1C1C; font-family:sans-serif; color:#CECECE; font-size:10px; margin-top:15px; margin-bottom:15px;
    #submit {
        font-size:13px;   
    </style>
    </head>
    <body>
    <form action="index.php" method="post">
    What is your name?<br />
    <input type="text" name="name" /><br />
    What is your age?<br />
    <input type="text" name="age" /><br />
    <textarea type="text" name="tekstas" rows="5" cols="40">Your message.</textarea><br /><br />
    <input type="submit" value="Go!" id="submit"/>
    </form>
    </body>
    </html>
    And index.php
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <style>
    body {
        margin:50px;background-color:#232323; font-family:sans-serif; color:#B7B7B7; font-size:13px;
    </style>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>PHP Result</title>
    </head>
    <body>
    <?php
    settype($_POST["age"], "integer");
    echo "Your name is ".$_POST["name"]."<br />";
    if ($_POST["age"]!=0) echo "Your age is ".$_POST["age"]."<br /><br />";
    if ($_POST["age"]=0 ) echo "Please specify your age."."<br /><br />";
    echo "<b>Message:</b><br />".$_POST["tekstas"];
    ?>
    </body>
    </html>
    The question is:
    Why the Age part of php is not working properly? If I leave it black or type zero in the Age <input>, PHP just ignores the "Please specify your age" part of code.

    You're relatively new to this forum. Welcome.
    Please take a moment to read How to get help quickly. Using a subject line like "Newbie problem" is meaningless, and is likely to get ignored at busy times. Always try to use a descriptive subject line.
    The answer to your problem is very simple. It's a common beginner's mistake that even catches out more experienced people from time to time. It's in this line:
    if ($_POST["age"]=0 ) echo "Please specify your age."."<br /><br />";
    You have used only one equals sign, which assigns the value to a variable, so it always equates to TRUE.
    To compare two values, you must use two equals signs like this:
    if ($_POST["age"] == 0 ) echo "Please specify your age."."<br /><br />";
    There are other things that could be done to improve your code, but that solves the basic problem.

  • Setting SharePoint 2010 Form Fields Using Query String Variables

    Hi All,
    I have a requirement to populate sharepoint form field value with query string while uploading document to document library.
    While uploading the document to document library, I want to populate claim number available from query string in a pop up page i.e in my case EditForm.aspx, Located at
    http://servername:port/sitename/documentlibraryname/forms/EditForm.aspx.
    Additional Information:
    Created document library and added custom columns like claim number etc..
    Created a view to filter uploaded documents as per claim number.
    Server Details:
    Windows Server 2008 R2
    SharePoint 2010
    SQL Server 2008 R2
    I have written javascript for the same, but not sure where exactly to add the code in EditForm.aspx page.
    Any help on this would be greatly appreciated.
    Thanking you in advacne.
    Regards
    Seva

    if the NewForm.aspx contain a "New Item Form" or "Edit Item Form" you can populate the form field by doing the following:
    First for the data view create a parameter from query string and give it the claim_number query string name.
    now for the field Claim Number Convert it to normal ASP.NET TextBox example below for this
    Normal Field will be like this
    <SharePoint:formfield runat="server" id="ff5{$Pos}" ControlMode="Edit" FieldName="ClaimNumber" ItemId="{@ID}" __designer:bind="{ddwrt:DataBind('u',concat('ff5',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ClaimNumber')}" />
    you will change it to
    <asp:TextBox runat="server" id="ff5{$Pos}" __designer:bind="{ddwrt:DataBind('i',concat('ff5',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ClaimNumber')}" />
    Now in the asp:TextBox you can add the "Text" Attribute and assign the created data view parameter to it example below
    <asp:TextBox runat="server" id="ff5{$Pos}" Text="{$Claim_Number}" __designer:bind="{ddwrt:DataBind('i',concat('ff5',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ClaimNumber')}" />
    Where {$Claim_Number} is your Query String Parameter.
    Now if you send the query string NewForm.aspx?Claim_Number=1232
    you should see the field populated
    This what I do usually to populate the fields
    How I Bought a Brand New $1.2 Million Home Using ONLY Affiliate Commissions
    I'm having the same problem.... allmost
    I have a querystring I wan't to parse into a form. But on editform, not newform. then the field gets populated, but on save, nothing happens.... It's just blank.... any ideas.?
    /Ulrich

  • SQL query for empty string

    I am trying to execute the following SQl query, SELECT * FROM Failure WHERE ID = '123' AND RepairAction = ' ';, using the DB Tools Execute Query.vi. This query never finds the record in my database. My database contains a record where the ID filed contains the value of '123' and the RepairAction field is an empty string. If I remove the 'AND RepairAction ' ';' text from my query statement, the record is found. I believe my problem is that I am not using the correct syntax to describe and empty string. I have tried the following: '', ' ', "", " ", and NULL as empty string arguments, and none of these work.
    I was hoping someone might be able to tell me what the correct syntax is for an empty string or if there is another approach I need to take.
    Thank you in advance for your help,
    Jim
    Solved!
    Go to Solution.

    Hi,
    While creating your table "Failure", was the column "ID" delclared as intiger or varchar? If it is intiger and you use '123' , it wont return the results. You will have to try without the inverted comas ' '.
    Regards,
    Nitzz
    (Giver Kudos to good Answers, Mark it as a solution if your problem is Solved)

  • NULL and Empty String

    Hi There,
    As far as I know, Null is not the same as an empty string; however, when I try this out, I get some unexpected results (well, at least unexpected for my liking):
    SQL> CREATE TABLE TS (MID NUMBER,
      2  MDESC VARCHAR2(20) DEFAULT '' NOT NULL);
    Table created.
    SQL> INSERT INTO TS VALUES(1,'');
    INSERT INTO TS VALUES(1,'')
    ERROR at line 1:
    ORA-01400: cannot insert NULL into ("TT"."TS"."MDESC")So, according to the above scenario, I can't insert an empty string!! However, an empty string is a valid string that doesn't have tuples/data!!
    How come Oracle translates the null string '' as NULL?
    Thanks

    William Robertson wrote:
    There is a special case to do with CHAR values, whereby '' counts as a string and so gets blank-padded, whereas NULL does not.Are you referring to:
    SQL> DECLARE
      2      flag CHAR(2);
      3      PROCEDURE check_null (p_flag IN CHAR)
      4      IS
      5      BEGIN
      6        IF p_flag = '  '
      7        THEN
      8          dbms_output.put_line ('flag is equal to ''  ''');
      9        ELSIF p_flag IS NULL
    10        THEN
    11          dbms_output.put_line ('flag is null');
    12        ELSE
    13          dbms_output.put_line ('other');
    14        END IF;
    15      END;
    16    BEGIN
    17      flag := '';
    18      check_null (flag);
    19      flag := NULL;
    20      check_null (flag);
    21    end;
    22  /
    flag is equal to '  '
    flag is null
    PL/SQL procedure successfully completed.
    SQL> alter session set events '10932 trace name context forever, level 16384';
    Session altered.
    SQL> DECLARE
      2      flag CHAR(2);
      3      PROCEDURE check_null (p_flag IN CHAR)
      4      IS
      5      BEGIN
      6        IF p_flag = '  '
      7        THEN
      8          dbms_output.put_line ('flag is equal to ''  ''');
      9        ELSIF p_flag IS NULL
    10        THEN
    11          dbms_output.put_line ('flag is null');
    12        ELSE
    13          dbms_output.put_line ('other');
    14        END IF;
    15      END;
    16    BEGIN
    17      flag := '';
    18      check_null (flag);
    19      flag := NULL;
    20      check_null (flag);
    21    end;
    22  /
    flag is null
    flag is null
    PL/SQL procedure successfully completed.
    SQL> SY.
    P.S. Don't ask me why normal (or at least consistent) behavior is not the default.

  • NULL vs. Empty String

    I am new to ORACLE, moving over from MS SQL Server. Is it true that you cannot enter an empty string into a NOT NULL VARCHAR2?
    I am trying to convert data from an existing DB and I NEED to be able to have an empty string as much of the code base is using this to validate data (vs. a NULL). Is there any solution at all for this problem? I really do not want to keep my existing DB running but there is too much time involved converting code.
    Thanks, In Advance

    Bryna,
    In Oracle database, Oracle treats NULL and empty string
    column the same. Therefore, you cannot insert an empty string into a NOT NULL column.
    In OracleDataReader, if you want to find out if the column contains the NULL values, use the OracleDataReader.IsDBNull() function.
    Thanks
    Martha

  • Varchar2, empty strings and NULL

    Hi all,
    When inserting an empty string into a column of type varchar2 - is a NULL value stored in the column by the database? I've seen conflicting reports, and I know that the SQL 1992 spec specifies that empty strings not be treated as a NULL value, but that Oracle has traditionally treated zero length strings stored in a varchar2 column as NULL.
    So, is there a way to store an empty string in a varchar2 column as an empty string and not a NULL value?
    TIA,
    Seth

    It can be even more complicated or annoying than NULL not equal to ASCII NULL.
    example:
    create table test_null
    (fld1 varchar2(10),
    fld2 varchar2(10),
    fld3 varchar2(20));
    insert into test_null values (chr(0),null, 'chr(0) and null');
    insert into test_null values (null, null, 'null and null');
    insert into test_null values ('', chr(0), ''''' and chr(0)');
    insert into test_null values ('', null, ''''' and null');
    select * from test_null;
    FLD1       FLD2       FLD3
                          chr(0) and null
                          null and null
                          '' and chr(0)
                          '' and null
      1  DECLARE
      2  BEGIN
      3   for c1 in (select fld1, fld2, fld3 from test_null) loop
      4      if c1.fld1 = c1.fld2 then
      5         dbms_output.put_line(c1.fld3||' Are equal'||
      6                '  Length fld1 = '||to_char(length(c1.fld1))||
      7                ' Length fld2 = '||to_char(length(c1.fld2)));
      8      else
      9         dbms_output.put_line(c1.fld3||' Are NOT equal'||
    10                '  Length fld1 = '||to_char(length(c1.fld1))||
    11                ' Length fld2 = '||to_char(length(c1.fld2)));
    12      end if;
    13      dbms_output.put_line(' ');
    14   end loop;
    15*  END;
    SQL> /
    chr(0) and null Are NOT equal  Length fld1 = 1 Length fld2 =
    null and null Are NOT equal  Length fld1 =  Length fld2 =
    '' and chr(0) Are NOT equal  Length fld1 =  Length fld2 = 1
    '' and null Are NOT equal  Length fld1 =  Length fld2 =
    PL/SQL procedure successfully completed.

  • PHP Show if hides update fields, but they get overwritten with an empty string

    I have an issue with a page where some update fields are displayed depending on who is logged, for example:
    <?php if ($row_Users['UserID']=="101"){ ?>
    <input <?php if (!(strcmp($row_lodges['101_finalist'],"Yes"))) {echo "checked=\"checked\"";} ?> type="checkbox" name="101_finalist"  value="Yes"/>
    <input type="text" class="rankfield" name="101_rank" value="<?php echo($row_lodges['101_rank']); ?>" />
    <?php }  ?>
    <?php if ($row_Users['UserID']=="102"){ ?>
    <input <?php if (!(strcmp($row_lodges['102_finalist'],"Yes"))) {echo "checked=\"checked\"";} ?> type="checkbox" name="102_finalist"  value="Yes"/>
    <input type="text" class="rankfield" name="102_rank" value="<?php echo($row_lodges['102_rank']); ?>" />
    <?php }  ?>
    The issue I have is that if User101 is logged in and updates fields 101_finalist and 101_rank, it overwrites 102_finalist and 102_rank with an empty string.
    Is it possible to prevent each user from seeing the other fields for other users, and prevent the existing values for those other users not be overwritten?
    Hope that makes sense!
    Thank you.

    That would mean multiple nominations when really there only needs to be one nomination per category in any given country.
    It would be:
    1, 345, 101, Borana Lodge, 7, 2, Yes, 1
    1, 345, 102, Borana Lodge, 7, 2, Yes, 3
    1, 345, 103, Borana Lodge, 7, 2, No, NULL
    Instead of:
    1, 345, Borana Lodge, 7, 2, Yes, 1, Yes, 3, No, NULL
    Sorry, Lodge isn't in the nominations table, the list above is what is displayed on the site. Lodge gets looked up in the Ldoges table.
    At the moment it works like this:
    People can visit a website and vote for lodges in different categories, giving them a score out of 10 for each.
    If a lodge gets a vote in a particular category an admin person creates a nomination for that lodge, in that category.
    And the last bit is where judges login and tag the ones they think should be finalists.

  • POSTING TO JSP FORMS GIVES NULL OBJECT RATHER THAN EMPTY STRING

    This post is for Dan Norris of DOE. He brought this up in a submitted tar, but it is addressed by the PDK community here.
    We arehaving problems using the standard HTTPServletRequest getParameter
    methodinside of the portal.
    The standard for this method is as follows:
    *If you usethis method to read from a text field without any text in it, you
    get an empty string. ( "" )
    *If you use it to read from a text field with text in it youwould get the
    corresponding text.
    *If you try to read from a field that doesn'texist then and only then would
    you get a Null object.
    On our portal server itis behaving differently inside of portlets.
    * If you use this method to readfrom a text field without any text in it, you
    get a Null Object
    * If you use itto read from a text field with text in it you would get the
    correspondingtext.
    * If you try to read from a field that doesn't exist you also would youget a
    Null object.
    Also, on the same server If you access a simple JSP directlywithout the it
    being a portlet, it behaves as defined by standard Javadocumentation.
    Test case:
    Create test.jsp with these contents:
    ========start test.jsp
    <%@pageimport = "oracle.portal.provider.v1.*,
    oracle.portal.provider.v1.http.*"%>
    Form to test submission of empty form field.<br>
    Text Field Value ="<%=request.getParameter("testField")%>"
    <form name="test" action="<%=
    HttpPortletRendererUtil.htmlFormActionLink(request,PortletRendererUtil.PAGE_LINK
    ) %>">
    <%=
    HttpPortletRendererUtil.htmlFormHiddenFields(request,PortletRendererUtil.PAGE_LI
    NK) %>
    <INPUT type="text" name="testField">
    <INPUT type="Submit"name="Submit">
    </form>
    ========end test.jsp
    =================startprovider.xml
    <provider class="oracle.portal.provider.v1.http.DefaultProvider"
    session="true">
    <portlet class="oracle.portal.provider.v1.http.DefaultPortlet" version="1" >
    <id>1</id>
    <name>TestPortlet</name>
    <title>Test</title>
    <description>Test</description>
    <timeout>100</timeout>
    <timeoutMsg>Test Portlet timed out.</timeoutMsg>
    <showEdit>false</showEdit>
    <showEditDefault>false</showEditDefault>
    <showPreview>false</showPreview>
    <showDetails>false</showDetails>
    <hasHelp>false</hasHelp>
    <hasAbout>false</hasAbout>
    <acceptContentTypes>
    <item>text/html</item>
    </acceptContentTypes>
    <portletRenderer class="oracle.portal.provider.v1.http.PageRenderer" >
    <appPath>/</appPath>
    <appRoot>/u01/app/oracle/product/ias1021/Apache/Apache/htdocs</appRoot>
    <renderContainer>false</renderContainer>
    <showPage>test.jsp</showPage>
    <pageParameterName>next_page</pageParameterName >
    </portletRenderer>
    </portlet>
    </provider>
    =================end provider.xml
    After you have theprovider added to the portal, login to the portal as
    portal30 and go toAdminister Tab->Display Portlet Repository and display the
    portlet.
    1.Enter "test" in the text field and submit.
    2. Returns Text Field Value ="test"
    3. Submit form leaving the text field empty.
    4. Returns Text FieldValue = "null"
    Submitting the form with the text field empty should returnvalue of "", and
    not "null".

    fyi in case anyone else ever wants to know:
    I found it... the details I was looking for were in the OC4J 9.0.2 Release Notes:
    Display of null values in JSP.
    In Oracle9iAS, a null value printed from a JSP page displays, by default, as
    the string "null." To display nothing instead, set the attribute jsp-print-null
    to false in the <web-app> element of
    global-web-app.xml or orion-web.xml.

Maybe you are looking for