Jump to content

mandrews81

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mandrews81's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Make sure your column length is long enough to hold the number of characters generated by $code and you may try assigning code to include the single quote like: [code] $code = "'" . generate_str(12) ."'"; [/code] Regards, Max
  2. The 'Y' is inserted in the 'CONNECTED' column when the user logins in via a login function that issues an update to the table after authentication and the session has been started using the following statement.  This part works as expected and I can query the table using SQL Plus after login and log off and the table is updated correctly. [code] $sql = "update CONTACTS set CONNECTED = 'Y' where CONTACT_ID = "; $sql .= "'" . $_SESSION["user"]->contact_id . "'"; [/code]
  3. Query returns my first name and last name.  I'm the only users right now. [code] SQL> select FIRST_NAME, LAST_NAME from CONTACTS where CONNECTED = 'Y'; FIRST_NAME                    LAST_NAME ------------------------------ ------------------------------ B. Max                        Andrews [/code]
  4. I'm new to all this so excuse my ignorance.  I want to test a table to see how many rows have a 'Y' in the 'CONNECTED' column of my table.  If the row has a 'Y' then loop through the rows displaying the 'FIRST_NAME' and 'LAST_NAME' columns.  If I just display the rows using: [code]while ($row = oci_fetch_row($stid)) {       echo "<p class=\"yellowSix\">" . $row[0] . " " . $row[1] . "</p>";     } [/code] It works as expected but when I nest this in a test for number of rows it fails or in this case returns the else bracket of "No users online".  The code I'm using looks like: [code]    $sql = "select FIRST_NAME, LAST_NAME from CONTACTS where CONNECTED = 'Y'";   $conn = db_connect();   $stid = oci_parse($conn, $sql);   oci_execute($stid);   $nrow = oci_num_rows($stid);   if ($nrow > 0 ) {       while ($row = oci_fetch_row($stid)) {       echo "<p class=\"yellowSix\">" . $row[0] . " " . $row[1] . "</p>";     }   } else {   echo "No users online";   } [/code] Where did I go wrong?
  5. As I am creating this message I am typing into a '<textarea>' tag that allows me to format the text much like  a normal document editor. I am developing a content management site and need a simple way for non-html programming users to enter formatted text and spell check the text that will be placed into a database column and then pulled from the column and displayed in a page. Anyone doing this and what are you using? Max
  6. When fetching your row try using [i] while ($row = oci_fetch_array ($statement, OCI_ASSOC+OCI_RETURN_NULLS ))[/i] The OCI_RETURN_NULLS will create empty elements for the NULL fields. See http://us2.php.net/manual/en/function.oci-fetch-array.php for more info.
×
×
  • 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.