889 Posted Topics
Re: Hi gurinder16 and welcome to DaniWeb :) Looks to me like you are missing one or more commas in the values section of your query. Count your columns, then count the items you are inserting - these need to be equal as your error message implies. ![]() | |
Re: Looks to me like you are violating your primary key when you try to insert a second record. Make sure that you assign a new PK each time you insert into your Rooms table. | |
Re: Hi jeffm2008 and welcome to DaniWeb :) You need a comma after your last column name and before the words PRIMARY KEY. Like so: [code] attachments text, PRIMARY KEY ( id ) [/code] | |
Re: I think you will need to use the getInputStream() and getOutputStream() methods in the Process class to be able to do what you want to do. Basically you can use the I/O streams to communicate with the Process and then you can use the output from the Process to work … | |
Re: Ok, well JDBC stands for Java DataBase Connectivity, so I'm guessing you need to write your program in java. Check out [URL="http://java.sun.com/docs/books/tutorial/jdbc/"]this tutorial[/URL], if you get stuck on the concepts please post your attempt and where you are struggling. Sorry but we aren't allowed to just do your assignment for … | |
Re: I'm no C++ guru, but I'm pretty sure the shift operator works the same as in Java. Basically a left shift of 1 is like multiplying by 2 to the power of 1 (ie 2), so a left shift of 8 is like multiplying by 2 to the power of … | |
Re: [icode]System.currentTimeMillis()[/icode] will give you the current time in milliseconds. Call this method before your code does anything else, then again after your code is finished, then find the difference and you have the number of milliseconds that your code ran for. | |
Re: [code] Container main = getContentPane(); Container frontpage = getContentPane(); Container node = getContentPane(); [/code] ... [code] frontpage.add(main); frontpage.add(node); [/code] Here you create 3 references to the content pane of your JFrame, then try to add 2 of those references to the third. I would get rid of all references to … | |
Re: The LIKE statement might prove useful. [code] SELECT * FROM Discriptions WHERE Description LIKE '%paint%' or Description LIKE '%red%' [/code] The above statement will find any description where one or both of the words paint or red appear anywhere in the string. The % is a wildcard character that represents … | |
Re: Hi ismael ahm@d and welcome to DaniWeb :) You probably don't need to store the balance in the database as you can calculate this very easily on the fly in PHP, but if you really want to you just do a simple update statement on the database. Something like this: … | |
Re: I would just add a tinyint field to your orders table that represents the status of the order. 0 = ordered, 1 = cancelled, 2 = shipped etc. Then when you want to view your outstanding orders, just filter according to the status of the order. This implementation allows you … | |
Re: You have a comma after the '$b15' entry that shouldn't be there. | |
Re: Selecting data across multiple tables is done with a JOIN statement. There are several types of JOIN, the most basic is the INNER JOIN. This allows you to join two tables with a common set of columns. For example, if your main table has an ID field called family_id, and … | |
Re: Is the user_name column in your table a number or a varchar? If it is a varchar, you need to surround it with single quotes in your SQL query, like so: [code] mysql_query("UPDATE content SET counter = counter + 1 WHERE user_name = '$colname_Recordset1' "); [/code] | |
Re: Hi vivobie and welcome to DaniWeb :) I think that the GeoIP PHP extension library can determine country (as well as lots of other locale information). I have never used it, but [URL="http://www.php.net/manual/en/book.geoip.php"]here[/URL] is a link to its documentation. | |
Re: Hi jpavao and welcome to DaniWeb :) It won't actually contain itself, it will contain another instance of the same class. For example, if it were a JPanel, your code would look something like this: [code] JPanel parentPanel = new JPanel(); JPanel childPanel = new JPanel(); parentPanel.add(childPanel); // --> NOT … | |
Personally I prefer the Reputation as a measure of one's helpfulness/popularity on DaniWeb, and truthfully I haven't paid much attention since the introduction of the Up/Down Voting system. But lately one thing is starting to bug me about it - if someone up/down votes a post, it is completely anonimous … | |
Re: Hi denny42 and welcome to DaniWeb :) So is Name the same in each table? ie is it referring to the same thing? If so, you can join the tables on that field like so: [code] select t1.Name, t1.amount, t2.nominal from Table1 t1 left outer join Table2 t2 -- left … | |
Re: Hi ronyyy, DaniWeb has a golden rule that we only give homework help to those who have shown some effort first. Have you attempted the problem yet? If so, please post your code snippet and describe what problems you are having, otherwise what ideas have you come up with for … | |
Re: [URL="http://www.milw0rm.com/papers/202"]Here[/URL] is a good tutorial on what SQL injection is, how it can be used maliciously and measures that can be taken to prevent such attacks. | |
Re: Hi scmsimplybest and welcome to DaniWeb :) Not sure exactly what you are asking, but if you want the field to not be shown to the user, use a hidden input type rather than a select. Keep track of the variable in the $_GET array and pass by parameter to … | |
Re: Why not do each in a separate query? For example, to find the number of male farmers: [code] select count(*) from farmers where sex = 'male' [/code] All the other queries will be similar, just substitute farmers for whichever table you are querying and change your where clause appropriately. | |
Re: The System.out.print function takes a String parameter, so you should be able to perform assertions on the string that you are passing to it. | |
Re: [QUOTE=Fbody;1128273]Your $x is a string, you should really have it be an integer. Then, all you would have to do is divide by 100. If you need a string for some reason, you could try to use intval() to extract an integer value from the string. You still would have … | |
Re: Looks like COUNTRYCODE is a VARCHAR(3) (that is a maximum of 3 character string) so I don't think you can store the Bahamas code in that field. However if you want all country codes that start with a 1, the following may help: [code=sql] SELECT TARIFF from RATES where COUNTRYCODE … | |
Re: Have you tried adding the brickboard to the panelbg rather than to the window? | |
Re: The [icode]$_SERVER[/icode] superglobal array contains such information. For example, [code] $ipAddress = $_SERVER["REMOTE_ADDR"]; [/code] Try a var_dump on your $_SERVER array and you will see all of the information that it contains. EDIT: Not sure about the device, but the OS should be available in the $_SERVER array, let me … | |
![]() | Re: I would store the create_date in the database in a datetime field. Then you can easily work out the age by grabbing the current time (with the time() function) minus the timestamp of the create_date (using strtotime() function) and dividing by the number of seconds in one day. Integer division … |
Re: The toString method is inherited from a parent class if it isn't overriden in the class that you are calling on. This is true for all classes, since all classes derive from at least the Object class, which contains a toString method. The Object.toString() method prints the name of the … | |
Re: It's probably better to have a try at solving your problems yourself and post here with [i]specific[/i] problems or error messages that you are experiencing. If you need help understanding what some of your code does, feel free to post snippets here and describe where you are having difficulties, and … | |
Re: Hi 16pradeepkumar and welcome to DaniWeb :) Do you need to specifically export to xls file format? The reason I ask is that it is not a trivial task to do this, whereas export to cvs is simple and you can open a cvs file in Microsoft Excel. | |
Re: MySQL includes a LIMIT function which you can use like so: [code=mysql] select * from my_table order by my_key asc limit (0,1) [/code] This will display one record starting at index 0 (ie the first record returned). If you said LIMIT(10,5) it would display five records starting at index 10 … | |
Re: When you display your results, display them as a hyperlink and store the product id in the url. Then when you go to the details page, use $_GET to retrieve it. | |
Re: This will involve some trig, so take a look at the [URL="http://java.sun.com/javase/6/docs/api/java/lang/Math.html"]java.lang.Math[/URL] class. | |
Re: Check out [URL="http://www.databasejournal.com/features/mssql/article.php/1443581/Index-Optimization-Tips.htm"]this great article[/URL] by Alexander Chigrik. His explanations of indexes and their function in MSSQL is great, and he gives some really good insight into the optimisation of your database. | |
Re: You need to close your main method with a } before you declare your numsum method. | |
Re: You can do this: [code] g.scale = 1; <?php $resultCount = mysql_query("SELECT COUNT(*) FROM aa where bbb='1' AND ccc = '%egasg%'") or die(mysql_error()); $count= mysql_result($resultCount,0,0); ?> g.addRow(<?php echo $count; ?>,3,4,1); g.title = "haha"; [/code] | |
Re: So what have you done so far? Or where are you having problems? We only help those that show effort... | |
Re: Hi igirl and welcome to DaniWeb :) [QUOTE]If I keep both tables how can I add the Title to the CourseDetails table without manually adding them all?[/QUOTE] There is no need, it is in the Courses table so you don't need it in the CourseDetails table as well. To select … | |
Re: Hi blanj and welcome to DaniWeb :) We only give homework help to those who show a bit of effort. What have you done so far? | |
Re: [URL="http://www.systemsevendesigns.com/phoogle"]Phoogle[/URL] is a Google Maps PHP package that is very easy to use. | |
Re: There are zip and rar extension libraries for PHP. The [URL="http://www.php.net/manual/en/refs.compression.php"]PHP documentation[/URL] discusses some, there are also third party ones too. Once you have one installed it should be pretty straight forward, just zip or rar the directory. | |
Re: The [URL="http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_avg"]AVG[/URL] function will be valuable to you. Basically, you are after an average of the average of your three rating values, so your query will look something like this: [code] select product_id, avg((price + quality + features)/3) as average_rating from review_tbl group by product_id [/code] You can join with … | |
Re: You have a - where there should be an =. [code] CREATE TRIGGER before_insert_ddsw BEFORE INSERT ON `ddsw` FOR EACH ROW SET products.count = products.count +1; [/code] | |
Re: [QUOTE]How should i read a nested for loop? Like would this run essentially 30 times? Does it basically say run the inside loop 10 times? So then does it basically run once, go into the nested loop, run 3 times, then go back into the outer loop, then back into … | |
Re: [QUOTE] Also the " ++i " thing confuses me, it means that it is iterated beforehand , is that right ? So what kind of questions might involve that? [/QUOTE] Can you answer the following common exam question: What is the output of the following code snippet? [code=java] $i = … | |
Re: [URL="http://www.webyog.com/en/downloads.php"]SQLYog[/URL] is pretty easy to use. | |
Re: Ok, so what is it doing that it shouldn't? What should it do that it is not? Are you getting any error messages when you run it? | |
Re: Happy New Year from Adelaide, South Australia where it is currently 3am on New Year's Day :) |
The End.