Databases

54K

Solutions

74

Articles & Videos

38K

Contributors

Databases are organized collections of data, most commonly accessed through management systems including schemas, tables, queries and processes that allow users to enter and manipulate the information or utilize it in other fashions, such as with web applications or for reporting purposes.

Share tech news, updates, or what's on your mind.

Sign up to Post

I want to store 1 when checkbox is checked and 0 when not checked. But my code is only able to store 1 in my database, even though my function returned both 'true' and 'false' appropriately, my database only shows 1 for both checked and unchecked. Below is my code:

Jquery/Ajax

function checkCheckboxState() {
    if ($('input[id*="mobile"]').prop('checked') == true) {
        // execute AJAX request here
        $.ajax({
            type: 'POST',
            url: 'functions/mobilecheck.php',
            data: { 'checked': true },
        });

    } else {
        $.ajax({
            type: 'POST',
            url: 'functions/mobilecheck.php',
            data: { 'checked': false },
        });
    }
}

Open in new window


PHP
<?php
if(true){
    $sql = "UPDATE useroptions SET mobilecheck='1' WHERE username='$log_username'";
    $query = mysqli_query($db_connect, $sql);
} else {
    $sql = "UPDATE useroptions SET mobilecheck='0' WHERE username='$log_username'";
    $query = mysqli_query($db_connect, $sql);
}

?>

Open in new window

0
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

What is the best way to approach this?

I want to create a database field in phpmyadmin/mysql within a Joomla3.7.2 site for a referral ID from a friend on sign-up. How do I set up the php URL to pass that as a session variable upon going to a special link, and following them through to sign up?
0
I have an Access database that I am writing to.  The table I am trying to write to has two fields, namely, an AutoNumber field and a Number field.  I cannot write to the AutoNumber field.  Another program that writes to this same table is able to write to the AutoNumber field.  How is this possible?  When I browse the table in Access and try and change any value in the AutoNumber field the error message is: "Control can't be edited; its bound to outnumber field X".  Data written from another program into this field allows for duplicates which it should.  I find this amazingly weird - that the the field is an AutoNumber field and can be written to by a program assigning duplicates into the field which is exactly what is required.

Any ideas?
0
Hello everyone, pleas help me in setting up quick books server and database. What are the requirements? Currently its installed on one of standard workstation. I recently join this company and admin i IT. Please help and advise me. I have to transfer all this data to server. Please give me all requirements list so that can setup quick books database efficiently. Thanks.
0
I have my cpanel account (hostgator) my user and password

I have a domian
host2048.com

I hava a database robrodp_respuestas
it has a privileged user  robrodp_roberto
user has a password *****
<?php
$servername = "localhost";
$username = "robrodp_roberto";
$password = "*********";
$dbname = "robrodp_respuestas";

I use the following code:

[code]
<?php
$servername = "localhost";
$username = "robrodp_roberto";
$password = "*********";
$dbname = "robrodp_respuestas";

// Create connection
$conn = mysql($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>

Open in new window


When I run it I get this error:

Warning: mysql() expects parameter 3 to be resource, string given in /home2/robrodp/public_html/host2048.com/phpmailer/database.php on line 8
Connected successfully

What am I doing worng?
0
Dear Experts,
I am creating an online database portal that requires a user login.  Once logged in, the user has access to various pages, one of them will jump to a payment center of a bank.  (In my case, Union Bank, https://www.hoabankservices.com/Services.aspx)

Is there anyway that I can inject the userID from before jumping to this payment center, and have it automatically show up in User ID box?
Please advise.  Thank you.
0
Hello,

I have a database (attached) that create worksheets based off the amount of work items in column B of the "summary" datasheet. The macro works great, except for that if the user clicks the button again after running the macro and runs the macro a second time, a new set of worksheets are created with the same name except with the time of the rerun also in the name. I was wondering if it would be possible to make it so that when the button is clicked a second time and the user chooses to create worksheets again that the worksheets are just updated? For example if a new row was added after creating worksheets and the macro was run again then just that new row would show up and all the other worksheets would just stay the same. Please let me know if I need to explain myself more clearly!

Thanks!

here is the code:

Sub CreateWorkItems()
    Dim WS As Worksheet
    Dim WSItem As Worksheet
    Dim WSTemp As Worksheet
    Dim MaxRow As Long, I As Long
    Dim sClientId As String, sJobId As String, sWItem As String

    '---> Disable Events
    With Application
        .EnableEvents = False
        .ScreenUpdating = False
        .DisplayAlerts = False


        '---> Set Variables
        Set WS = ActiveSheet
        MaxRow = WS.Range("A" & WS.Rows.Count).End(xlUp).Row
        Set WSTemp = Sheets("template")
        sClientId = WS.Range("B1")
        sJobId = WS.Range("B2")

        If MaxRow >= 9 Then
            For I = 9 To MaxRow
        …
0
Hello!

I have a database (attached) and I want to be able to export the first two sheets to a PDF. However, the code I have now (below) which runs after clicking the Print Bid button, only converts part of the first worksheet. When the user is using this database there could potentially be many more work items and therefore I need the code to convert everything in all the columns to a PDF, except column C. That is the next problem, the Jump To column, column C, in the first worksheet should not be visible in the PDF but right now, despite the code, it is. If anyone has any suggestions on how to change these two things that would be wonderful! Thank you!

Sub PrintToPDF()
    Dim oWs As Worksheet
    Sheets("summary").Columns("C:C").EntireColumn.Hidden = True
    Set oWs = Sheets("summary")
    With oWs.PageSetup
        .FitToPagesWide = 1    ''/// prints to one page
    End With

    oWs.Columns("C:C").EntireColumn.Hidden = False

    With Sheets("service rates").PageSetup
        .FitToPagesWide = 1    ''/// prints to one page
    End With
    ''///Save the Array of worksheets (which will be selected) as a PDF
    ThisWorkbook.Sheets(Array("summary", "service rates")).Select
    On Error Resume Next
    oWs.ExportAsFixedFormat _
            Type:=xlTypePDF, _
            Filename:="Test.pdf", _
            Quality:=xlQualityStandard, _
            IncludeDocProperties:=True, _
            IgnorePrintAreas:=False, _
            …
0
Hello Experts.

I've made some good progress with learning how to interact with an Access database through VB.NET. The attached project includes some useful techniques for populating ComboBoxes with multiple columns using LINQ queries, and leverages Access' ability to generate Queries (which VS calls 'Views') for the purpose of connecting two related tables for populating the ComboBox list items, and any data bound form objects and DataGridViews.

This project uses two tables; one for a list of Players (which I call 'Roster') and one for a list of Teams. The Roster table has a Teams Key that joins to the Teams table which includes the Team Name attribute. I also decided that I wanted to include a picture of every player so Team Captains would have an easier time identifying who's who ("which of you guys is John Doe?"). So it was easy enough to add a new column to the Roster table in Access of type OLE/Object. I then added the code so the image file could be retrieved and attached to the bound PictureBox. That all works good, but since the PictureBox is only a tiny 120x90, I want to be sure the image file is sized correctly so it doesn't bloat the Access table too much.

To that end, I found a nice solution but it was in C#, so I'm not sure if I was able to convert it properly to Visual Basic. But the real head scratcher for me is understanding the concept of an IO.Stream which is how this image resizing solution is rigged. That leads to my real question -- how do I
0
I have Microsoft SQL Server 2012 installed in a production environment.
The TempDB has grown to tak up the size of the C Drive (20GB in growth).
How can I shrink the TempDB in the production environment without impacting live users?
0
Visualize your virtual and backup environments
LVL 1
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Hello Experts,

Just need confirmation. If I create a database application in MS Access 2010  can I open later in MS Access 2013 with all functionalities? Our organization is moving over to Office 2013 in a few months and I just want to make certain that all the applications that I've created in MS Access 2010 will still work in Access 2013.

Thanks!
0
Hi,

I've just been told I'm now in charge of and managing two SQL databases and have never used SQL before.

One of them we can remove as it is a backup and is no longer required. How do I safely back this up and then delete it so we can, if required, restore it?

Also: The db has a total size of 6,927Mb. 6021Mb of which is transaction log space. How do I go about reducing this log space? We are nowhere near using up the space allocated to logs but we are short on disk space on the server.

I've tried backing it up by doing a full backup and also a transaction log backup but no reduction in transaction log space.

So I'm looking for 3 things:

1) Reducing transaction log space
2) How to create a full backup that we can restore from
3) How to take the db offline and then delete it from Studio (assume Tasks > Offline, then delete)

Thanks and apologies for the noob questions but this has literally landed on my desk.
0
Dear experts,
I am facing a request from a customer, who maintains about 500 product sheets to different products. So far all the data were kept in Word and PDF files were made manually. Th maintenance was a nightmare and publishing online was nearly impossible.

Now the product sheets will be saved in a database / XML so that with help of some CSS libraries/frameworks (bootstrap etc.) site nice layout can be achieved while keeping the simplicity of editing content in a database and displaying the sheets online. For better reading and design reasons the sheets will contain TWO columns on normal screen and paper and 1 column only on mobile devices. This all is doable. Somehow.

However the next requirement is to be able to generate PDFs out of the same source (database/xml) and the PDF shall, of course, keep the layout for DIN A4 paper - header, footer, two columns, which flow always on first page from left column to right column and then on next pages again from left to right column. Like when you load a text in indesign for example. So that the PDFs when printed can be red.

Unfortunately the HTML page does not respect the fixed length of a DIN A4 paper and when showing two columns, they flow till the bottom of the page "infinitely".  When I tried to play with bootstrap for example, I was able to accomplish the HTML part, but then I was unable to either print it to PDF or even while using some PDF library to generate A4 standalone pages.

I hope I am expressing …
0
Hello,

I have a macro that allows for new sheets to be created based off the amount of rows in the "Work Item" column in the posted excel database. Right now the "work item" updates into the worksheets created from the "template" spreadsheet, but the "description of work item" does not update into the "description job"  column in the templates, and I would like it to. Could someone please help me with this? Thanks!
0
set serveroutput on;
       --DECLARE err_status NUMERIC;
       DECLARE v_REFERENCE_CODE varchar2(30);
       DECLARE v_status_lkp varchar2(30);
       DECLARE v_OBSOLETE_FLAG varchar2(30);
       DECLARE cursor cur_invalid_objects is
               select a.REFERENCE_CODE,a.status_lkp,a.OBSOLETE_FLAG from BASE_SALES_ORDER a,BASE_SALES_ORDER_LINE b where
                    a.SALES_ORDER_ID =b.SALES_ORDER_ID
                    and a.REFERENCE_CODE ='10132834';
        --rec_columns cur_invalid_objects%ROWTYPE;

BEGIN
        dbms_output.enable(10000);
        open cur_invalid_objects;
        loop
                fetch cur_invalid_objects into v_REFERENCE_CODE,v_status_lkp,v_OBSOLETE_FLAG;
                EXIT WHEN cur_invalid_objects%NOTFOUND;
                dbms_output.put_line('ROWTYPE ' || v_REFERENCE_CODE || '  ' || 'SalesOrder Status' || v_status_lkp || '  ' || ' SalesOrder Flag status' || v_OBSOLETE_FLAG);
               -- v_statement := 'alter index '|| rec_columns.index_name ||' rebuild partition '|| rec_columns.partition_name ||' online;' ;
                                                                execute immediate 'v_statement';
        end loop;
        close cur_invalid_objects;
               
end;
/



I am getting error like below.Can some one rectify it asap.

Error report -
ORA-06550: line 2, column 8:
PLS-00103: Encountered the symbol "DECLARE" when expecting one of the following:

   begin function package pragma…
0
I have a PosgreSQL database where I have an array field with 4 values.  This query will extract one value at the time
select public.addresses.address[1] from public.addresses

Open in new window


I'm linking the table to an Access database and the array I have above does not work there. How can I do this in Access?

Here is are my results from PostgreSQL and this is what I want to do in Access
Image-39.jpg
Image-38.jpg
0
how do i get the form fill send  to an email

i got it stored in the database, but i want those send request to email me


sql="INSERT INTO comentarios (nombre, email, producto, comentario)"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("fname") & "',"
sql=sql & "'" & Request.Form("email") & "',"
sql=sql & "'" & Request.Form("consultorio") & "',"
sql=sql & "'" & Request.Form("message") & "')"

on error resume next
conn.Execute sql,recaffected
if err<>0 then
  Response.Write("No update permissions!")
else
  Response.Write("<h3>" & recaffected & " Nos pondremos en contacto con usted cuanto antes</h3>")
end if
conn.close

thats to the database, how to email me that info
regards
0
I need to get the count of error messages from a SQL database table over the past 24 hours.

Example:

Time:              Count:
1:00 AM         5 errors
2:00 AM         1 error
3:00 AM         10 errors
4:00 AM         5 errors
.......

12:00 PM       0 errors
.........

10:00 PM       6 errors

and so on. Below is my attempt but it is not correct.
select COUNT (messageType) as [Count], Datestamp
from Table1
where Datestamp between dateadd(hour, -24, CURRENT_TIMESTAMP)
AND CURRENT_TIMESTAMP
GROUP BY CAST(Datestamp as DATE) ,CASE
      WHEN DATEPART(HOUR, Datestamp) > 12 THEN DATEPART(hour, Datestamp) - 12
      ELSE DATEPART(Hour, Datestamp)
END , dateadd(hour, datediff(hour, 0, Datestamp), 0), Datestamp
ORDER BY dateadd(hour, datediff(hour, 0, Datestamp), 0) ASC;
0
I have a spreadsheet (Office 2013) in which I have data down 2 columns. The issue is that the data needs to be split into more a database structure of columns with corresponding data under each column. I have included a copy of the type and format of the data. The sections are separated by one blank row too.

Name      Microsoft.VCLibs.140.00
Publisher      CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      X64
ResourceId      
Version      14.0.22929.0
PackageFullName      Microsoft.VCLibs.140.00_14.0.22929.0_x64__8wekyb3d8bbwe
InstallLocation      C:\Program Files\WindowsApps\Microsoft.VCLibs.140.00_14.0.22929.0_x64__8wekyb3d8bbwe
IsFramework      TRUE
PackageFamilyName      Microsoft.VCLibs.140.00_8wekyb3d8bbwe
PublisherId      8wekyb3d8bbwe
IsResourcePackage      FALSE
IsBundle      FALSE
IsDevelopmentMode      FALSE
============Blank Row============================================      
Name      Microsoft.VCLibs.140.00
Publisher      CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      X86
TestDoc.xlsx
0
Free Tool: Port Scanner
LVL 8
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I'm still learning Access, but I have a database where I need records from 3 tables to append into 1 table.  I can do that for 2 of the tables, but I continue to fail with the 3rd table.  This table may have many records, but I need the field values from only the most recent record to be appended into 1 table that will have several records with matching fields with no value.  For example,
Table 1 will have StudyID(PK), Site, StudyDate, ProjectManager, Company, Fee1, Fee2, Notes, DateModified,  I need those values to be appended into another table for all the records that currently have no values in the matching fields.  This new table will have its own PK.  Table 1 data is input via a Form where the user has comboxes for choosing or entering values for Site, StudyDate, Company, Project Manager and the remainder fields are text boxes.  It's confusing, so I'll try to write out an example here....
Table 1: Several records for fields A, B, C, D
Table 2: Several records for fields A, B, C, D, E, F
Table 3: Several records for fields G, H, I, J
Final Table being appended into contains all records for Table 1 & 2 for fields A-F.  Also includes Fields G-J which are null across all records.  The newest record in Table 3 is appended into the matching fields everywhere it is null in the current recordset of the Final Table.
I hope that makes some sense.  I may be going about this in some un-normalized fashion, so please let me know if that's the case and there's a much better way …
0
Hello,

I am trying to write a backup script for my database, it is working pretty good, makes a .sql copy and saves to the server. I would like to save it as a zip archive instead. This is my code to save as .sql (I took out all my zip experiments)

        $now = date("Y-M-d-H");
	$handle = fopen('db-backup-'.$now.'.sql','w+');
	fwrite($handle,$return);
	fclose($handle);

Open in new window

0
After this code runs and adds a record to the recordset, I am unable to add any more entries into the record. I believe the record is getting locked by the database since it detected changes, but I'm not sure how to remove that through access. I have verified this code works properly besides the unintended side effect of being unable to repeatedly do it. Does anyone know how to unlock the record so everyone can access it after this runs?

    Set ClientRS = CurrentDb.OpenRecordset("Client Contacts", dbOpenDynaset, dbSeeChanges)
   
    With ClientRS
        .AddNew
        ![id] = ClientID
        ![Full Name] = FullName
        ![Phone Number] = PhoneNumber.Value
        ![Company] = "Other"
        .Update
        .Close
    End With

    Set ClientRS = Nothing
   
    DoCmd.Close acForm, "Add Phone Record", acSavePrompt
End Sub
0
Our active server database failed over to the passive server for some reason.
I had to delete the dbs from what was the active server which is now the passive server, because of a dbs issue of a failed index,  but now I cant get the dbs to copy back over from the active server back to the passive server so that I can have the 2 servers back in the DAG.
Each time I try, the dbs on what is now the active server, dismount and the copy does not make it to the other server..
Is there something I should be doing here that I am missing?
Thanks
0
Hi there, i have two data tables 1 that queries the informix database and 2nd one consist of daily customer file. so my task was to take the daily generated customer file compare it to the 1st datatable and if there are not matches consider it to be a new customer and then if there is a match i need to check to see if the other fields have been changed and add it to the file as changed customer.
DataTable tblSamebutotherchanges =  (from r in FirstDataTable.AsEnumerable()
                    join s in SecondDataTable.AsEnumerable()
                    on r.Field<string>("Customer") equals s.Field<string>("Customer")
                                     where r.Field<string>("Name") != s.Field<string>("Name") ||r.Field<string>("ADDRESS").ToUpper() != s.Field<string>("ADDRESS").ToUpper() || r.Field<string>("ADDRESS 2") != s.Field<string>("ADDRESS 2") || r.Field<string>("CITY").ToUpper() != s.Field<string>("CITY").ToUpper() || r.Field<string>("STATE") != s.Field<string>("STATE") || r.Field<string>("ZIP CODE").Substring(0,5) != s.Field<string>("ZIP CODE").Substring(0,5) || r.Field<string>("PARENT") != s.Field<string>("PARENT") || r.Field<string>("TELEPHONE") != s.Field<string>("TELEPHONE") || r.Field<string>("FAX") != s.Field<string>("FAX") || r.Field<string>("TERMS OF PAYMENT") != s.Field<string>("TERMS OF PAYMENT") || r.Field<string>("COUNTRY") != s.Field<string>("COUNTRY") || r.Field<string>("CURRENCY") != s.Field<string>("CURRENCY") || r.Field<string>("STATUS") != 

Open in new window

0
I am trying to connect to MongoDB in mongoDBatlas from my javascript but I keep getting the following error.

MongoError: connection 5 to isaaccluster-shard-00-02-yng8g.mongodb.net:27017 closed
    at Function.MongoError.create (C:\Users\558642\ga\js-dc-5\11-crud-and-dbs\assignment\todo\node_modules\mongodb-core\lib\error.js:29:11)
    at TLSSocket.<anonymous> (C:\Users\558642\ga\js-dc-5\11-crud-and-dbs\assignment\todo\node_modules\mongodb-core\lib\connection\connection.js:202:22)
    at Object.onceWrapper (events.js:293:19)
    at emitOne (events.js:101:20)
    at TLSSocket.emit (events.js:191:7)
    at _handle.close (net.js:511:12)
    at Socket.done (_tls_wrap.js:332:7)
    at Object.onceWrapper (events.js:293:19)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at TCP._handle.close [as _onclose] (net.js:511:12)


Here's my code
const express = require('express')
const hbs = require('express-handlebars')
const mongoose = require('mongoose')
const bodyParser = require('body-parser')

mongoose.connect('mongodb://XXXXXXXXXXXX@isaaccluster-shard-00-00-yng8g.mongodb.net:27017,isaaccluster-shard-00-01-yng8g.mongodb.net:27017,isaaccluster-shard-00-02-yng8g.mongodb.net:27017/<DATABASE>?ssl=true&replicaSet=IsaacCluster-shard-0&authSource=admin')

const itemEntry = require('./models/toDoEntry.js')
const app = express()

app.get('/', function( req, res ) {
	itemEntry.find({}, function( err, itemEntries ) {
			res.render('todoList',

Open in new window

0

Databases

54K

Solutions

74

Articles & Videos

38K

Contributors

Databases are organized collections of data, most commonly accessed through management systems including schemas, tables, queries and processes that allow users to enter and manipulate the information or utilize it in other fashions, such as with web applications or for reporting purposes.