dhanesh1405241511
-
Content Count
430 -
Joined
-
Last visited
Posts posted by dhanesh1405241511
-
-
LOL omkar .. true but hard to believe, I'll kill someone if they dont understand what i teach .. lol . I am a really impatient tutor. Guess i have to be working on my teaching skills from now. hehe .. As for Part 3 .. Its all yours, really .. I havent started yet .. so whenever you get time .. go on and complete whatever i have missed out. Its not easy to complete C in 2 parts true, so i hope you will add up a few pointers for us then .. Thankx for your comments.RegardsDhanesh.
-
Ok, well here is the Second part of the tutorial i promised.
Operators & Expressions in C
Introduction
Arithmetic Operators Unary Operators Relational and Logical Operators Assignment Operators Conditional Operators Arithmetic Operators
+ : Addition : subtraction * : Multiplication / : Division % : Modulus The operands must represent numeric values Eg : Integer, Floating, or characters – C character set % : Both operands must be integer and second one nonzero. / : Second operand must be a Nonzero. Both operands are integers then referred to as integer division Operation is carried by two floating values then Floating point division. If one integer and the other float then the result will be floating quotient. Type Cast : Converts the value of an expression to a required data type if needed.
Syntax ( Data type) Expression
Eg. ((int)%4
Unary Operator:
Eg: ++a, a++
Decrement Operator --: Decrements the value in the operand by oneEg. : --a, a--.
sizeof : returns the size of the operand in terms of bytes. And is always preceded by its operand. Eg. Printf( “THE SIZE OF VARIBALE A IS : %d”, sizeof a);Relational and Logical Operator:
Relational Operators :
<= : Less than or equal to >= : Greater than or equal to > : Greater than < : Less than == : Equal to != : Not Equal to Logical Operators : && - and : Both the conditions should hold true || - or : Either one of the condition should hold true for the action to be performed. Assignment Operators : They are used to form an assignment expression It would assign a value of an expression to a identifier. Types : = += -= *= /= %= Conditional Operator : Used for carrying out conditional operations – ( ? : ) Syntax : Expression 1 ? Expression 2 : Expression 3 Eg. i=10ans= (i<=10) ? 0 : 1
Yeap, well that wraps up the Conditional Operators topic. As suggested, i would post some examples of code later on, but till then you could go through these basic guidelines and perfect them. Hope this helped
Regards
Dhanesh.
-
Just thought u should know .. even tho you have 50 Points .. and are in the intension that 30 will get deducted, this doesn't happen. ALL your 50 points get deducted. So make shure you are active in the forums. And best of luck for your hosting :unsure:RegardsDhanesh.
-
Its done ! .. finally .. well atleast the coding part .. so here is the source for the 2 files .. all you have to do is the design part .. and guess most of us can manage that ..
I would suggest the mods to rename this post as: Using PHP to connect to a MySQL DB and show Values.
2 Files : index.php & studmark.php
index.php
<html><head><title>Enter ID</head><body><form id="getinfo" name="gi" method="post" action="studmark.php"> Please Enter Your ID Number: <input type="text" name="id"> <input type="submit" name="submit" value="Submit"></form></body></html>
studmark.php<html><head><title>Student Mark</head><body> <?php$conn = mysql_connect('localhost', 'dhanesh_admin', 'admin');if (!$conn) { die('Not connected : ' . mysql_error());}$db = mysql_select_db('dhanesh_studentdb', $conn);if (!$db) { die ('Can\'t use foo : ' . mysql_error());}$id = $_POST["id"];$query = "SELECT * FROM `marks` WHERE id = ".$id;$result = mysql_query($query);if (!$result) { die('Invalid query: ' . mysql_error());}if (!isset($_POST['submit'])) {} else {if(empty($id)) {echo "You did not fill in all the fields, try again<p>"; ($_POST['submit']);}else {echo "Here are Your Results, $id";}} echo "<TABLE>IDNameMarks";while ($row = mysql_fetch_assoc($result)) { echo "<TR>"; echo "<TD>".$row['id'].""; echo "<TD>".$row['name'].""; echo "<TD>".$row['marks'].""; echo "</TR>";}echo "</TABLE>";?></body></html>
Last but not the least, I would like to thank miCRoSCoPiC^eaRthLinG & Vyoma for their help in making MOST of this script.Regards
Dhanesh.
-
But I thought you wanted to get the details of only one student, as requested from 'ID'?
First off thankx .. and i will right away give this code a try .. well what u say is tru i NEED to give an ID input and get the values from the DB for that specific ID ... but since i dont know anything regarding the PHP and SQL relation .. i thought of learning it while i make the script .. Tho you guys are doing more than half the work here lol .. but it really is helping me out.
Once i get this script to show the values in a table .. THEN, i will be modifying .. to give values and get results ..
Regards
Dhanesh.
-
With the help of m^e .. who did 100% of the code lol .. this is how i got to SHOW values from a MySQL DB to a PHP file.
index.php
<html><body><?php$conn = mysql_connect('localhost', 'mysql_user', 'mysqlpass');if (!$conn) { die('Not connected : ' . mysql_error());}$db = mysql_select_db('mysql_dbname', $conn);if (!$db) { die ('Can\'t use foo : ' . mysql_error());}$result = mysql_query('SELECT * FROM `marks`');if (!$result) { die('Invalid query: ' . mysql_error());}while ($row = mysql_fetch_assoc($result)) { echo $row['id']; echo $row['name']; echo $row['marks'];}?></body></html>
Result : 2006001John202006002Gavin402006003Ter322006004Mac46
Now i just need to beautify the results to show properly. Will post up when i m done with that too.
If you have problems making a MySQL DB .. please refer to m^e's first post in this thread.
If anyone could pass on some ideas on how to put these values in a table format, it would be helpful ..
Thankx m^e
Regards
Dhanesh.
-
Sorry bro .. i was posting while u posted .. newayz .. thankx for letting me know about the 1 step bulk queries .. my first step to enlightnment .. hehe .. Now since thats done .. i gues the sql part is over .. now the only thing left is the PHP part rite ? RegardsDhanesh.
-
Since my earlier try with using access went wild .. i decided to choose MySQL as my DB and PHP as the code .. so just changing a few things in my earlier post .. for the new people ..
Now .. i did a little self learning experiment with MySQL as suggested by vyoma ..ok .. i have this little problem i am going through ... Leme explain this project of mine first .
I have a MySQL DB of student fields like ID no, Name, Marks .. etc .. This one MySQL DB would be updated by just adding more rows and would be done on the server.
Now .. I have a HTML page that shows this :
I would enter the ID number of a student (no authentication .. anyone can access anybodys marks), and when i hit submit .. I would be taken to a page that gets the values from the ID specified and shows it in the next page. The page design would be the same .. just the values comming in will depend on the ID number inputed in the previous screen.
The result should be something like this :
Is it possible to make a system like this ? To test this .. i will be using my own asta account .. so i guess if it works here .. then this system can be accessed from anywhere. I'd preffer HTML .. but since HTML doesnt allow dynamic updating .. i am fine with PHP. But it would be nice if someone helped me out with this.
I think ..
Page1 : Enter ID ---> HTML
Page2 : Show results ---> PHP
Hope i didnt confuse, if so please let me know .. i'll try to explain in a better way if i can.
1) Created a DB in MySQL: dhanesh_studentdb
2) Created a user with pass: password / password
3) Went to the SQL Query and typed in this :
CREATE TABLE `marks` (`id` INT( 10 ) NOT NULL ,`name` VARCHAR( 30 ) NOT NULL ,`marks` FLOAT( 5 ) NOT NULL) ENGINE = MYISAM COMMENT = 'Student Marks';
4)
ALTER TABLE `marks` ADD PRIMARY KEY ( `id` )
5)
ALTER TABLE `marks` CHANGE `name` `name` VARCHAR( 30 ) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
6)
INSERT INTO marksVALUES ( 2006001, 'John', 20 );# Affected rows: 1INSERT INTO marksVALUES ( 2006002, 'Gavin', 40 );# Affected rows: 1INSERT INTO marksVALUES ( 2006003, 'Ter', 32 );# Affected rows: 1INSERT INTO marksVALUES ( 2006004, 'Mac', 46 );# Affected rows: 1
7) The result looks like this :8) I made 2 PHP scripts .. 1 to input ID and show Id on the next page .. here is the code for index.php
<?php$id = $_POST["id"];if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form} else { if(empty($id)) { echo "You did not fill in all the fields, try again<p>"; } else { echo "Thank you, $id"; } } ?><html><head><title>Marks Example</head><body><form method="post" action="ID Number:<input type="text" size="12" maxlength="12" name="id"><input type="submit" value="submit" name="submit">
9) Then i made a page to retrive values from the DB i created and show in the SQL page .. no ID input .. nothing .. just to show the values .. This is the code for index.php3<html><body><?php$db = mysql_connect("localhost", "root");mysql_select_db("marks",$db);$result = mysql_query("SELECT * FROM marks",$db);printf("ID: %s<br>\n", mysql_result($result,0,"id"));printf("Name: %s<br>\n", mysql_result($result,0,"name"));printf("Marks: %s<br>\n", mysql_result($result,0,"marks"));?></body></html>
With this code i get the following error :[b]Warning[/b]: mysql_connect() [[color="#3333ff"]function.mysql-connect[/color]]: Access denied for user 'admin'@'localhost' (using password: YES) in [b]/home/dhanesh/public_html/testfinal.php3[/b] on line [b]13[/b] [b]Warning[/b]: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in [b]/home/dhanesh/public_html/testfinal.php3[/b] on line [b]17[/b] [b]Warning[/b]: mysql_query(): supplied argument is not a valid MySQL-Link resource in [b]/home/dhanesh/public_html/testfinal.php3[/b] on line [b]21[/b] [b]Warning[/b]: mysql_result(): supplied argument is not a valid MySQL result resource in [b]/home/dhanesh/public_html/testfinal.php3[/b] on line [b]25[/b] ID: [b]Warning[/b]: mysql_result(): supplied argument is not a valid MySQL result resource in [b]/home/dhanesh/public_html/testfinal.php3[/b] on line [b]29[/b] Name: [b]Warning[/b]: mysql_result(): supplied argument is not a valid MySQL result resource in [b]/home/dhanesh/public_html/testfinal.php3[/b] on line [b]33[/b] Marks:
What am i doing wrong .. could someone make me a file so i could use it as reference and continue building up ..Thankx ..
Regards
Dhanesh.
-
Ok well i decided to go with PHP since access was not a good idea ... i created a few things in php and mysql .. but it shure hell is driving me nuts .. will post a new topic with my experiments :unsure:RegardsDhanesh.
-
I have bpth betas, and they both accept either kind of user as a contact. But WLM never shows the yahoo contatcs as online, and it's a fifty-fifty shot as to whether or not it works with yahoo! and the WLM users. Any ideas?
~Viz
Viz .. did ya sign up for the beta ? (check the link in my previous post) .. i tried it and it works just fine .. i can see my self on yahoo and chat to myself .. plus its pretty fast ..
Regards
Dhanesh.
-
With much due respect (which by the way, u didnt have) , it wasent a double post with an intention to spam. A double post is considered ONLY if someone makes a consecutive post in a span of say 1 hr or 2 .. depending on the forum rules.
Now, for the post you made, it was EXACTLY the same thing i asked as a question. I know how it would work, I just need some code to get me started. And yes, i have gone to php sites and searched for this, but i was unable to get a decent tutorial.
Well, so next time please do not repeat the posts in your own words to gain points ..
Regards
Dhanesh.
Edit: I know it can be done in MySQL, and i have a working model, but my specifics include an MS Access DB
-
Thought this was worth an add to the forums ... have a look at this youtube video link ... I wished i had one of these for a test drive
Regards
Dhanesh.
-
Arggggg ... Is the no one who can help this little code troubled .. frustrated .. irritated .. kid ! :unsure:RegardsDhanesh.
-
Google Earth .. Google Earth .. Google Earth !! .. give google a break guys .. i kinda hate the extra space fillup on my HDD .. so i settle in with wikimapia .. hehe .. but god damn ! bombay was not shown atleast 2 weeks b4 .. but kerala was freegin clear .. wonder how many mallus are there in google
Regards
Dhanesh.
-
ok .. i have this little problem i am going through ... Leme explain this project of mine first .
I have a MS Access DB of student fields like ID no, Name, Marks .. etc .. This one Access DB would be updated by just adding more rows and would be done on the server. It looks sumthing like this:
Now .. I have a HTML page that shows this :
I would enter the ID number of a student (no authentication .. anyone can access anybodys marks), and when i hit submit .. I would be taken to a page that gets the values from the ID specified and shows it in the next page. The page design would be the same .. just the values comming in will depend on the ID number inputed in the previous screen.
The result should be something like this :
Is it possible to make a system like this ? To test this .. i will be using my own asta account .. so i guess if it works here .. then this system can be accessed from anywhere. Secondly, what language would be used ? HTML, PHP or ASP .. i'd preffer HTML .. but since HTML doesnt allow dynamic updating .. i am fine with PHP. But it would be nice if someone helped me out with this.
I think ..
Page1 : Enter ID ---> HTML
Page2 : Show results ---> PHP
DB : MS Access ..
Hope i didnt confuse, if so please let me know .. i'll try to explain in a better way if i can.
Regards
Dhanesh.
-
Is this legal ? .. I guess not ..
-
Looks nice .. but kinda reminds me of the halo logo .. with a little motion filter and black n white .. newayz nice one ... show us more ..RegardsDhanesh.
-
Hehe .. i was also trying to pass time in office .. so herez a modified version of ur clan logo ..
Regards
Dhanesh.
-
I have uploaded say phpbb on the server .. and i want to see how much size it is ( i know i can do that on windows) but i want to check the folder size AFTER i add images .. tweaks .. posts .. etc to it .. i want too what size the folder would be .. how do i check that ? .. any free software or cpanel could help me ?RegardsDhanesh.
-
Hell yeah .. the site mentioned by this dude .. gives every ADSL driver available ... and there is a one for SuSe too .. i'll try this out and let u know abt the results .. just hope its an install and run only .. RegardsDhanesh.
-
Well .. seems like M$ was serious about the number of people signing up for this. If you did then fine ... but if you didnt, then i suggest you do so soon cause M$ would shut down registrations on a limit of 500,000 users .. Hey jo .. want me to add u up with your yahoo account ? .. RegardsDhanesh.
-
Ok .. my question .. would linux support my ADSL modem ? .. i have suse installed on my laptop .. but never had the guts to connect to the internet .. fearing that my system might not be safe and tweaked enuf to go on the WWW. Wouldent go full fledged unless i know my system right. I have never gone nor bothered to see if my modem would install .. but in future .. if i need .. would it be possible ? .. i own a lucent cell pipe 20A usb modem .. Regards Dhanesh.
-
Ok .. i dont mean to mislead you .. so first off .. I havent tried nor looked at bootcamp work .. But y would you want to install XP on a mac system ? I mean .. WHY ! for the love of god ! lol .. i just got carried away there .. but seriously .. do u really wana infect ur system with bugs and stuff from windows ? I mean all those viruses comming in through windows .. u know .. Damn .. did i scare you ? .. lol .. newayz .. point is .. if you want to test windows on your mac .. its a cool thing to do .. i would have done it .. but if your gona use it for a prolonged period of time .. then dont .. its just the Mac thing .. use the system for what its originally made for. I would freak out if i see someone using a powerbook with windows XP installed lol .. Happy testing .. ohh and if you get tru installing Linux .. please let us know .. :DRegardsDhanesh.
-
I have some questions.
Dont you want that banner of yours to be clickable? If yes, then I think you should put the URL in the code:
<a href=''> part. The single quotes '' should contain the URL.
And one more major doubt that arises when I checked the source of your page in an text editor is this:
Should not the table code be put at the begining of the <body> </body> block? Why do you have it in the <head> </head> block.
More over, if you want just a banner in the center, you do not need to put all those table stuff.
All you need to do is put <center><img></center> whereever (in this case, just after <body> ) you want to show the banner.
dhanesh, if it is still not clear, then do respond with your doubts and I would clear it out. Also you I think all the HTML could be cleaned up and leaner code can be used to get the same effect.
Yeahhh .. thankx man .. lol .. i keep f'getting that tags in HTML should be closed properly .. hehe .. i feel so dumb ! ..Newayz .. about your questions ..
<a href=''> I duno how and y .. but maybe some of the members might give an explaination to this .. but leaving it like this ALSO links to the homepage .. i guess the "" by default reditects to the main page.
Actually, i normally put the header related codes in the HEAD block .. i dunt think it makes a difference anyways .. or does it ? geezz .. complicated stuff never runs tru me ..
And for the center part .. ur code was right .. it just had to be put between the correct tags .. thankx for the help .. its done now .. >>LINK<<
Regards
Dhanesh.
[tutorial] Basics Of C Programming - Part 2
in Programming
Posted · Report reply
Aha .. the Hobbes of asta .. long time indeed, where have u been bro and how've you been ?. Seems like you were bz with ur website. Best of luck for that share it with us sometime ..
I think the best people to answer this would be people who are INTO programming. But lets see, by learning C / C++ which are the foundation of any programming languages today, you would be able to design/program applications flexibly. Visual C++ is a form of basic command C/C++, just with a pretty GUI and with the title of M$, i have seen people who prefer the basic C/C++ more to the Visual C++. One major difference would be the syntax, Different programming languages have different syntax, but its easy to cope up when you are fluent with 1 basic language.
I love to work on Visual Basic, and to be honest, i have to be changing that, cause tho VB might seem easy with GUI and stuff, its not so flexible as command C/C++ ..Hope you get the basic point .. Anyone else who can elaborate on this is welcome ..
Hope you see more of you around Hobbes ... lol
Regards
Dhanesh.