File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes PHP and the fly likes how to fetch single record from mysql database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » PHP
Bookmark "how to fetch single record from mysql database" Watch "how to fetch single record from mysql database" New topic
Author

how to fetch single record from mysql database

shilpa deshmukh-kadam
Ranch Hand

Joined: Jun 01, 2012
Posts: 38
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

Joined: Oct 09, 2011
Posts: 70

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

Joined: Oct 14, 2010
Posts: 18
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

Joined: Jun 01, 2012
Posts: 38
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
 
subject: how to fetch single record from mysql database
 
Similar Threads
Hibernate self referential interigity
i need help on loggin account limit
Javascript and PHP
How to save value selected from dropdown list using PHP
Getter methods -- I don't get how to do it properly