473,387 Members | 1,453 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 multiple rows

46
Hey Everyone,
Here's the code:
[php]
$query = mysql_query("SELECT 'column' FROM table WHERE location='$location'");
$queryA = mysql_fetch_array($query,MYSQL_NUM);
[/php]
MYSQL_NUM_ROWS claims that $query returns 2 rows. However, for some I am not able to access $queryA. I imagine some thing's wrong with my fetch array function. But I'm kind of at a loss of ideas here.

Thanks alot for the help,
Sake
Jan 28 '08 #1
3 2674
rpnew
188 100+
Hey Everyone,
Here's the code:
[php]
$query = mysql_query("SELECT 'column' FROM table WHERE location='$location'");
$queryA = mysql_fetch_array($query,MYSQL_NUM);
[/php]
MYSQL_NUM_ROWS claims that $query returns 2 rows. However, for some I am not able to access $queryA. I imagine some thing's wrong with my fetch array function. But I'm kind of at a loss of ideas here.

Thanks alot for the help,
Sake
Hi,
Can you a provide a bit of more code.. where are you using this $queryA and how are you using it?

Regards,
RP
Jan 28 '08 #2
sake
46
[php]
$query = mysql_query("SELECT 'Id' FROM mobs WHERE location='$location'");
$aMobs = mysql_fetch_array($query,MYSQL_NUM);//available mobs
$randMob = rand()%(mysql_num_rows($query)-1);
$lastMob = $aMobs[randMob];
[/php]
So pretty much i'm trying to get all Id's where their location = $location. Then i want to randomly select an Id from the aMobs array. Any ideas?
Jan 28 '08 #3
Hey Everyone,
Here's the code:
[php]
$query = mysql_query("SELECT 'column' FROM table WHERE location='$location'");
$queryA = mysql_fetch_array($query,MYSQL_NUM);
[/php]
MYSQL_NUM_ROWS claims that $query returns 2 rows. However, for some I am not able to access $queryA. I imagine some thing's wrong with my fetch array function. But I'm kind of at a loss of ideas here.

Thanks alot for the help,
Sake

Use this and retrive the all row

$query = mysql_query("SELECT 'column' FROM table WHERE location='$location'");

while ($row = mysql_fetch_array($query, MYSQL_NUM)) {
printf("Column: %s ", $row[0]);
}
Jan 28 '08 #4

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

Similar topics

1
by: tangus via DotNetMonster.com | last post by:
Hello all, I'm really struggling with getting some Active Directory code to work in ASP.NET. Can you please provide assistance? I am executing the following code: Dim enTry As DirectoryEntry =...
6
by: Dean Slindee | last post by:
Does anybody have an actual example of retrieving an Image data type column from a SQL Server table using a dataset (not a datareader)? I would like to see the statements that would move the...
1
by: Glenn T. Kitchen | last post by:
Dear Group, I'm having problems retrieving the child rows of a parent row. The parent table is Users and the child table is Addresses. I used the Schema to create a DataRelation between the...
8
by: julian_m | last post by:
let's say I've an array of articles's id $arr_art_id=(1, 551, 2015, 6 .......n ) what option is better (1 or 2), in order to achieve better performance? (pseudo code) 1) for i=0 to array...
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...
4
by: Papachumba | last post by:
Hi guys, i have a little problem and was wandering if anyone can help. I just need my query modified a little bit to allow some extra values in there... Tables: offers Table OfferID...
5
by: Sanjay Pais | last post by:
I have a table with over 1.3 million rows. I am retrieving only 20 at a time using the with - over clauses In query analyser, the data is retrieved in under a second. When retrieving using the...
9
ADezii
by: ADezii | last post by:
One question which pops up frequently here at TheScripts is: 'How do I retrieve data from a Recordset once I've created it?' One very efficient, and not that often used approach, is the GetRows()...
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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.