I posted earlier today about converting my MySQL to MySQLi - Upon further research I came across the following, Prepared Statements. It seems that this may be a good way to go but I am a bit confused about how to implement it. I am simply taking User-entered data from a form and adding it to my database. I need to find an example of how to do this using this method. I found the following example, but it appears to me that it is manually adding it via prepared code. Can anyone please explain explain this to me? ` …

Member Avatar
Member Avatar
+0 forum 7

So far I have this but I need to use switch statements to make age< certain numbers for each age group. #include <iostream> #include <iomanip> #include <string> using namespace std; const float CHILDREN_MALE=50.00; const float CHILDREN_FEMALE=55.00; const float TEENAGERS_MALE=150.00; const float TEENAGERS_FEMALE=155.00; const float ADULTS_MALE=275.00; const float ADULTS_FEMALE=250.00; int main() { int Age, name; float Mcost=0.0; float total=0.0; char Gender; cout << fixed << showpoint << setprecision (2); //Display Menu cout << "-------------Fullerton Health Club--------------" << endl; cout << "Children (Age 1-12) " << endl; cout << setfill ('.'); cout << left << setw(15) << "\tMale" << right << setw(6) …

Member Avatar
Member Avatar
+0 forum 1

Not sure why it's not letting me choose the operation I want where I put "Enter an operation symbol..", I'm supposed to use switch statements to compute functions. #include <iostream> #include<cmath> #include <iomanip> #include <string> using namespace std; int main() { int type; int a, b, c, d; char op; cout << fixed << showpoint << setprecision(2); //select operation cout << "Enter a fraction: "; cin >> a; cin.ignore(); cin >> b; cout << "Enter another fraction: "; cin >> c; cin.ignore(); cin >> d; cout << "\tEnter an operation symbol (+,-, *, /): "; cin >> op; cin.ignore(); //operate …

Member Avatar
Member Avatar
+0 forum 6

Hello, I am working on some code that does a remote call to a licensing server to validate whether the license is valid, invalid, expired and suspended. I have a login code that is using prepared statements: function login($email, $password, $mysqli) { // Using prepared statements means that SQL injection is not possible. if ($stmt = $mysqli->prepare("SELECT id, username, password, salt FROM members WHERE email = ? LIMIT 1")) { $stmt->bind_param('s', $email); // Bind "$email" to parameter. $stmt->execute(); // Execute the prepared query. $stmt->store_result(); // get variables from result. $stmt->bind_result($user_id, $username, $db_password, $salt); $stmt->fetch(); // hash the password with the …

Member Avatar
Member Avatar
+0 forum 6

Hi everyone! I am having troubles making the second IF statment execute in my code: Pattern dl_noise_rates_p = Pattern.compile("\\d+\\s(.+)\\s(.+)\\s(.+)\\s(.+)"); Matcher dl_noise_rates_m = dl_noise_rates_p.matcher(lineString2); if(dl_noise_rates_m.find()){ String s_dl_nr1 = (dl_noise_rates_m.group(1)); //checking for non numbers pulled in the regex if(s_dl_nr1 == "NaN"){ //| s_dl_nr1 == "NaN" | s_dl_nr1 == " NaN" System.out.println ("OMGOMGOMGOMGOMGOMGOMGOMGOMG ITS NOT A DECIMAL NUMBER"); s_dl_nr1 = "0"; } System.out.println ("Download noise rate value 1: " + s_dl_nr1); } I am pretty sure the "OMGOMG" section should be getting outputted becasue when I execute my script I get this. Since I am seeing that the value of my string s_dl_nr1 …

Member Avatar
Member Avatar
+0 forum 5

basically i am working on a project for uni, which is to create a form of an abacus model. - peg_array[] stores the number of counters/beads present in each of the pegs(lines) of the abacus. i am trying to use 2 boolean methods: "boolean removeCounter(int thisPeg)" "boolean removeCounter(int thisPeg)" thisPeg - An integer that refgers to any of the pegs in the abacus Please can someone help me solve this? All i am trying to do is to recognise where possible errors may occur and prevent them from happening. E.G. if conditions are true then add one counter to the …

Member Avatar
Member Avatar
+0 forum 6

I don't quite understand how to make a Procedure as most of my processing takes place in my scripts. I have a set of 3 Queries that are almost identical that I would like to combine them to return a result set. The queries are: SELECT Date, Location, Sum(SubTotal) FROM data WHERE (Date between 20121211 AND 20121231) and Account_Number like '%cash%' group by Location, Date order by Date; SELECT Date, Location, Sum(SubTotal) FROM data WHERE (Date between 20121211 AND 20121231) AND Account_Number not like '%cash%' group by Location, Date order by Date; SELECT Date, Location, Sum(SubTotal) FROM data WHERE (Date …

Member Avatar
Member Avatar
+0 forum 2

[CODE] startup = 0 r = rock p = paper s = scissors if startup == 0: weapon = str(input("Please enter your weapon: Rock, Paper, or Scicors") while weapon =! r: print("Incorrect choice, please choose again")[/CODE] Im running python 3.2.2. Im trying to make rock paper scissors. I am trying to get the if statement to startup and print the str weapon. and within that i have a while loop (where the error is on the while) and i want that to print and loop back to the toop if something other than rock, paper, or scissors is inputted. any …

Member Avatar
Member Avatar
+0 forum 4

Im trying to write a program that inputs a single letter and prints out the corresponding digit on the telephone. Im having trouble finding out a way in which you can group the variables that have the same digit, but im not sure how. You guys have any suggestions? P.S. im running python 3.2.2 [CODE] A = 2 B = 2 C = 2 D = 3 E = 3 F= 3 G = 4 H = 4 I = 4 J = 5 K = 5 L = 5 M = 6 N = 6 O = 6 P …

Member Avatar
Member Avatar
+0 forum 2

So, I am fairly new to C++ programming, so if you can help me, please try to keep it simple...I'm still learning. What I'm trying to do is assign a score to a grade letter (A,B,C,D,F) and then display it. This is what I'm have: [CODE]string lettergrade1; string lettergrade2; if (s1score >= 0.90) { string lettergrade1 = "A"; } else if (s1score >= 0.80) { string lettergrade1 = "B"; } else if (s1score >= 0.70) { string lettergrade1 = "C"; } else if (s1score >= 0.60) { string lettergrade1 = "D"; } else { string lettergrade1 = "F"; }[/CODE] However, …

Member Avatar
Member Avatar
+0 forum 3

Hey guys. Im try to write a program with 3 major things which are two lists and a random. what i want to do is say whatever values are in those lists then produce so many random value if you get what i mean. so say list one value is 3, and list two is 4 than it should produce 12 random numbers. I hope this doesnt sound too complicated. The reason I want to do this is shorten the code as much as possible. Thanks

Member Avatar
Member Avatar
+0 forum 5

Dear All, I have data coming into my db at quite a high frequency. Once I recieve the data I have many different db operation (select, update)checking and one final insert. Before inserting I will check it exist before or not? The problem at times the similar data comes apart just few seconds. So I am worried the checking will miss because another insert have not been completed yet? Any suggestion?

Member Avatar
Member Avatar
+0 forum 8

I just need to have 3 basic problem statements on c programming that is related to the field computer engineering, computer science or electronics and communications engineering. Only 3, and i can sleep.. of course after coding. :) THANK YOU! ^_^ >:D<

Member Avatar
Member Avatar
+0 forum 5

I am converting seconds to minutes, hours, days. For some reason I have an issue with the days not calculating when running the program. The 'if' statement seems completely ignored by the program. I think this may be caused by the warning I get. Any help would be greatly appreciated in explaining the warning and my current issue: Warning: Constant is long in function main() [CODE] #include <iostream.h> //using namespace std; int main() { // Constants for Conversion int seconds, minute, hour; double day; cout << "Enter the number of seconds: "; cin >> seconds; day = seconds / 86400; …

Member Avatar
Member Avatar
+0 forum 18

Hi, I have gone over and over the subject and still confused. I currently develop in PHP 5.2.x along with MySQL. (awaiting host to upgrade to 5.3.x, hopefully not to long although on local i develop using php 5.3.5) Currently i use the standard MySQL functions in PHP like: [B]mysql_connect()[/B],[B] mysql_fetch_array()[/B],[B] mysql_num_rows()[/B], [B]mysql_fetch_row()[/B] etc. Now i want to improve on the above. I have MySQLi, PDO etc enabled on my local and web hosting server and was going to just change all [b]mysql_[/b] with [b]mysqli_[/b]. Then i started reading about PDO, OOP, Prepared Statements. Now i have no knowledge of …

Member Avatar
Member Avatar
+0 forum 2

Not sure if this is the right forum for SQL statement problems. I've searched all over but don't know how to output formatted SQL queries. Like Selecting the first letter of the first name and then last name with proper spacing.

Member Avatar
Member Avatar
+0 forum 3

[CODE] #include <iostream> #include <ctime> #include <cstdlib> #include <string> #include <algorithm> using namespace std; // Functions int instructions(); int game(); //Types and Arrays string word[] = {"GOLDFISH", "COMPUTER", "ANONYMOUS", "JACKET", "SHARP", "SERVICE", "EFFORT", "CHARACTER", "CHANGE", "WITHOUT", "PRODUCT", "UNFOLDS", "MUSIC", "MOMENT", "LIFETIME", "PROVIDE"}; char guess[50]; char inst[50]; int main() { cout << "\tWelcome to Word Jumble By Khoanyneosr!\n"; cout << "\nWould you like to see the instructions?" << "\n\t1) Yes = 1" << "\n\t2) No = 2" << "\n- "; cin.getline(inst, 50); bool done = false; do { switch(inst[50]) { case 1: instructions(); done = true; break; case 2: cout << …

Member Avatar
Member Avatar
+0 forum 2

The End.