SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem With MySQL and PHP coding

    Heres my script

    http://www.coldbloodedkillerz.level6...ustyscript.txt

    Heres my Error

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/kamakasi/public_html/gffix/test_store.php on line 71

    I dont know what is wrong with it can anyone help me? or fix what is wrong please

    thank you

    kamakasi

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,241
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by kamakasi
    i liked this part --

    //End of that. tehehe, that was simple enough. ///

    run your queries one at a time outside of php to find out what the error is
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    r937 do u have aim to help me more im kinda a n00b

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i just dont understand how to run seperate queries can you help me out more?

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,241
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by kamakasi
    i just dont understand how to run seperate queries can you help me out more?
    get yourself a front end tool like phpmyadmin, mysql query browser, sqlyog, or similar

    paste the first query in the script into the sql window:
    Code:
    select * from equipment1 where id='$is'
    replace any php variables with known actual values::
    Code:
    select * from equipment1 where id= 37
    see if it runs

    repeat for each query in the script
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  6. #6
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your error message means that no results are being returned from your queries. Most likely because of an error in your php coding.

    Rather than point a link to your entire document, it is generally best practice to post your code that is relevant to the error message, in this case, only the query itself needs to be posted.

    Put some error checking into your code to make sure that any variables that you are passing to your sql are actually being passed correctly. if they aren't that is what is generating the error message.

  7. #7
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MySQL said: Documentation
    #1054 - Unknown column '$cost' in 'order clause'

    thats what error i got when i put tihs in

    select * from equipment order by $cost desc

  8. #8
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    all of this is giving me errors

    mysql_query("select * from equipment order by 'cost' desc");
    while ($wep = mysql_fetch_array($wep)) {

  9. #9
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,241
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    try this:

    select * from equipment order by cost desc
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  10. #10
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    r937 can u tell me basically whaat this is saying

    mysql_query("select * from equipment order by cost desc");
    while ($wsel = mysql_fetch_array($wep)) {
    $cost=to_money($wsel[cost]);
    $atk=to_money($wsel[power]);

  11. #11
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,241
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    why me? sorry, i don't do php

    would you like this thread moved to the php forum?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  12. #12
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh my bad yes please didnt even notice see my BIGGEST problem is, is some kid wrote this for me and i cant get ahold of him so im trying to fix it

    and beacsue you are guru consultant of 2005 :-) YOU GOT MAD SKILLZ


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •