SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist Alluvian's Avatar
    Join Date
    Jan 2007
    Location
    Orlando, FL
    Posts
    417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    query works in mysql, but failing in php. Need fresh eyes please.

    I have the following code in an admin page to replace an existing comic with an updated one.

    This is driving me nuts.

    Code:
    	$sql="update comics set location='$rootcomicname' where id=$comic_id";
    	echo "<br \>$sql<br \>";
    	$result=mysql_query($sql);
    	echo "<br \>query result is: $result<br \>";
    	if ($result){echo "New data successfully entered";} else {echo "Error entering data into database.";}
    I can take the echo from the $sql and paste that right into mysql via phpmyadmin and it works fine. An example $sql is:
    update comics set location='/comics/070218.jpg' where id=13

    The echo for the $result is nothing. Not sure if it is null or just empty. It evaluates as false in the if statement and the update is not performed when called in php.

    I am guessing this is something obvious like a typo?

    Any help? I keep staring at it and not getting it.

  2. #2
    SitePoint Evangelist Alluvian's Avatar
    Join Date
    Jan 2007
    Location
    Orlando, FL
    Posts
    417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    NEVERMIND!

    The problem was not in the code at all. The username i had logged in didn't have update priveledges. They had just about everything ELSE, but no update. Problem fixed, had nothing to do with php and I would have known that if I had been checking the errors.

    Sorry.


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
  •