Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

how to fetch single record from mysql database

 
Ranch Hand
Posts: 38
  • 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?
 
Ranch Hand
Posts: 71
PHP Linux Windows
  • 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
 
Greenhorn
Posts: 20
  • 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
  • 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..!!
 
The only thing that kept the leeches off of me was this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic