Search the Community
Showing results for tags 'mysql'.
-
I know this is probably really simple but I'm having troubble figuring out how to select a row from a MySQL db where multiple columns equal a certain value. Here's what I have, I'm using PHP PDO: $query = SQLWrapper()->prepare("SELECT postid,Images FROM ImagePost WHERE gid = :gid, Title = null, Category = null,Caption=null"); Any help would be apprciated! Thank you!
-
Sup guys, I got an assignment to do for school which concluded developing a webshop. I got the website with al the articles on it and I got the database (MYSQL). The only question now is how to connect those two. I really appreciate it. Greetz
-
Hey guys, Update for my school assignment. Everything is going to plan. I've connected the website with the database, but I got another question. <?php $db = mysqli_connect(localhost, root, usbw, webshop) or die('Error connecting to MySQL server.'); ?> <html> <body> <div id="Pizza1"> <div id="Header"> <h2>Macro lens</h2> </div> <?php <div id="Product"> <table> <tr> <td><img id ="lens" src="macrolens1.png"/></td> <td><img id ="lens" src="macrolens2.png"/></td> <td><img id ="lens" src="macrolens3.png"/></td> </tr> <tr> <td><p>AF-P DX NIKKOR 18-55MM F/3.5-5.6G <br> €209,00</p></td> <td><p>Canon EF 100mm f/2.8 Macro USM lens <br> €549,00</p></td> <td><p>FE 90 mm F2.8 Macro G OSS <br> €1200,00</p></td> </tr> <tr> <td><p> Merk: Nikon <br> Brandpuntsafstand: 18-55 mm <br> Filtermaat: 55 mm <br> Gewicht: 195 gram </p></td> <td><p> Merk: Canon<br> Brandpuntsafstand: 100 mm<br> Filtermaat: 58mm<br> Gewicht: Circa 305 gram </p></td> <td><p> Merk: Sony<br> Brandpuntsafstand: 90 mm<br> Filtermaat: 62 mm<br> Gewicht: 602 gram </p></td> </tr> </table> </div> ?> </body> </html> This is a part of my code, I know, its not perfect. I want the following thing happen when I clicked an image: When an image is clicked I want to have a piece of code that will add this product to the shopping-cart. I already have a database for the shopping-cart. Is it possible to fix this with a simple if statement? Or is there an other way to do this. I hope everything is clear. Greetz
-
Having issues with creating Foreign Keys. How would I end up doing the linking of the FK with PHPMyAdmin? I get errors when I do it using constraints. Thanks for the Help! Create database cardealerships; use cardealerships; CREATE TABLE tblDealerShip ( dealerShipId int(11) NOT NULL AUTO_INCREMENT, dealerShipName varchar (15) DEFAULT NULL, dealerShipState char(2) DEFAULT NULL, dealersName varchar(50) DEFAULT NULL, dealersPhoneNumber varchar (10) DEFAULT NULL, PRIMARY KEY (dealerShipId) ); /* INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (1,'Texans Can Cars','West Virginia','Alicia C. Marinez','239-513-1597'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (2,'Americas Motorsports','Illinois','Dorothy S. Bates','425-437-5686'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (3,'Moose Island Marine','Texas','Alicia C. Marinez','620-386-9845'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (4,'Stadium Lincoln Mercury','New York','Sergio Ochoa','704-602-5603'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (5,'Road Track & Trail','Maine','Chuck Norris','618-975-2136'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (6,'James Motor Cars','Florida','Mike Bay','931-557-1481'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (7,'Thul Auto Stores','Arizona','Allen Woody','205-329-6108'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (8,'Don Roberto Motor Cars','Alaska','Jim Joe','919-625-2474'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (9,'A & W Truck Sales','Pennsylvania','Brittney Mouse','605-584-6291'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (10,'Texas Car','Minnesota','Zoey Dez','585-356-0780'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (11,'Car R Us','West Virginia','Joe Burger','814-490-3312'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (12,'New Cars Four You','West Virginia','Wendy Marks','810-210-1007'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (13,'Car Trades','Connecticut','Mike Mown','239-465-9989'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (14,'BMW Dealers','Montana','Lee Phil','629-751-6598'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (15,'Wheelers','Arizona','Mac Chester','692-914-6523'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (16,'Deals on Wheels','Michigan','Wall lee','256-964-9987'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (17,'Trucks R US','California','Eva Eve','698-985-5641'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (18,'Sporty Sales','Virginia','Crystal Johnson','239-569-5648'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (19,'Used and Mis-used','Washington','Letter Maine','715-412-6957'); INSERT INTO `tbldealership`(`dealerShipId`, `dealerShipName`, `dealerShipState`, `dealersName`, `dealersPhoneNumber`) VALUES (20,'We buy Cars','Ohio','Cris Powers','218-205-0529'); */ CREATE TABLE tblCars ( carId int (11) NOT NULL AUTO_INCREMENT, carMake varchar (50) DEFAULT NULL, carModel varchar (50) DEFAULT NULL, carYear int (4) DEFAULT NULL, dealerShipId int (11) DEFAULT NULL, carSoldDate date DEFAULT NULL, customerId int (11) DEFAULT NULL, PRIMARY KEY (carId) ); CREATE TABLE tblCustomerInfomation ( customerId int (11) NOT NULL AUTO_INCREMENT, customerFirstName varchar (50) DEFAULT NULL, customerLastName varchar (50) DEFAULT NULL, customerPhoneNumber varchar (10) DEFAULT NULL, customerState char (2) DEFAULT NULL, customerAddress varchar (50) DEFAULT NULL, carId int (11) DEFAULT NULL, dealerShipId int (11) DEFAULT NULL, PRIMARY KEY (customerId) ); CREATE TABLE tblCarMaintainceServices ( carShopId int (11) NOT NULL AUTO_INCREMENT, carShopName varchar(50) DEFAULT NULL, carShopState char (2) DEFAULT NULL, carShopAddress varchar (50) DEFAULT NULL, carShopServices varchar (50) DEFAULT NULL, carId int (11) DEFAULT NULL, carShopDateService date DEFAULT NULL, PRIMARY KEY (carShopId) ); CREATE TABLE tblDealerInventory ( dealerLotId int (11) NOT NULL AUTO_INCREMENT, carId int (11) DEFAULT NULL, dealerShipId int (11) DEFAULT NULL, PRIMARY KEY (dealerLotId) );
-
Hi, I'm creating this offline key vault. I have made a encryption of the stored keys using the same key as the user, so in case the key is changed the stored keys are not compromised. But as of now the only way I see I can decrypt using the key is by matching the key to the hashed key in the database > now you are logged in and it then stores the key in plaintext in a session (I think this is unsafe but if I'm wrong let me know) and then it grabs that each time it decrypts the stored keys. How can I do this better (if there is)?
-
Hi I wonder how could I create database table the right way. So I have users and they are in groups. One group can have many users,but user can be just in one group. And there are modules and module pieces. And there are user right's to module piece. So user can have right to module piece by it's right or by group right. So I don't know how to solve this user right, group right thing.
-
i want to insert some data to a table in my mysql db.firstly i got a null pointer exception error and after changing rs= st.executeQuery(query); to rs= st.executeUpdate(query); i get no errors but no values are being sent to the db.i have correctly setup the db drivers and connection and i have checked my insert statement.all these look correct.please help me
-
Hi, so I have been programming in C# over past 4 years and now I heard about sql. From what I understand, it is used to create databases, but what are MySQL, SQLite, T-SQL, postgre SQL, mySQLi?
-
so im using netbeans 8.2 IDE and mysql database. when i made a web application and tried to run my jsp i got 2 errors saying : C:\Users\hp\Desktop\fashionsite\nbproject\build-impl.xml:874: The following error occurred while executing this line: C:\Users\hp\Desktop\fashionsite\nbproject\build-impl.xml:296: my servlet has a red exclamation mark near its icon but there is no error in it. there were solutions from other sites saying to delete the build.xml and restart netbeans so that it will create a new build .xml file. but this did not work. i havent found any solution for what is causing this error.it would be very helpful if someone could suggest a solution.thanks
-
i have tried the following code and i have been successful at getting the image to the jsp page but when i run it the image appears in the whole page and all other textboxes and buttons are not showing. this is the code i have tied in my jsp <% Blob image = null; Connection cn = null; byte[ ] imgData = null ; Statement st = null; ResultSet rs = null; try { Class.forName("com.mysql.jdbc.Driver"); cn = DriverManager.getConnection("jdbc:mysql://localhost:3306/shopping_db","root",""); st = cn.createStatement(); rs = st.executeQuery("select image1 from item where id = '1'"); if (rs.next()) { image = rs.getBlob(1); imgData = image.getBytes(1,(int)image.length()); } else { out.println("Display Blob Example"); out.println("image not found for given id"); return; } // display the image response.setContentType("image/jpg"); OutputStream os = response.getOutputStream(); os.write(imgData); os.flush(); os.close(); } catch (Exception e) { out.println("Unable To Display image"); out.println("Image Display Error=" + e.getMessage()); return; } finally { try { rs.close(); st.close(); cn.close(); } catch (SQLException e) { e.printStackTrace(); } } %>
-
Hello, title says it all. I have 2 tables in the database that are for one "element" so first is just pool names and status on them, the other tables are drives and what pools they belong too. I have made a visual element for how I want it to be, I just don't know how I can display more on one page. So how does one do this?
-
So i wanted to do a little project again about a old game i used to play, i found it a good project since it had the ability to compare items set prices and where you can find them etc. So the thing i stumbled uppon was that every item can have values like Attack, Defense, Critical. But most of them also dont have these stats and have completely other stuff like Health regen. And there there are a few items in a totally different category that SOMETIMES also have Health regen (Like a special item) The thing is i deal with alot of Stats which can be applied but mostly it really depends on that item and not on a category like Gear or weapons Even a goddamn pet can have Attack bonnusses. To make a Table with the Items in it and a column for every stat that CAN be there would be a bit much? or do i have to deal with it. Its faster for making search possibilitys. Also means that some items just have 30 empty columns and like 5 filled. Or do i just store an array in the DB with the values in it, which makes it a bit more pain to search and compare things since you have to extract that array all the time. Its a bit of a broad question but what it comes to is. I have alot of data and the data is per item different, normally its per category most of the gear would have the same thats than other gear parts. Here its not that case.
-
programming How to view all images stored in database using JSP?
Shammikit posted a topic in Programming
i have 10 images in my database table and i want to display all those images in a jsp page. i have tried this code .it displays the last image in the database only in all 10 places. i have attached a image so that u can see how it appears. only the Toshiba logo which is the last image stored in the DB is showing in all positions. i want to show all the images in descending order. <% Class.forName("com.mysql.jdbc.Driver"); Connection conn = null; conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/testdb", "root", "root"); Statement stmt = null; stmt = conn.createStatement(); String query = "select * from products order by ID DESC "; ResultSet rs = null; rs = stmt.executeQuery(query); while(rs.next()){ %> <tr> <% String name = rs.getString("Name"); String Price = rs.getString("Price"); String imge = "viewitemimageservlet?image1"; %> <td><%=name %></td> <td><%=Price %></td> <td> <img src="viewitemimageservlet?<%=imge %> " width="400" height="200" /> } -
Hello, everyone. I have a database dump from one server that I am moving to another, however, stupid me forgot that when setting up an account, cpanel (and even Sentora) uses the username as the bit before the actual DB name (ie: my username for the old server was "ohiojekq" so one of my databases would be called "ohiojekq_aban275"). How do I go about renaming the DB so I don't loose all my information? Should I just create a sub-account in WHM with the user "ohiojekq" to save time? I am so confused and just want to get my sites up and running again. Somebody please help.
- 22 replies
-
- sql
- phpmyadmin
-
(and 1 more)
Tagged with:
-
So I'm currently writing up a web server that will take requests of data from a My SQL DB that is hosted on Azure. I've been writing it using Python, but I keep getting silent crashes that don't trigger try/catch blocks. Here's a snippet from the _mysql attempt; this "succeeds" without submitting - no errors are thrown to break the attempt. def view_profile(args): try: db=_mysql.connect(host=server,port=3306,user=username, passwd=password,db=database) db.query("SELECT * FROM accounts") rows=db.store_result() print(str(rows[1])) return 1 except: return 0 I had print statements between each line to make sure it was doing something, but it never completed the connection phase. (Note: The above code is using the _mysql library; ODBC attempt is below) Here's an example of what I have for the ODBC version. connectString = 'Database=<DB HERE>;Data Source=<Server here>;User Id=<login cred>;Password=<PW cred>' def register(args): try: cnxn = pyodbc.connect(connectString) cursor = cnxn.cursor() cursor.execute("INSERT INTO accounts (Email, Password, FName, LName, DoB, Phone, LastLongitute, LastLatitude) values ('" + args[0] + "', '" + args[1] + "', '" + args[2] + "', '" + args[3] + "', '" + args[4] + "', '" + args[5] + "', " + args[6] + ", " +args[7] + ")") cnxn.commit() cnxn.close() return 1 except: return 0 Both of the above codes "succeeds" without submitting data, but fail to even connect to the server. Any idea what I'm doing wrong here?
-
Okey so I have a search function (basic one) and I would like to be able to check of diffrent stuff etc their role, if they are premium, and search by name, all at the same time. so if I search for "test" it will select test, if I select role test it will find test and test2 since they are both in that role. All of the how to "select" and those functions I already know how, I just don't know how the mysql select query string should look like to be able to do this. the way the search function works is that it just creates a url parameter which the "search page" uses etc ?q=jove will find the user jove, and I would like a simple way of doing it this way (if there isent a better way ofc). Please let me know if I wasent clear enough, my english and explanation isent the best search is by name, the drop down has values it will search for and checkbox will see if it's true or false search looks in column uid, Dropdown in role, and checkbox in premium for a o or a 1. and I want this to be sent in a url parameter and then piced up and used where I have the other end.
-
I need to create a JSON string from my database request do this code returns this : [{"id":"1","weight":"0"}][{"id":"2","weight":"7"}][{"id":"3","weight":"1.5"}] I need it to return [{"id":"1","weight":"0"},{"id":"2","weight":"7"},{"id":"3","weight":"1.5"}] (the commas instead of ][) How can I do this? <?php require 'dbConnect.script.php'; $query="SELECT * FROM `trash`"; if($is_query_run=mysql_query($query)){ while($query_execute=$query_execute=mysql_fetch_assoc($is_query_run)){ $rows = array(); $rows[] = $query_execute; print json_encode($rows); } } else{ echo "query notexecuted"; } ?>
-
So I want to be able to store etc 1, 2, 3, 4 in the same column and then in php get it out like this $nr1 = mysql stuff // echo $nr1 will return "1" $nr2 = mysql stuff // echo $nr1 will return "2" $nr3 = mysql stuff // echo $nr1 will return "3" $nr4 = mysql stuff // echo $nr1 will return "4" how can this be done? I just need the basic way to do, the rest I'll do myself
-
Looking for an experienced PHP and MySQL Developer to help create a Single Sign On System for my Organisation. This SSO System needs to be integrated with myBB and phpVMS, 2 items of software we use, and also allow us to expand with other services we may choose to use in the future. Thank you
-
I am trying to set up a WordPress to my UnRAID server. I installed Apache and MariaDB in Docker. But I can't finish the installation of WordPress because I can't connect it to the database. I want to know how should I set the database up and do I need to do anything on the router? Thanks
-
i have a textfield to get user input in my form 1.i want to get the text user inputs into that textfield from that form and assign it to a variable in form2. is this possible?
- 3 replies
-
- mysql
- programming
-
(and 3 more)
Tagged with:
-
Hey there, so I am new to SQL and wondering why my connection failed when testing? This is the message that popped up while testing:
-
So I'm trying to store Æ, Ø and Å in a mysql but it turns it to jibrish, tho when I echo the result it's displayed correct. Row is set to utf8_swedish_ci. what is going on here?