Jump to content

chester600

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

chester600's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [quote author=alpine link=topic=120176.msg492736#msg492736 date=1167332641] The code doesn't run fine, you're just removing the error message it gives. The error is still there. In general you should be careful with what you are surpressing, you won't discover what is wrong. http://no2.php.net/manual/en/language.operators.errorcontrol.php [/quote] When I say it runs fine I mean it runs as I wanted it to.....although I expect there are still errors, I just cant see them.
  2. [quote author=onlyican link=topic=120176.msg492733#msg492733 date=1167332297] You need to connect to the database first Putting an @ there, meens, Dont Show Error, so its not working $db = mysql_connect("localhost","username","password"); mysql_select_db("DB_Name", $db); Change the information to be correct with you. [/quote] Sorry forgot to say I have done that. I also get it when using mysql_fetch_array and mysql_num_rows. It those cases it comes up telling me that they are not valid MySQL resources or something. Thanks.
  3. I am having trouble with a bit of code I am writing and am hoping for some help. I am writing a script which recieves data from a MySQL DB. I have written my query like this: [code]$query = "SELECT * FROM users";[/code] Then to run the query I have written this: [code]$result = mysql_query($query);[/code] Now when I run this code I always get this message in my browser: [code]<b>Warning</b>:  mysql_query(): Access denied for user 'nobody'@'localhost' (using password: NO) in <b>/home/dartscou/public_html/results/search_results.php</b> on line <b>46</b><br />[/code] However if I put @ before mysql_query the code runs fine. Is it secure to do this or is there something else I am doing wrong???? Thanks in advance!!! James
  4. [quote author=redarrow link=topic=105859.msg423007#msg423007 date=1156717980] change char to int then try your statement. [/quote] Brilliant!!! Worked perfectly.....thanks  ;D
  5. [quote author=thorpe link=topic=105859.msg423002#msg423002 date=1156717562] What filed type is age? [/quote] It is char. Thanks for your reply redarrow but that still gives the same output  :(
  6. Hey all! I am quite new to php/MySQL and have hit a problem during learning them. I have created a table in my database that holds a user_id and the users age, which looks like this: [table] [tr][td][b]user_id[/b][/td][td][b]age[/b][/td][/tr] [tr][td]1[/td][td]56[/td][/tr] [tr][td]2[/td][td]70[/td][/tr] [tr][td]3[/td][td]17[/td][/tr] [tr][td]4[/td][td]67[/td][/tr] [tr][td]5[/td][td]72[/td][/tr] [tr][td]6[/td][td]60[/td][/tr] [tr][td]7[/td][td]99[/td][/tr] [tr][td]8[/td][td]100[/td][/tr] [tr][td]9[/td][td]98[/td][/tr] [tr][td]10[/td][td]200[/td][/tr] [/table] Now when I use this query in php: [code]$query = "SELECT user_id, age FROM members ORDER BY age DESC";[/code] I get the following output: [table] [tr][td]user_id[/td][td]age[/td][/tr] [tr][td]7[/td][td]99[/td][/tr] [tr][td]9[/td][td]98[/td][/tr] [tr][td]5[/td][td]72[/td][/tr] [tr][td]3[/td][td]70[/td][/tr] [tr][td]4[/td][td]67[/td][/tr] [tr][td]6[/td][td]60[/td][/tr] [tr][td]1[/td][td]56[/td][/tr] [tr][td]10[/td][td]200[/td][/tr] [tr][td]2[/td][td]17[/td][/tr] [tr][td]8[/td][td]100[/td][/tr] [/table] For some reason 200 is being treated as < 56 and 100 as < 17. Anyone have any ideas why this would be???? Thanks in advance! Chester600  :)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.