Search the Community

Showing results for tags 'SQL'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH


  • Community Calendar




Website URL








Found 153 results

  1. Hey guys, I have a problem. I want to write a record in my db when it does not already exists. For this, i have been looking on the web and found multiple solutions on Stackoverflow. The one I use is proved working, by the stack user however I get my die response :(. I use the following query (mysql/php): $query= "IF NOT EXISTS (SELECT * FROM tasksmade WHERE teamnumber='$teamnumber' AND tasknumber='$tasknumber' AND date='$date') INSERT INTO tasksmade (teamnumber, tasknumber, taskfinished, date) VALUES ('$teamnumber', '$tasknumber', '$taskfinished', '$date')"; $result= mysql_query($query,$mysql) or die("The query result has failed on the db!"); Hope someone can help! Thanks!
  2. The root problem is an ASPX (ASP.NET) web page program, part of an important business program presently in development and connected to an sql server database (.mdf) file, is presently unable to do two procedures: rs=Server.CreateObject("ADODB.Recordset") and rs.Open (sql1,conn). Both operations return rs.State = False. The reason is not clearly understood. The system is Windows XP SP3. The only error observed in the MSSQL ERRORLOG is: The SQL Server Network Interface library could not register the Service Principal Name (SPN) for the SQL Server service. Error: 0x54b, state: 3. Failure to register an SPN may cause integrated authentication to fall back to NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies. When researched on Internet this first url was found: Reference(1): Where it says: If you run SQL Server under the LocalSystem account, the SPN is automatically registered as SQL registering with the machine account that has the right to create an SPN default. So Kerberos interacts successfully with the server running SQL Server. The settings currently in use are SQLEXPRESS (2008R2) service, on Manual, with Local System startup account logon. This startup account is believed to have enough permissions to register the SPN, but that may be for an sql expert to decide. The SQL Server is started manually using the System Tray Icon, when needed. So upon further thought, the inadequate permission argument for causing the failed Recordset object creation does not seem to make complete sense. Since the Local System account being used for the sql server startup account should already have enough permission? On the other hand, the SQL ERRORLOG continues to say it could not register the SPN? (So Internet research was continued.) Then on Internet this second url was found: Reference(2): Comment: Ironically (considering the url article title) the decision was to use the ADSI Edit tool to assign greater permissions. Where it says: Instead of setting SPNs manually, you may want to give ReadServicePrincipalName and WriteServicePrincipalName rights to SQL Server service start-up account so that it can register and de-register SQL Server SPNs on its own whenever the SQL Server service is started and stopped. As the above articles describe, these rights can be granted from ADSIEDIT tool. Comment: The intended use of ADSI Edit tool seemed close to succeeding and might have succeeded but all attempts to connect ADSI Edit to the running SQL Server local instance have only been unsuccessful. ADSI Edit seems unable to see the running local sql server. Not enough was known about ADSI Edit to fix that. This is a standalone laptop without a domain and without a LAN. (But again there is the local sql server instance to connect to.) Then two SQL stored procedures sp_ActiveDirectory_SCP and sp_ActiveDirectory_Obj fail while attempting to register the SQL Server instance and the database (.mdf) file into the Active Directory database saying instead the system does not have Active Directory installed (but of course it does, at least partially). Then on Internet this third url was found: Reference(3): Where it says: Adsiedit.msc automatically attempts to load the current domain to which the user is logged on. If the computer is installed in a workgroup or otherwise not logged on to a domain, the message "The specified domain does not exist" displays repeatedly. To resolve this issue, you may want to open an MMC, add the ADSI Edit snap-in, make connections as appropriate, and then save the console file. The ADSI Edit snap-in was succesfully added to MMC. But ADSI Edit still seems unable to make the connection in this situation. And the console file would not save. There are two command line tools (from win supp tools 2003) which can also set these R/W rights. One being setspn.exe and the other dsacls.exe. But they both also seem to read and store the permissions information in the Active Directory database (NTDS.dit) file. So Iwould not expect them to work either for similar reasons. It seems I am trying to get Active Directory working in a windows workgroup consisting of only one machine. Is that, by definition, impossible, since a workgroup needs to have a minimum of two machines? Reference(4): The reference(4) does not change my situation because it still requires an Active Directory database which again requires a domain or workgroup (LAN) neither of which are present in my case. But reference(4) is still beneficial because it excels at providing such a detailed Active Directory configuration example. My last thought is that in the absence of a domain or workgroup (LAN), there are still present in my case the SQL Server instance and the localhost server (provided by MS Expression Development Server). So I came to wonder if it was possible for ADSI Edit to connect to those two servers somehow? (Attempts so far have been unsuccessful.) I cannot imagine how my situation is so unusual. Is mine the only machine running ms sql server in a standalone configuration? I would expect there to be (many) others. Thank you for your time. Please advise.
  3. Hi guys, PROBLEM SOLVED (You Can lock this post)
  4. Hi all, I'm trying to create a query which selects fields from 2 tables. I have a table 'stock' to store cars for sale and a table called 'custstock' which has the customer username and the vehID. How do I show all the cars that relate the that user who is logged in? My current query that doesn't work; $username = "-1"; if(isset($_SESSION['username'])){ $username = $_SESSION['username']; } // executeable query $sql = ("SELECT * FROM [stock] JOIN custstock ON [stock].custstockvehID = custstock.vehID WHERE username = '$username'"); Thanks, Jack
  5. Hi all, I'm trying to execute a query which uses the value from my session which is set when the user logs in. When I try to view the query, it displays nothing. SQL statement // get value of session $username = $_SESSION['username']; // executeable query $sql = ("SELECT * FROM custstock WHERE username = '$username'"); // query $row = mysqli_query($custdb, $sql) or die(mysqli_error($custdb)); The code for my table; <table width="100%" border="1" cellpadding="1" cellspacing="1" class="carInfo"> <tr> <th>ID</th> <th>Vehicle ID</th> <?php while($custveh = mysqli_fetch_assoc($row)){ echo "<tr>"; echo "<td>".$custveh['id']."</td>"; echo "<td>".$custveh['vehID']."</td>"; echo "</tr>"; } ?> </table> Any suggestions would be great, thanks! Jack
  6. Hi, I have an issue and hope someone can point me in the right direction. I have a table called production Table production Id Job Company Status — —— ——— ——— 123 001 Test 1 Active 123 002 Test 1 Active 123 003 Test 1 Active 123 004 Test 1 Complete 123 005 Test 1 Active 123 006 Test 1 Complete 456 001 Test 2 Complete 456 002 Test 2 Complete 456 003 Test 2 Active 456 004 Test 2 Complete 456 005 Test 2 Active 456 006 Test 2 Complete 789 001 Test 3 Complete 789 002 Test 3 Active 789 003 Test 3 Active 789 004 Test 3 Active 789 005 Test 3 Active 789 006 Test 3 Active I'm trying to run a query that returns the following Company Active Complete Test 1 4 2 Test 2 2 4 Test 3 5 1 So its DISTINCT Id and counting the different status and return as above Any help would be great as I have been trying most of the day but without success Cheers Chris
  7. hi, sorry, i have a question to do...but i know how to write in sql query ....however the answer need to write on relational algebra in query is like : SELECT * FROM operation where r='broken' group by pc having count(pc) >1 ; π id,pc,result ( σ r = 'broken' (operation)) like group by and having clasue...i no idea ... i searched on internet still @@ .... isnt the answer like that, i using split/step by step method to do rel 1 = σ r = 'broken' (operation) rel 2 = σ count(pc)>1 γ pc,count(pc) (rel 1)) rel 3 = π id,pc,result (rel 2 ) thanks
  8. Hello W3Schools Forum! This website keeps getting better. Used to I hardly ever visited it. Now it's one of my primary go-to destination points for programming information. I really do appreciate the information. I have got a question about the DISTINCT. I cannot get the two column format to work. SELECT DISTINCT column_name, column_name // Can't get this one to work. FROM table_name; I can get the query to work with one column. SELECT DISTINCT column_name // It works fine using just one column. FROM table_name; It's worth noting. I have got a GoDaddy shared hosting. GoDaddy technical support says the hosting is on one of the older machines. The highest version of PHP is PHP 5.4 on the server. It's probably got an older version of MySQL, also. That could be the problem. I have been with GoDaddy since 2003. I am starting to look around for other hosting providers.
  9. Hi i am new for the PHP, i had the experienced before to do a login system page but what i want it is HTML and PHP file to separate i dont want PHP with HTML together to 1 file , cause professional people will more likely to use 2 file rather than 1 file easy to maintain and edit how to use the external PHP file coding without re-design whole page cause normally what i tested before was link or turn to other new page and result will come out but the design was totally gone so have any ways and suggestion to do that ... in the end, im sorry i not well in english and my knowledge of PHP still quite new , thanks you so much
  10. HI i trying to create a website of forum textarea editor are necessary too for recommendation which editor are best for textarea such as summernote, wysihtml5 .... and how is work to store the data/value/text with styling effect in mysql database ? Thanks all of you
  11. HI i trying to create a website of forum textarea editor are necessary too for recommendation which editor are best for textarea such as summernote, wysihtml5 .... and how is work to store the data/value/text in mysql database ? Thanks all of you
  12. HI i trying to create a website of forum textarea editor are necessary too for recommendation which editor are best for textarea such as summernote, wysihtml5 .... and how is work to store the data/value/text in mysql database ? Thanks all of you
  13. <?php $serv = "localhost:81"; $user = "root"; $password = ""; try { $con = new PDO("mysql:host=$serv;dbname=test", $user, $password); $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Successfully connected."; } catch (PDOException $e) { echo "Connection failed: " . $e->getMessage(); } ?> Here I'm trying to use PDO to connect to my SQL database "test". However, I receive this error each time I connect: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it. Am I connecting with the wrong server, user or password? Because I fail to see here the mistake.
  14. I am In the process of trying to create a web comic aggregation website in php/HTML/JavaScript. I already have a mostly functional PHP RSS feed reader that grabs the image source URLs from a given feed. I am now trying to add the functionality to add these URLs to a database, as well as to download the images to a file system. I am trying to decide on a database API, but am having trouble. From my research, it seems like MySQL is pretty much perfect for what I am trying to do, unless the website grows too popular or the database grows too large, in which case I am told that MySQL will slow down significantly. Initially, the database shouldn't be that large, but over time, it will grow from RSS feeds and probably from the addition of new comics. Also, I don't think the website will become incredibly popular, but if it did and then promptly ceased functioning due to lack of a scalable database, that would certainly be a shame. I am also considering other SQL APIs, such as Microsoft and Oracle SQL. However, from my research, it seems like MySQL is easier to use, cheaper, and has more resources to explain how to use it. So I am torn. Any recommendations for which one to choose? Another option I am considering is to start developing in MySQL, and then if I ever run into significant performance issues from database size or website popularity, to switch to one of the more robust database APIs. I have read that this isn't too hard, but am suspicious. Can anyone give a second opinion on this assessment? PS: I am currently running Windows 7 and developing in NetBeans 8 with XAMPP, although if and when I ever launch my website, I plan on getting a hosting plan and not hosting it myself. Help would be much appreciated
  15. Hello, I am trying to create a web comic aggregation website in PHP/HTML/JavaScript. Currently, my general design plan for the website is an RSS reader that periodically checks various web comics for new comics, and then adds these comics to an ever-growing database, which is then accessed via the client side of the website and displayed in a user-friendly and interactive format. I also may eventually attempt to use web scraping to backfill the database with all the previous comics from before the RSS updater was launched. Currently, I have created an RSS reader that gets the image source of all the comics from a given RSS feed. So mostly I would want to be storing text strings (the URLs) along with some kind of organizational keys (probably based on publication date). Currently, it is not particularly important to me that this information be kept secure at all, although I may eventually add an account creation option in which case I would need to securely store usernames and passwords. I would also like to back up all the comic links I gather by actually downloading the images somewhere (in case the links ever get changed or taken down). Finally, this database can be the same for every user of the website, although it needs to be able to get very long (probably between thousands and hundreds of thousands of individual comics), and of course I would like it to be reasonably quickly accessible so my site isn't incredibly slow. After some research online, it seems like I could use simple file storage, or some kind of database storage API, such as MySQL or Microsoft SQL Server. I was wondering what the advantages and disadvantages of these various options might be (and if I missed any major options), along with how server-side web storage generally works? For example, when I actually launch my website, I know that I would have to rent a server from somewhere or set one up myself. Would I also have to rent a database storage means along with this? How would that generally work?
  16. Hello. Apologies, if I've posted in the wrong forum. What I would like to ask is. I'm creating a simple login screen, and once the user's username and password is matched with what's held on the database. I would like to store the user's fullname, email and membershiptype in a session so I can call it up in another php file later on. At present, I'm able to connect and open the database, then read from it. Then I'm getting stuck. I'm getting errors on lines:- $member_members_id = $_REQUEST['member_id']; $member_fullname = $_REQUEST['fullname']; Could any one please help? Thank You.
  17. Hi, I need a tutorial (in .pdf) on how to make a login page for a web app and secure password database using MS Access. Do you have any reference? Thanks!
  18. Hello Community - I am trying to figure out the sql query to provide me the results that I am looking for in date range from now to 7 days prior. Use Case: When running sales reports for our company, I would like for the query to look at the database and basically pull the last 7 days data. How is this done and could you direct me in that direction, please? Thank you in advance. -Isaiah
  19. hi i'm trying to create an app with php but i have a real problem , i need help , please and thank you // login.php function check_user_authentication(User $user)//return the user id if exist in data base else return false { require_once ('../app/models/loginDataBase.php'); global $data_base_login; $request = $data_base_login->prepare('SELECT id FROM membres WHERE password= :password AND email = :email '); ///my problem is in this line $request->execute(array( 'password' => $user->getPassword(), 'email'=> $user->getEmail() )); $id_user = $request->fetch(); $request->closeCursor(); if ($id_user) return $id_user; else return false; } //app/loginDataBase.php try { $data_base_login = new PDO('mysql:host=localhost;dbname=espacemembre;charset=utf8', 'root',''); $data_base_login->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(Exception $e) { die('Erreur : '.$e->getMessage()); } the error is :Fatal error: Call to a member function prepare() on null in C:\xampp\htdocs\youMvc\app\models\Login.php on line 14 thanks every one
  20. I have learned a lot from W3schools, but I wished there was more tutorials on placing variables within variables - like in PHP inserting Variables in other commands. $SQL= Insert into table; $database = $SQL where order = 1; I know this may not be properly inputted, but that is the basic idea. i do a programming within different languages, but syntax is always the hardest to figure out sometimes. I would love if I had one good model from one main site of doing things such as this for a lot of commands and formatting. Thanks for everything so far!
  21. I have written a SQL Query for my Database at work in Excel so that I can automatically update it. Took me a while to figure out the date sections and getting it to return just the current date with the below code. WHERE f.FolioStatusId in (1, 7, 8, 9, 13) AND cast(f.made_on as date) >= cast(getdate() as date) What I'd like to do is to have a section in Excel where I can type the Dates that I need the data from and too. I know that I can insert a "?" in the query section to make a cell reference but cant figure out what code would need to go in the WHERE section to do that. Any help would be greatly appreciated!
  22. It would be useful to have either a page on SQL TRUNCATE TABLE or a mention of it in the SQL DELETE tutorial. "DELETE from <table>" or "DELETE * FROM <table>" is recommended as a way to delete all data without deleting the table itself. Is this just a synonym for TRUNCATE? Is it guaranteed to do this as efficiently?
  23. I question whether using JPA, you can ask a single SQL statement to the combined relationship of two tables from different manufacturers, for instance MySQL and MS SQL or Oracle ? Is there any way to do this using Java ?
  24. Hi, I am considering to have two tables related to investments: 1) investors 2)invested money, with a link between the two. For the second table, besides own id and id linking to the first table, there are: investment received, paid money (e.g. profits, paid capital etc.), and dates associated with investment and paid money. There is also some money deductible which is relevant to tax, exchange rate, expenses, etc. I have two options: having those deductions as part of the second table with proper formulas, or keep the table simple and have deductions not in the table but rather as part of the accounting work in accountants' books. I would appreciate if someone knows what could be the best/advisable professional practice.
  25. I am trying to filter a table between two dates in ms access from . the query below does Not work when data type is date/ time . When I change data type to text, it gives me sum of the columns. Is there anyway to fix it? Thanks select * into Table3 from (SELECT 'Table6' AS [Table], SUM(a) - SUM( AS Result FROM table6 where date_ BETWEEN " & FromDate & " AND " & ToDate & " UNION ALL SELECT 'Table7', SUM(a) - SUM( FROM table7 where date_ BETWEEN " & FromDate & " AND " & ToDate & ")a"