Have you tried this:
if (!$result) {
die('Invalid query: ' . mysql_error());
}
after the mysql_query line? $result should be a result set or FALSE, mysql_query doesn't return null.
Have you tried this:
if (!$result) {
die('Invalid query: ' . mysql_error());
}
after the mysql_query line? $result should be a result set or FALSE, mysql_query doesn't return null.
Your $result variable probably is false, which isn't a resource and so the fetch_array is failing. Check your query returns a result set and not an error. If it is failing to query I'm guessing $id isn't a value.
So, output the string that makes up the complete query to check for a syntax error or catch the error coming from the database.
If your HTML snippet is the same for all rows then each product has a label with a class of 'count'. Which means in your jQuery all of the labels get incremented as the jQuery is affecting all of then, not just the one beside the button you happened to click. Currently you have no way to inform the jQuery function which label it should be increasing.
You could give each label a unique name and pass that name into the function when you click each button. To do this you'd need to add an onclick to each +/- button which calls the function with the parameter.
As far as I know empty() only takes one variable. The error is complaining about ALL of the && in your code, not any particular one.
Based on this:
echo "1";
if(empty($imagetype)) return false;
your $imagetype variable is empty. Which comes back to this:$imgtype=$_FILES["uploadedimage"]["type"];
Check the actual values of those variables.
Can you put an echo after this line:if (!empty($_FILES["uploadedimage"]["name"]))
to prove this IF condition is being met?
Why are you doing it this way? If you want a particular employee and you're entering the name, why aren't you adding that information to the SQL query and retrieving just one row?
As it is, the code is failing on any employee beyond the first one because of the else statement you have. If the returned name doesn't match the entered name, which it won't for any query which doesn't use the first record's name, you show an error and break out.
You shouldn't be doing that, you're forcing your code to only run once through the reader.
I would suggest using the name in the SQL query as parameter. You're returning records that you don't need. And then you're allocating the returned data to variables before you know if you actually need it. If you want to keep the code you, fix the else problem and check for the name matching FIRST and then allocate data to variables if you have a match.
If I understand your question you want to insert a product into the products table and then, depending on whether it is an accessory or a smart device, also insert into the relevant secondary table.
So your secondary, subclass tables will have a productId column that matches the productId in the products table.
Insert a product into the products table and return the inserted productId. Use that id to do the insert into the secondary table. You now have a link between the two.
You can also add a foreign key constraint from accessories/smart devices to products with on delete cascade to keep your table integrity intact.
is that any help?
Your $dbhandle object doesn't exist. Is it being declared in the connect.php and are you referring to it by the correct variable name?
You have an extra ) after the '-1200'}
It looks like all you need the variable to hold the translated string as it is built up.
Define another string at the top and each loop through concatenate the translated pig onto it.
You can use the StringBuilder class for this rather than doing += on a string for a performance gain.
Exactly. It works like the zip or merge functions available in other languages, suching iterating throught the items in the object to be added and pushing them onto the add of the arraylist.
Auto increasing of the size of the arraylist is taken care of too so you don't need to worry about extending the arraylist past it initialised size before calling addRange.
Your user control just needs to include a picture box for you to pass the image url to. Or am I missing something?
The AddRange function simply adds all of the objects in the added range to the arraylist. In your example, your arraylist would contain three items accessible at positions 0, 1 and 2.
Think of it in terms as appending the array to the arraylist, it just gets tacked on the end.
Assuming you have the user name stored in a variable do a SELECT against the database
SELECT username FROM table_name WHERE username = ' . $username . ';'
I'm not sure what PHP version or framework you're using so the method of runnign the query and checking the result will vary but once you have a result check the value against $username. Based on the result, redirect as needed
$result = .. do query with PDO, ORM or whatever is workig in your situation
if($result[0] == $username) {
$url = user exists page
} else {
$url = user doens't exist page
}
header('Location: '.$url);
This is some pretty rough pseudo code but it should be enough to give you an idea.
The parentheses is the problem. Your statement is trying to provide everything in the select statement as one column which means the total number of columns doesn't match.
Something like this will work:
insertString = "INSERT INTO SocialHistory (ExamID, Occupation, SafetyYN, ComputerYN, ComputerHrs)
SELECT " & CurrentExamID.ToString & " AS ExamID, Occupation, SafetyYN, ComputerYN, ComputerHrs FROM SocialHistory
WHERE ExamID = '" & LastExamID & "'"
Feed everything you want to insert into the SELECT statement, use AS to match discrete values to their column in the destination table and everything should work out OK.
You simply need to do a query to the table searching for that user name. If one row is returned then they have already created their account so redirect to the update page. If no rows are returned, they don't exist in the database so redirect to the insert page.
So,on the link click run a SELECT statement with the user name as a parameter. The result tells you which option you redirect to.
Try using the CAST or CONVERT functions of sql:
CAST(column_name AS INT)
Of course, your VarChar column needs to be all numbers for it to work.
It comes down to how the compiler reads and interprets your code. By defining different symbols for different things the compiler can infere what action you are trying to do. If you have done a course on compilers you would have used similar structures to tell your compiler how to handle certain lines in your code and branch appropriately.
But your final points are correct. Those structures do the things you describe.
Way back I self taught myself some Java as a start point (but never got very good at all). My first university course used Delphi. Then I taught myself VB.Net, and then C#, while my uni courses went over Java/Objective C/Android and a little bit of prolog/haskell
This youtube link popped up in my 'what to watch' feed the other day and maybe of interest to you. It pretty much answers your question (I think, I didn't watch much of it), I think it would be useful for someone starting out,
Click Here
My take is that, for knowledgeable web users, the https and the lack of warnings is a sign of trust. Your self encrypton method, while it would be valid if done right, is invisible to the user. they wouldn't know what was happening in the background and so your website LOOKS unsecured.
It should be fairly understandable if you buld the string yourself, keeping track of x at the same time but I'll try to give a coherent explanation.
On the first loop x == 0
an A is always added so "a" becomes the first letter.
X < 1 so a space is added : "a "
An 'n' is always added: "a n"
Only the x < 1 if statement is called as x == 0 so oise is added: 'a noise '
Second loop, x = 1
an 'a' is always added: 'a noise a'
an 'n' is always added: 'a noise an'
the only if statement to fire is x == 1 so noys is added: 'a noise annoys '
Third loop x == 2
add an a
add an n : 'a noise annoys an'
x > 1 if statement adds 'oyster' : 'a noise annoys an oyster'
x increments to 4 so loop exits
Does that help?
Say you have a static variable, counter, in your class and a method that incremented and displayed counter. You then create two instances of the class, X and Y.
Calling x.increment() will output 1. The static variable becomes 1.
Calling y.increment will output 2 because it accesses the same static variable counter e.g. the variable accessed and incremented by X is the same variable accessed and incremented by Y.
Hence, you can never have 2 versions of counter. It will be shared across all instances of the class regardless of how many you create.
Does that help?
An IF statement by itself won't direct your code to the exception because failing the IF statement isn't an exception. You need to THROW the exception but not quite as you have it there. You want to throw the exception if the IF statement fails.
$query is not a string, it is a mysql_query so your concatenation isn't working as you would think.
Build your string and then create your query.
$select = "SELECT M.msg_id, M.uploads, M.message, M.description, M.type, M.text, M.views_count, U.username, C.name as country_name FROM users AS U INNER JOIN messages AS M ON U.uid = M.uid_fk INNER JOIN head_networks AS H ON M.network_id=H.network_id LEFT JOIN countries AS C ON M.country_id=C.country_id WHERE M.type='A' ";
$Order = " ORDER BY M.message ASC";
$query = mysql_query($select . $Order);
The world bank data file says 0.51 hectares per person for the US so times that by 10 million and convert to km2
Yeah, I tried a range of standard start pages (index & default) with a host of extensions but got 403 for all of them. It looks like you have no start page defined. Try browsing to page URL you know exists and see if it displays.
You can stand comic sans...?
If we're doing this, can I put in a vote for Calibri, always liked it :)
As I mentioned in your other post, use the exception object to determine the ACTUAL reason for the error (located by looking at ex.Message).
It will, normally quite clearly, point you to the exact problem.
Alternatively, step through your code in debug mode and see which line of code causes the crash.
I've just gone over your code properly and it could use a couple of pointers.
1) You're putting user input directly into you sql query. Bad idea, use parameters instead.
2) You check for whether the user name and password have been entered AFTER trying to get a result from the database
Neither of those things would cause the code to crash though.
Well, getting the actual error message would be a fantastic place to start.
Change this:
catch ex As Exception
MessageBox.Show("Please exit system and login again.", "Login Error", MessageBoxButtons.OK)
End Try
To
catch ex As Exception
MessageBox.Show(ex.Message, "Login Error", MessageBoxButtons.OK)
End Try
This will give you the real reason for entring tha catch block and we might be able to figure it out.
You mean wish to apply WHERE gender != 'M' right? So males are not included in the query?select section_no,max(age) as 'Maximum Age' from table1 WHERE gender != 'M' group by section_no
OK, catch the actual exception, ex.Message, and see what that says.
Naturally, "please exit system..." is the error message you supplied.
Out of curiosity, have you had any luck with this? I'd be interested to know what affected the mouse on another computer when you ran your program.
As Ketsuekiame asked, what runtime errors are you getting?
OK, as a test, can you alter the html property in the css file so the background image isn't a part of it, change the colour instead. That way we'll know if the image is the issue or the html selector itself.
Of course, strip the color from the body selector too...
I doubt your image dir is inside your styles directory in that case.
Change tobackground: url(../images/ralnabg.jpg) no-repeat center center fixed;
You need the ../ to revert out of the styles folder and locate the images folder.
Are you getting any errors when you run it and, if so, what are they?
The background property is a shortcut to combine all background commands into one, as opposed to having a background-color and a background-image.
So you are setting a background-color and then using the background: to say you don't want a color.
try:
background: #3d3d3d url(../images/first_section_bg.jpg) no-repeat center center;
May be obvious but need to ask: is your CSS file in the same directory?
Remove the var key word from line 5. You don't want to to be specifying a new version of X, just reset the existing x variable.
For a start you database design could be better. You should have a table for employees, a table for department and a linking table that holds just employee IDs and department IDs to show who is in what.
emp (id, name)
dep (depid, dep_name)
emp_dep(empid, depid)
Now you join all three (if you want to search by name) or just emp and emp_dep if searching by depid is enough and you can use NOT IN or something similar to separate out your employees.
Have you checked your extension_dir setting in the config file? It may be making PHP look in the worng location for extension modules.
Otherwise, I got nothing...
Any information about what goes wrong, displayed behaviour or error messages, would help us out a little.
Can't be that awake, you didn't read my first post ;)
Brandy1, I really can't see what is causing the problem. I have looked at the PDF and gone through it but there isn't any cause for the doubling that I can see. Can you confirm the PDF is the actual code you are using? Maybe re-post the actual code so we stop getting confused.
In the sample you posted above you aren't calling getExamGrades at all so dblMidTerm and dblFinal never change from zero. You then pass 2 zeros into CalculateTotalAverage and get nothing back.
You are calling getExamGrades in the PDF though.
I think it may be because FROM and TO are reserved words. You need to delimit them as you have Sheet1$. Or rename your columns because that'll catch you out time and again...
OK, so you don't have a problem then? Is there anything going wrong or did you just post a code snippet?
Oh wait, I see. Your <option> isn't displaying correctly is it?
you need to echo the actual option tag as well or you're just printing rows to the page as text.
echo '<option>'. $row['name'] . '</option>'
You pretty much have it correct. If no data lends itself to being a natural key (i.e. nothing int the data is unique across rows) a surrogate key needs to be supplied.
If you created a id column using [int auto_increment primary key] then you have a surrogate key because, although the column uniqiuely identifies each row, it has no real world realtionship with the data.
Using unique 'business' data means you are using a natural key e.g. social security numbers in a payroll database