This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
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 Head First Android this week in the Android 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: 71

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: 20
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
 
It's not a secret anymore!