Latest Databases Posts

hey, i am trying to insert multiple checkbox data in my database but having a littlt bit problem. When i am trying to insert checkbox data it inserts only id and nothing else.
Here is my full code:-

<?php 
include("config.php");

if(isset($_POST['save'])){

  $contact_sms = $_POST['contact_sms'];  
  $check[] = $_POST['check'];
  $firm_name = $_POST['firm_name'];
  var_dump($firm_name);
  $checkbox = $_POST['check'];

  for($i=0;$i<count($checkbox);$i++){
    $bulksms="INSERT INTO bulk_sms (sent_sms,firmname_sms,contact_sms) VALUES('".$checkbox[$i]. "','".$row['firm_name']. "','$contact_sms')";
    $smsquery=mysqli_query($conn, $bulksms);
  }
}

$sql="SELECT * FROM inventory_details where status ='0' AND role='0' ORDER BY position ASC, role ASC, visiter DESC limit 0,100";  
$query=mysqli_query($conn, $sql);

?>

    <form method="post" action="" id="msform">   
      <?php
        $i=0;
        while($row=mysqli_fetch_assoc($query)){
        $id = $row['id'];
        $firm_name = $row['firm_name'];
      ?>  

        <div class="col-md-4">
          <input type="text" class="form-control" name="id_sms" value="<?php echo $id;?>">
        </div>
        <div class="col-md-6">
          <input type="text" class="form-control" name="firm_name[]" value="<?php echo $firm_name;?>">
        </div>
        <div class="col-md-2">
          <input type="checkbox" id="checkItem" name="check[]" value="<?php echo "$id"; ?>">
        </div>

      <?php
        $i++;
        }
      ?>

      <input type="text" class="form-control" name="contact_sms" placeholder="Contact Number.."> 
      <button type="submit" class="btn btn-success" name="save">Send</button>

</form>

when i click on Send button , it only stores `id`inside the field `sent_sms` and nothing in field `firm_name`. Please help me out. I am poorly trapped in it.

That's an overly broad question. But if it was true, tell me without spamming what courses you completed on this product.

It's strange to be thrown into SAP without training so let's here more about what happened to land you this job.

I am facing issues using logical operators to perform operations in SAP HANA. Can anyone help me?

FOREING spelling?

CREATE TABLE DomeniuAB(ID_DOMAB NUMBER(10), constraint ID_DOMAB_PK PRIMARY KEY ,
DENUMIRE VARCHAR2(20) NOT NULL,
DETALII VARCHAR2(20) NOT NULL,
ISBNAB_CarteAB VARCHAR2(15), CONSTRAINT ISBNAB_FK FOREIGN KEY (ISBNAB_CarteAB) REFERENCES CarteAB(ISBNAB),
CNPAB_AutorAB NUMBER(10), CONSTRAINT CNPAB_FK FOREING KEY (CNPAB_AutorAB) REFERENCES AutorAB(CNPAB));
Now i have this error ORA-00906: missing left parenthesis, i really don't understand what's wrong :))

Are you missing a comma after ID_DOMAB NUMBER(10) ?

Please, why I got this error(SQL Error: ORA-00907: missing right parenthesis ) whats wrong in my code?

CREATE TABLE DomeniuAB(ID_DOMAB NUMBER(10) constraint ID_DOMAB_PK PRIMARY KEY ,
DENUMIRE VARCHAR2(20) NOT NULL,
DETALII VARCHAR2(20) NOT NULL,
ISBNAB_CarteAB VARCHAR2(15), CONSTRAINT ISBNAB_FK FOREIGN KEY (ISBNAB_CarteAB) REFERENCES CarteAB(ISBNAB),
CNPAB_AutorAB NUMBER(10), CONSTRAINT CNPAB_FK FOREING KEY (CNPAB_AutorAB) REFERENCES AutorAB(CNPAB));

from my opinion: when you have tried to add parameters with command object by using parameters.Add() method you must have to convert the type of the value which you want to save in respect of the parameter type you declared in your code. Exception could be raised from your code lines 18 & 29: Text Type never be stored in int type.

You can use the method Parameter.AddWithValue(), in this method you have no need to declare the parameter type but you must convert the value in respect of field type of your database .

You are asked when you start a thread as to where you want to post it. Just pick programming from the drop down.

I'm not sure why but I'm not getting an error message. But I've looked and what I've attempted to write isn't there. I'll go back and step through it to see if I can find something and report back if needed.

My appologies for using the community forum. However the site has changed since the last time I used it (a couple of years ago) and I'm not sure how to direct inquiries to my fellow members here.

It's been a few years since I've done database stuff but I suggest that instead of just displaying a generic error message like "New Record FAILED. Please contact your systems administrator." you display the actual error message returned in the exception. It should be one of the properties of the variable ex. It will likely give you more details.

And, if I may, I'd like to say again that these kind of questions do not belong in the community forum so I moved it to a more appropriate location.

Hi group,

I'm trying to store the information from a various textboxes into my database. However it is not writing the data (I'm getting my planned error message, "New Record FAILED. Please contact your systems administrator." From the code below, do you see where my error may be? What corrections do I need to make to ensure a successful insert?

Dim con As New SqlClient.SqlConnection
        con.ConnectionString = ("Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Don\Documents\Visual Studio 2019\SalesForm\DWHRPT.mdf;Integrated Security=True")
        con.Open()
        Dim com As New SqlClient.SqlCommand("", con)
        com.CommandText = "INSERT INTO CUSTREC (CUST_ACCT_NO, CUST_COMPANY_NAME, CUST_LOCATION, CUST_TYPE, CUST_FIRST_NAME, CUST_MIDDLE_INITIAL, 
                                                  CUST_LAST_NAME, CUST_MAIL_ADDRESS1, CUST_MAIL_ADDRESS2, CUST_MAIL_CITY, CUST_MAIL_STATE, 
                                                  CUST_MAIL_ZIP_CODE, CUST_MAIL_ZIP_PLUS4, CUST_CREDIT_LIMIT, CUST_PRIMARY_PHONE, CUST_ALT_PHONE, 
                                                  CUST_TAX_EXEMPT_STATUS, CUST_TAX_EXEMPT_ID, CUST_SHIP_TO_ADDRESS1, CUST_SHIP_TO_ADDRESS2, 
                                                  CUST_SHIP_TO_CITY, CUST_SHIP_TO_STATE, CUST_SHIP_TO_ZIP_CODE, CUST_SHIP_TO_ZIP_PLUS4, CUST_USE_SELL_PRICE,
                                                  CUST_STD_DISC_PCNT, CUST_SHIP_TO_CONTACT_NAME, CUST_SHIP_TO_PHONE_NO, CUST_START_DATE) 
                            VALUES (@AcctNo, @CompName, @Loc, @Type, @FirstName, @MidInt, @LastName, @MailAddr1, @MailAddr2, @MailCity, @MailState, 
                                    @MailZip, @MailZipPlus4, @CreditLimit, @PrimaryPhone, @AltPhone, @TaxStatus, @TaxID, @ShipAddr1, @ShipAddr2,
                                    @ShipCity, @ShipState, @ShipZipCode, @ShipZipPlus4, @SellPrice, @Disc, @ShipContactName, @ShipToPhone, @StartDate)"

        Try
            com.Parameters.Add("@AcctNo", SqlDbType.BigInt).Value = tbxAccountNo.Text
            com.Parameters.Add("@CompName", SqlDbType.VarChar).Value = tbxCompanyName.Text
            com.Parameters.Add("@Loc", SqlDbType.Int).Value = tbxLoc.Text
            com.Parameters.Add("@Type", SqlDbType.VarChar).Value = tbxCustType.Text
            com.Parameters.Add("@FirstName", SqlDbType.VarChar).Value = tbxFirstName.Text
            com.Parameters.Add("@MidInt", SqlDbType.VarChar).Value = tbxMiddleInt.Text
            com.Parameters.Add("@LastName", SqlDbType.VarChar).Value = tbxLastName.Text
            com.Parameters.Add("@MailAddr1", SqlDbType.VarChar).Value = tbxAddress1.Text
            com.Parameters.Add("@MailAddr2", SqlDbType.VarChar).Value = tbxAddress2.Text
            com.Parameters.Add("@MailCity", SqlDbType.VarChar).Value = tbxCity.Text
            com.Parameters.Add("@MailState", SqlDbType.VarChar).Value = tbxState.Text
            com.Parameters.Add("@MailZip", SqlDbType.VarChar).Value = zipCode
            com.Parameters.Add("@MailZipPlus4", SqlDbType.VarChar).Value = zipPlus4
            com.Parameters.Add("@CreditLimit", SqlDbType.Int).Value = tbxCreditLimit.Text
            com.Parameters.Add("@PrimaryPhone", SqlDbType.BigInt).Value = primephone
            com.Parameters.Add("@AltPhone", SqlDbType.BigInt).Value = altphone
            com.Parameters.Add("@TaxStatus", SqlDbType.VarChar).Value = tbxTaxExempt.Text
            com.Parameters.Add("@TaxID", SqlDbType.VarChar).Value = tbxTaxExemptID.Text
            com.Parameters.Add("@ShipAddr1", SqlDbType.VarChar).Value = tbxShipAddress1.Text
            com.Parameters.Add("@ShipAddr2", SqlDbType.VarChar).Value = tbxShipAddress2.Text
            com.Parameters.Add("@ShipCity", SqlDbType.VarChar).Value = tbxShipCity.Text
            com.Parameters.Add("@ShipState", SqlDbType.VarChar).Value = tbxShipState.Text
            com.Parameters.Add("@ShipZipCode", SqlDbType.VarChar).Value = ShipZipCode
            com.Parameters.Add("@ShipZipPlus4", SqlDbType.VarChar).Value = ShipZipPlus4
            com.Parameters.Add("@SellPrice", SqlDbType.Int).Value = Convert.ToInt32(tbxUseSellPriceNo.Text)
            com.Parameters.Add("@Disc", SqlDbType.Int).Value = Convert.ToInt32(tbxStdDiscPcnt.Text)
            com.Parameters.Add("@ShipContactName", SqlDbType.VarChar).Value ...

Try this one it works!

UPDATE dembel
SET userid=8909
WHERE Name='o''reily'

Use backticks instead of apostrophes

`attendence` AS 'type'
,`in_address` AS 'address_in'
,`out_address` AS 'address_out'

[MYSQL] my query is:-

SELECT * FROM (SELECT 'attendence' AS 'type',userAS 'username', STR_TO_DATE(in_time, '%d-%m-%Y %H:%i:%s') AS 'time_in', 'in_address' AS 'address_in', STR_TO_DATE(out_time, '%d-%m-%Y %H:%i:%s') AS 'time_out', 'out_address' AS 'address_out' FROM attendence UNION ALL SELECT 'visit', username, STR_TO_DATE(visit_time_in, '%d-%m-%Y %H:%i:%s'), location_in, STR_TO_DATE(visit_time_out, '%d-%m-%Y %H:%i:%s'), location_out FROM visits) t WHERE t.username = 'MCCuser0036' AND time_in BETWEEN STR_TO_DATE('01-01-2019', '%d-%m-%Y %H:%i:%s') AND STR_TO_DATE('27-04-2019', '%d-%m-%Y %H:%i:%s') ORDER BY time_in ASC;

and result is:-

+------------+-------------+---------------------+----------------------------------------------------------------------------------------------------------------------+---------------------+-----------------------------------------------------------------------------------------------------+
| type       | username    | time_in             | address_in                                                                                                           | time_out            | address_out                                                                                         |
+------------+-------------+---------------------+----------------------------------------------------------------------------------------------------------------------+---------------------+-----------------------------------------------------------------------------------------------------+
| attendence | MCCuser0036 | 2019-01-25 11:02:09 | in_address                                                                                                           | 2019-01-25 11:02:10 | out_address                                                                                         |
| visit      | MCCuser0036 | 2019-02-13 11:46:55 | Sewri - Chembur Rd, Trombay Indusrial Area, Antop Hill, Mumbai, Maharashtra 400037, India                            | 2019-02-13 11:47:00 | Sewri - Chembur Rd, Trombay Indusrial Area, Antop Hill, Mumbai, Maharashtra 400037, India           |
| visit      | MCCuser0036 | 2019-02-14 11:47:04 | Sewri - Chembur Rd, Trombay Indusrial Area, Antop Hill, Mumbai, Maharashtra 400037, India                            | 2019-02-14 11:47:10 | Sewri - Chembur Rd, Trombay Indusrial Area, Antop Hill, Mumbai, Maharashtra 400037, India           |
| visit      | MCCuser0036 | 2019-02-14 11:51:07 | Kokri Agar Road, Koliwada, Kokri Agar, Sion, Mumbai, Maharashtra 400037, India                                       | 2019-02-14 11:51:10 | Kokri Agar Road, Koliwada, Kokri Agar, Sion, Mumbai, Maharashtra 400037, India                      |
| visit      | MCCuser0036 | 2019-02-14 11:51:30 | Kokri Agar Road, Koliwada, Kokri Agar, Sion, Mumbai, Maharashtra 400037, India                                       | 2019-02-14 11:51:34 | Kokri Agar Road, Koliwada, Kokri Agar, Sion, Mumbai, Maharashtra 400037, India                      |
| visit      | MCCuser0036 | ...

Old programming trick. Take the code in some edited and delete all characters but the parens. If it is a parens issue, you'll see it quickly.

Also, in the editor count how many left then right parens there are. Should be equal.

Mohit_18 commented: Tried with that way, parens are equal but same problem +0
I'm writing stored procedure with dynamic sql having dynamic table name as,

CREATE OR replace PROCEDURE Pr_get_result (p_table_name IN VARCHAR2, p_object_Id IN VARCHAR2)

IS
p_prop_code VARCHAR2(50)    := 'pH';

BEGIN
   EXECUTE IMMEDIATE
      'DECLARE '                                             ||
        '    TYPE ObjCurTyp  IS REF CURSOR; '                ||
        '    v_obj_cursor    ObjCurTyp; '                    ||
        '    v_stmt_str    VARCHAR2(32000); '                 ||
        '    v_obj_record   ' || p_table_name || '%rowtype; '||
        'BEGIN '                                             || 
     ' v_stmt_str := ''SELECT * FROM ( SELECT * FROM '|| p_table_name ||' where CREATED_DATE<= ( SELECT CREATED_DATE FROM '|| p_table_name ||' WHERE object_id='|| p_object_Id ||' AND PROPERTY_CODE='|| p_prop_code || ' ) Order By CREATED_DATE DESC ) WHERE ROWNUM <= 5''; ' ||
        '    OPEN v_obj_cursor '                             ||
        '        FOR v_stmt_str ; '                          ||
        '    LOOP '                                          ||
        '        FETCH v_obj_cursor INTO v_obj_record; '     ||
        '           EXIT WHEN v_obj_cursor %NOTFOUND; '      ||
        '    END LOOP; '                                     ||
        'END;';                   

EXCEPTION
WHEN OTHERS THEN 
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;

And getting above problem. Could you please help to resolve this.

I see you've been admonished so let me write about something I see done "after the fact."

In the classroom and even in a business I see DATA SECURITY be ignored until there's a breach or complaint. The most glaring failures I see are the old name and password databases. Then for a store the new to this programmer might store the buyer information in clear text in these databases as well.

It's not like this is new territory but you see this omission again and again which explains partially why data breaches and leaks are so common.

Looks to me like you have put zero effort into doing it yourself. Please read the Daniweb Posting Rules and Suggestions For Posting Questions.

Hi,
I need help to create a relational database for shop.The database should contain a column for barcode in order to register items and also to read details of items using barcode scanner.Besides this database will contain tables for performing all operations for shopping store items what are those operations I don,t know but I need it for shopping store.

Thanks.

Are you reporting this is not in the free training at https://open.sap.com/courses?topic=SAP%20HANA

Which SQL data types can be used in SAP HANA?

Replace CASE block with this!

Update [TableName] 
set c.user_one=case when c.user_two=99  then u.uid else c.user_one end , c.user_two=case when c.user_one=99  then u.uid    else c.user_two end

I have a sp which has multiple resultset.I need to create another procedure which should execute the second resultset of 1st sp

for ex SP1 gives two resultset
I need to write sp2 which uses only the second resulset

I have a sp which has multiple resultset.I need to create another procedure which should execute the second resultset of 1st sp

for ex SP1 gives two resultset
I need to write sp2 which uses only the second resulset

It just got worse. As I wrote at Forbes yesterday, FB has now confirmed (albeit very quietly as an update to a month old post and on the day the Mueller report was published) that millions of Instagram passwords were stored in plain text as well...

rproffitt commented: The number of textbooks or assignments with login code teach them badly. Off to change my Insta+FB passwords. +15

Close this post.

The problem turned out to be that the database wasn't setup correctly. I've since fixed that and have had no problem connecting.

Last month, Facebook admitted to storing million of Facebook passwords in plaintext.
The Verge Apr 18, 2019

We see students being taught login systems here and a recurring mistake is passwords being stored in databases. It appears that CompSci courses teach bad practices early and as we know it's hard to unlearn what you learn earlier.

Further reading seems to indicate these passwords may have collected via logging.
"But as Krebs on Security first reported, various errors seem to have caused Facebook’s systems to log some passwords in plain text since as early as 2012."

I'm been chided for pointing this out from time to time but the mistake happens over and over and in very big companies.

can we able to count how many number of resultset is returned by a stored procedure?

i have a sp which will result in multipe resultset. more then 6.sometime 4 sometime 6 based on the parameters.

so i need to count how many resultsets are returned by the sp