mysql_fetch_array()

This is a discussion on "mysql_fetch_array()" within the PHP Forum section. This forum, and the thread "mysql_fetch_array() are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jan 20th, 2008, 02:17
Junior Member
Join Date: Sep 2006
Location: Here
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
mysql_fetch_array()

I get this warning:

Warning
: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in DbConnector.php on line 43

from this code

40 //*** Function: fetchArray, Purpose: Get array of query results ***
41 function fetchArray($result) {
42
43 return mysql_fetch_array($result);
44
45}

Is my syntax correct?

Last edited by WebNinja; Jan 20th, 2008 at 03:21.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jan 20th, 2008, 10:22
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: mysql_fetch_array()

You would need to pass the resource pointer by reference. You can't pass it by value.

function fetchArray(&$result)
{
// etc...


I can't see why you would do it this way though.. If you are just returning one array row, why not just call the mysql function into a variable?
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jan 20th, 2008, 11:22
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: mysql_fetch_array()

That way seems unnecessary, have you performed the query?
Depending on whether you want one row or many rows i can post the basic way this is achieved.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql_fetch_array - problem displaying results jswebdev PHP Forum 4 Oct 15th, 2005 17:01


All times are GMT. The time now is 01:48.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42