473,387 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

retrieving data from database

Raju B
11
Hi friends..
i had written php code for fetching data from mysql database(windows).
but it showing some error like:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:\wamp\www\getapplication.php on line 13.

Actually i have to print all the coloumns in that table.
please go through my code.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $db=mysql_connect("localhost","root","root");
  3.  
  4. if (!$db)
  5.   {
  6.   die('Could not connect: ' . mysql_error());
  7.   }
  8.  
  9. mysql_select_db("apppack",$db);
  10. $query  = "SELECT * FROM application ORDER BY id DESC LIMIT 10 ";
  11. $result = mysql_query($query);
  12.  
  13. while($row = mysql_fetch_array($result, MYSQL_ASSOC))
  14. {
  15.  
  16. echo ($row['appid'].$row['appname'].$row['appdescription'].$row['categoryid'].$row['version']. $row['jadfilename'])."</br>";
  17.  
  18.  
  19.  
  20. }
  21. mysql_close($db);
  22.  
  23. ?>
  24.  
Aug 18 '10 #1
3 1345
zorgi
431 Expert 256MB
Check if the name of your database is correct at:

Expand|Select|Wrap|Line Numbers
  1. mysql_select_db("apppack",$db);
  2.  
Aug 18 '10 #2
Raju B
11
thanks for your reply.
there is no wrong in database name.
Aug 18 '10 #3
zorgi
431 Expert 256MB
Ok I see. I think you used identifier id and in your echo statement you have:

Expand|Select|Wrap|Line Numbers
  1. echo ($row['appid']
  2.  
try ordering by appid instead of id
Aug 18 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jake_adl | last post by:
Is there any way to create a Microsoft.Practices.EnterpriseLibrary.Data.Database object without reading from a configuration file? I am writing a utility that manages databases in SQL Server....
5
by: aniket_sp | last post by:
i am using a data adapter and a dataset for filling and retrieving data into .mdb database. following is the code..... for the form load event Dim dc(0) As DataColumn Try If...
3
by: Jakob Petersen | last post by:
Hi, I need to increase the speed when retrieving data from a hosted SQL Server into VBA. I'm using simple SELECT statements. How important is the speed of my Internet connection? (I have...
0
by: DC01 | last post by:
I have added a new measure successfully into the normal cube. I then add it to the virtual cube and reprocess all cubes. I can browse the normal cube successfully. Then when I try and browse the...
1
by: hanusoft | last post by:
This is an example of Inserting and Retrieving data from xml file. private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here ...
1
by: hanusoft | last post by:
This is an example of Inserting and Retrieving data from xml file. private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here ...
4
by: smartin | last post by:
Hi, I'm having problem retrieving data from an SQL stored procedure. I tried debugging but it wont give a the reason for the error. it just throws an exception after executing cmd.ExecuteNonQuery...
3
ADezii
by: ADezii | last post by:
Last Tip, we demonstrated the technique for retrieving data from a DAO Recordset, and placing it into a 2-dimensional Array using the GetRows() Method. This week, we will cover the same exact Method...
10
vikas1111
by: vikas1111 | last post by:
Hi All Can anyone give me an idea to solve the problem.. My Problem is ,, I want to Retrieving data from database and displaying in textbox... If anybody have link of some good tutorial on...
7
by: splendid9 | last post by:
Problem in retrieving data from a XML file.......this is my code- protected void Page_Load(object sender, EventArgs e) { DataSet ds = new DataSet(); ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.