Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: update

  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    Regina, Saskatchewan, Canada
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    update

    update $category set name=$name , image=$image , price=$price , stock=$stock , description=$description where name = '$name'

    Obviously there is something wrong with that query, can anybody spot it?

    Thanks!
    Jared

  • #2
    Regular Coder
    Join Date
    May 2002
    Location
    London, England
    Posts
    369
    Thanks
    0
    Thanked 0 Times in 0 Posts
    update '$category' set name='$name' , image='$image' , price='$price' , stock='$stock' , description='$description' where name = '$name'

    Hope this helps mate

    Jee
    Jeewhizz - MySQL Moderator
    http://www.sitehq.co.uk
    PHP and MySQL Hosting

  • #3
    New Coder
    Join Date
    Jul 2002
    Location
    Regina, Saskatchewan, Canada
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for helping, but it still doesn't seem to work.
    Jared Brandt
    IKinsler

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    You will need to be more descriptive of what's not working. Is is generating an error? Is the query running and the fields not being updated?
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #5
    New Coder
    Join Date
    Jul 2002
    Location
    Regina, Saskatchewan, Canada
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if (mysql_query("my query is here")) {
    echo "yes";
    } else {
    echo "no";
    }

    It returns no.
    Jared Brandt
    IKinsler

  • #6
    Regular Coder
    Join Date
    May 2002
    Location
    London, England
    Posts
    369
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try this and paste the results
    PHP Code:
    if (mysql_query("my query is here")) { 
    echo 
    "yes"
    } else { 
    echo 
    "no<br />".mysql_error(); 

    Jee
    Jeewhizz - MySQL Moderator
    http://www.sitehq.co.uk
    PHP and MySQL Hosting

  • #7
    New Coder
    Join Date
    Jul 2002
    Location
    Regina, Saskatchewan, Canada
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You have an error in your SQL syntax near ''' set name='Matrix' , image='' , price='2.00' , stock='No' , description='The p' at line 1

    Could it be that I want the image to be blank?
    Last edited by IKinsler; 07-31-2002 at 05:33 PM.
    Jared Brandt
    IKinsler

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No, that shouldn't bother MySQL. Far more interesting is what is contained in $category at the time you send your query. Put your query string in a variable like $sql and echo it so you can see for yourself if the value is valid.

    I don't know exactly if that's important, but I don't use single quotes (') around my table name... though I don't know if they're allowed or not, but the documentation doesn't use them either.


  •  

    Posting Permissions

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