corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » mysql_fetch_array - usage


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author mysql_fetch_array - usage
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
15th Mar 07 at 12:50   View Garage View User's Profile U2U Member Reply With Quote

Have never used this syntax before but i have the following

$result = mysql_query("SELECT * FROM phpbb_smilies");
$smilies=mysql_fetch_array($result);
echo $smilies['smile_url'];

which outputs the first record of that table fine.

What i want to do is output the record of a certain row, say for instance i wanted the 'smile_url' of row 5

any ideas?
AndyKent
Member

Registered: 3rd Sep 05
User status: Offline
15th Mar 07 at 13:30   View User's Profile U2U Member Reply With Quote

I usually do

mysql_fetch_array($query, MYSQL_ASSOC);

I then usually do a while loop do get to the right number.

You could do a while loop that loops around the number of rows you are after. So for the 5th smilie you'd loop 5 times then print.
Ian
Site Administrator

Avatar

Registered: 28th Aug 99
Location: Liverpool
User status: Offline
15th Mar 07 at 18:03   View Garage View User's Profile U2U Member Reply With Quote

SELECT * FROM phpbb_smilies LIMIT 5,1
Dom
Member

Registered: 13th Sep 03
User status: Offline
15th Mar 07 at 19:10   View User's Profile U2U Member Reply With Quote

as ian said above or if the rows have a auto_increase number, you could use that in the query, ie "SELECT * FROM table WHERE uid=12345" etc
Paul_J
Member

Registered: 6th Jun 02
Location: London
User status: Offline
15th Mar 07 at 19:19   View User's Profile U2U Member Reply With Quote

use PL SQL and a cursor.

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
mysql function help :D waynep Geek Day 2 1362
20th Jul 03 at 20:59
by waynep
 
My car [Now with Pics] bwbw General Chat 18 1044
14th Apr 05 at 05:55
by Adam-D
 
Heat Problem *UPDATE* WATSON Geek Day 32 4470
19th Jun 06 at 06:34
by Cybermonkey
 
Does anyone know anything about projectors? Stu Geek Day 16 818
28th Nov 06 at 14:06
by SXi_Tim
 
PHP/HTML liamC Geek Day 14 1724
24th Jan 07 at 17:32
by liamC
 

Corsa Sport » Message Board » Off Day » Geek Day » mysql_fetch_array - usage 28 database queries in 0.0149820 seconds