Jump to content

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

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Found 191 results

  1. <?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.
  2. 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
  3. 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?
  4. 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.
  5. 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!
  6. 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
  7. diiazopde

    php & sql problem

    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
  8. 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!
  9. 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!
  10. 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?
  11. 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 ?
  12. 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.
  13. I am trying to filter a table between two dates in ms access from vb.net . 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"
  14. Hi I have Business Management degree. I have been unemployed for few years and stay home. I would like to study something new and I like. I spend a lot of time on computer and go on internet so I am thinking learning SQL lessons from this site. About IT or SQL are new for me, start from zero. The site doesn't have a certification for SQL. My questions are If I finish learning the course from the site, what I have to do next, can I get job right a way, what job or work can I apply, what position should I looking for, since I don't have a certification? Please give me some advices. Thanks
  15. Hi, Can anyone recommend anywhere that I can learn code part time in the United Kingdom? I have been teaching myself html, css, etc on a basic level & now venturing into php, mysql, js, etc & think that having a tutor or guidance would really help speed up my learning process. Any companies or colleges offering part time courses in these area's will hopefully fill in the holes in my knowledge & help me progress. I'm not really concerned about qualification certificates, the knowledge is more important to me. Thanks for any advice. Old Guy.
  16. I'm having trouble with getting the image in the right order. I'm trying to filter images gotten from the database based on the button link. I got the reference from http://www.evoluted.net/thinktank/web-development/jquery-filtering. I have about 20+- buttons and for each button, I am getting all the picture that is being under that filter button through database. (Not sure where to post this, but I think it's more suited to be under css). Basically, I have gotten the css all wrong (my css is basic too ><), so I hope you could help me(where i have gone wrong) and give some pointers. Here is css: /*- FILTER OPTIONS -*/ul#filterOptions { width: auto; height: auto; margin-top: 60px ; ; overflow: hidden; list-style: none;}ul#filterOptions li { height: 52px; margin-right: 2px; float: left;}ul#filterOptions li a { height: 50px; padding: 0 20px; border: 1px solid #999; background: #cfcfcf; color: #fff; font-weight: bold; line-height: 50px; text-decoration: none; display: block; list-style: none;}ul#filterOptions li a:hover { background: #c9c9c9; list-style: none;}ul#filterOptions li.active a { background: #999; list-style: none;}/*- -*//*- OUR DATA HOLDER -*/#filterBody { width: 100%; height: 100%; overflow: hidden; list-style: none;}#filterBody div.item { width: 200px; height: 200px; float: left; text-align: center;}#filterBody div.item h3 { margin-top: 10px; font-size: 16px; line-height: 20px;}/*- -*/ My html/php code looks like this (example of 1 button): <!----------------- The filter buttons will be these--------------------------> <ul id="filterOptions"> <li class="active"><a href="#" class="all">All</a></li> <li><a href="#" class="IS_1">C#</a></li> <li><a href="#" class="IS_2">PHP/MySQL</a></li> <li><a href="#" class="IS_3">HTML/CSS</a></li> <li><a href="#" class="IS_4">Java Enterprise Development</a></li> <li><a href="#" class="IS_5">Mobile Application Development</a></li> <li><a href="#" class="IM_1">Web Design</a></li> <li><a href="#" class="IM_2">3D Modelling & Animations</a></li> <li><a href="#" class="IM_3">Graphic Design</a></li> <li><a href="#" class="IM_4">Video Editing</a></li> <li><a href="#" class="IM_5">Motion Graphics & Effects</a></li> <li><a href="#" class="CNET_1">Network Security</a></li> <li><a href="#" class="CNET_2">RB Network Design & Implementation</a></li> <li><a href="#" class="CNET_3">Broadband Access & WAN</a></li> <li><a href="#" class="CNET_4">ICT Infrastructure Management</a></li> <li><a href="#" class="CNET_5">Technopreneurship Project</a></li> <li><a href="#" class="ITSM_1">Virtualisation & Cloud Computing</a></li> <li><a href="#" class="ITSM_2">IT Service Operation & Management</a></li> <li><a href="#" class="ITSM_3">Server Administration & Security</a></li> <li><a href="#" class="ITSM_4">Database Administration & Management</a></li> <li><a href="#" class="ITSM_5">Internet of Things App Development</a></li> <!--<li><a href="#" class=""><?php ?></a></li>--> </ul><!--------------Filtered contents to be through the button--------------------><div id="filterBody"> <!----Filter contecnt of C#------> <div class="item IS_1"> <p> Hello everybody!</p><?php try{ //connect to the database require("Connections/database.php"); // array to hold errors $errors = array(); if(empty($errors)){ //select portfolio picture from database $query = "SELECT p.*, u.skillset FROM portfolio p INNER JOIN userProfile u ON p.user_id = u.user_id WHERE u.skillset LIKE '%C#%' "; //var_dump($query); $stmt = $database->query($query); foreach ($stmt as $row) { //print out the data ?> <div id= "imagesPortfolio"> <img src="<?php print htmlspecialchars($row['imagePath']); ?>" width="100" height="100"> </div> <?php //print $row['imageName'] . "t"; //print $row['Name'] . "t"; //foreach($row['picPath'] as $picURL) { //$picURL = $row['picPath']; //'<img src="'. $dir. '/'. $file. '" alt="'. $file. $ //} // print '<img src="'. $picPath. '/'. $file. '" alt="'. $file; //print $row['introduction'] . "n"; } } foreach($errors as $error) { printf("<li>%s</li>", $error); //exit(); } } //end of try block catch(PDOException $e){ // end of database dependent code, handle any errors $status = empty($query) ? 'Connection failed':" Query failed: $query"; // application message trigger_error("$status, Error: {$e->getMessage()}, File: {$e->getFile()}, Line: {$e->getLine()}"); // user message $errors[] = 'Sorry, this page is not working at this time.';}?> <!---The like system implementation----><!-- <div class="like-btn">Like</div> <div class="dislike-btn"></div>--> </div><!------Other buttons same as this buttons, only filter name different--------></div> Is my concept wrong? >< I think i have misinterpreted somewhere, I just can't point out whether it's the css, the php or both ;-; I need to put 6 images in a row, and I'm not sure how to do this in the foreach loop too ><
  17. Dear Friends , I am just going through SQL Stored Procedure which is previously created. it contains mail Generation in HTML through SQL. in following code i am not able to understand use of number (1) & (2) please explain me. ----------------------------------------------------------------------------------------------------------------------SET @tableHTML = N'<H>MRP Indent Details</H>' + N'<table border="1">' + N'<tr><th>Indent Code</th><th>Indent Date</th><th>indent Type</th>' + N'<th>Approved BY</th><th>Cost center</th><th>No Of Items</th><th>Approximate Rate</th></tr>'+ CAST ((select td=a.Indentcd,' ', (1) ' ' td=a.IndentDt,'', td=a.indenttype,' ', td=a.ApprovedBy,' ', td=a.ccncd,' ', "td/@align" = 'right',td=a.Itemcnt,' ', "td/@align" = 'right',td=a.mthwtavgrate,' ' from TmpMRPMail a FOR XML PATH('tr'), TYPE ) AS NVARCHAR(MAX)) + N'</table>' ; (2) XML Path -----------------------------------------------------------------------------------------------------------------------
  18. I get the error ERROR 1066 (42000): Not unique table/alias:I cant figure out whats wrong with it.SELECT p.id as id_produk, p.nama_produk, p.stok, p.url_title, p.deskripsi, p.file_name, p.id_kategori_produk, p.fk_jenis_id,p.fk_merk_id, p.fk_gudang_id, p.created_at, kp.id, kp.nama_kategori, jm.id, jm.jenis_material, mm.id, mm.merk_material, gm.id, gm.gudang_material FROM produk as p, kategori_produk as kp, produk as p, jenis_material as jm, produk as p, merk_material as mm, produk as p, gudang_material as gm WHERE p.id_kategori_produk = kp.id, p.fk_jenis_id = jm.id, p.fk_merk_id = mm.id, p.fk_gudang_id = gm.id ORDER BY created_at DESC LIMIT 0, 15Filename: C:xampphtdocstelkomaksessystemdatabaseDB_driver.phpLine Number: 330
  19. jaylow

    foreign key error

    Hello, i have 2 tables. one is for users to sign up and the other is to make character. i added a foreign key to the character table to link it to the members table not when i sign up it just adds me to the table but when i want to make a character it give me this error i want to link the character_id to the id in the members table, so i know what character belongs to what member.. i get: ERROR:could not able to execute INSERT INTO `character` (charname, ######, gold, xp, accdate) VALUES ('jay', 'male', 100000, 0, now()).Cannot add or update a child row: a foreign key constraint fails (`secure_login`.`character`, CONSTRAINT `character_ibfk_1` FOREIGN KEY (`character_id`) REFERENCES `members` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) Members table: CREATE TABLE IF NOT EXISTS `members` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(30) NOT NULL, `email` varchar(50) NOT NULL, `password` char(128) NOT NULL, `salt` char(128) NOT NULL, `accdate` timestamp NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ; `character` table: CREATE TABLE IF NOT EXISTS `character` ( `id` int(11) NOT NULL AUTO_INCREMENT, `character_id` int(11) NOT NULL, `charname` varchar(30) NOT NULL, `######` tinyint(4) NOT NULL, `gold` int(11) NOT NULL, `xp` int(11) NOT NULL, `accdate` timestamp NOT NULL, PRIMARY KEY (`id`), KEY `character_id` (`character_id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;---- Constraints for table `character`--ALTER TABLE `character` ADD CONSTRAINT `character_ibfk_1` FOREIGN KEY (`character_id`) REFERENCES `members` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; without a foreign key i can update the characters table without any issue i messed around with the tables for the last two hours and just dont know anymore. if i switch the foreign key to my members table the sign up does not go into the members table
  20. Hello, i am having issues adding info to a database i have a html from where a user should fill in charname and select ###### then press submit. if i do this i get the error ERROR:could not able to execute INSERT INTO character(charname, ######, xp, gold, accdate) VALUES(jay, male, 0, 100000, now()).You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'character(charname, ######, xp, gold, accdate) VALUES(jay, male, 0, 100000, now())' at line 1 <?php include_once 'db_connect.php'; include_once 'psl-config.php'; $error_msg = ""; $now = time(); // check connection if($mysqli === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } // Escape user inputs for security $charname = mysqli_real_escape_string($mysqli, $_POST['charname']); $###### = mysqli_real_escape_string($mysqli, $_POST['######']); //attempt inser quesry execution $sql = "INSERT INTO character (charname, ######, gold, xp, accdate) VALUES ($charname, $######, 100000, 0, now())"; if(mysqli_query($mysqli, $sql)){ echo "Records added successfully."; } else{ echo " ERROR:could not able to execute $sql." .mysqli_error($mysqli); } // close connection mysqli_close($mysqli); ?> Table CREATE TABLE IF NOT EXISTS `character` ( `id` int(11) NOT NULL AUTO_INCREMENT, `charname` varchar(30) NOT NULL, `######` tinyint(4) NOT NULL, `gold` int(11) NOT NULL, `xp` int(11) NOT NULL, `accdate` timestamp NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; I was wondering if some one could explain me what i do wrong, and or have some tips how to make this better. the idea is to add a check to see in the "charname" is already used. and some other stuff. but first i like to see the info end up in my DB Thanks
  21. Nuimi

    SQL - Update

    Can you help me with sql, I need update form, but I don´t know how can I do it. $db= new mysqli("localhost", "dany66", "*******", "mathstart"); $email_n = $_POST['email_n']; $vek_n = $_POST['vek_n']; $datum_n = $_POST['datum_n']; if(isset($email_n)) { $update1 = "UPDATE inf(email) SET email= '$email' WHERE jmeno = '" . $_SESSION['username'] . "'"; $pokus = $db -> query($update1); if(fetch_assoc($pokus) == TRUE) { echo("<script> alert('Řádek s e-mailem byl změněn.')</script>"); } }
  22. I love what w3schools is doing with the SQL tutorial - good stuff. I noticed that one of the most fundamental elements of w3schools (the "Try it now" button) goes missing about half-way through the SQL Tutorial. May I ask why? I teach sql at a local community colleg. I have gone through several textbooks with mixed results, and I am always keeping my eyes open for new ways to teach. I would love to incorporate w3schools SQL tutorial into my class; do you have a db dump available for download of the tables you use? One of my lessons will be having students figuring out how to get the data from the tutorial into a local database, but having the entire dataset available up front would be handy. If such a db dump is not available, no worries - easy enough to generate one. Thanks again for your time and attention.
  23. I have a mySQL posts table, a files table, and a relationships table. I need to sum file download counts grouped by the post the files are associated with. SELECTp.id, p.post_title, count(d.download_id) FROM posts p INNER JOIN file_log d ON p.id = d.file_idgroup by p.post_title The above query works as long as the titles of the files are the same, which is not always the case. I really need to group them by their relationship to the post they are associated with. The relationships are stored in relationships r, which shows r.post_id (which is p.id from posts), and r.file_id (which is d.file_id from file_log) I have tried a few subqueries, but I am not sure how to join the relationships table to my query and group counts by r.post_id Thanks for any help.
  24. Hey everyone, I wanted to share with everyone the book "SQL QuickStart Guide" that is currently free in the Amazon Kindle store. You can download here: http://www.amazon.com/SQL-QuickStart-Guide-Simplified-Structured-ebook/dp/B00UCFK44U/ref=sr_1_18?s=digital-text&ie=UTF8&qid=1427911263&sr=1-18&keywords=sql
  25. Hello, I need delete row in html table select row and click button delete make delete using ajax Currentally can make delete without ajax but I need delete row and stay on page without make submit on other page code html,php <?php $resualt=mssql_query("SELECT * FROM Address where user_id='$UserId' ") ;echo "<table border='1' class='imagetable' id='imagetable'width='400px' >n";echo '<thead>'.'<tr>';echo '<th>Street</th>'.'<th>Quarter</th>'.'<th>From</th>'.'<th>To</th>'.'<th>Notes</th>';echo '</tr>'.'</thead>';echo '<tbody>';while ($row = mssql_fetch_assoc($resualt)) {$fromDate=$row['from_date'];$toDate=$row['to_date'];echo " <tr onClick='myPopup($row[id])'". ( $_GET['id'] == $row['id'] ? "style='background-color: green;'":"").">n"."<td >{$row['street']} </td>n"."<td>{$row['quarter']}</td>n"."<td>$fdate2</td>n"."<td>$tdate2</td>n"."<td>{$row['other_info']}</td>n";}echo '</tbody>';echo "</table>n";?> //button delete <?phpecho"<a class='button-link' href='delete_address.php?id=$id'>delete</a>"; ?> code sql to make delete from db <?php$idEmploye=$_GET['id'];$db_host = 'jo';$db_username = 'jo1';$db_password = '123321';$db_name = 'db_test';mssql_connect($db_host, $db_username, $db_password);mssql_select_db($db_name);mssql_query("DELETE FROM AddressWHERE id='$idEmploye' ; ") or die(mssql_error()) ;echo '<script language="javascript">';echo 'alert("successfully deleted ")';echo '</script>';echo "<script>setTimeout("location.href ='address.php';",10); </script>"; ?> Any Help Thanks
  • Create New...