File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to fetch single record from mysql database

 
shilpa deshmukh-kadam
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I want to get single record from my table.then I want to update it but by passing id I tried every option by google but error occurs

Which displays in textbox


but error is that

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in

and does not show result
can you help me?
 
Nick Charles
Ranch Hand
Posts: 71
Linux PHP Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are using mysql_query twice. Try this instead:


Also, are you certain that $catId contains a valid value to will be found? If not, $sql will be FALSE, which won't work with mysql_result().

Finally, what is $conid? That parameter will be ignored by mysql_query because there are no value placeholder in the query string. Also, passing $catId into the query string is security issue (sql injkection attack), you should use the mysql_real_escape_string() function - the see the example in the PHP docs: http://php.net/manual/en/function.mysql-query.php
 
Rahul Chandran
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use mysqli_query instead of mysql_query and the parameters passed to mysqli_query($database_connection, $query).
Have you tried that ?
 
shilpa deshmukh-kadam
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nick Charles wrote:You are using mysql_query twice. Try this instead:
..........


It works Thank you..!!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic