| | |
Need Help...Please
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2008
Posts: 1
Reputation:
Solved Threads: 0
Ok - so I have what should be a simple pull into an array for display in a form - however, I am getting this error: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in ...Database.php5 on line 30
Basically, the function is built in Database.php5
Then the function is called from another function in utilities.php5 as follows:
And of course that function is called from the page I actually want to display it like so:
Then the page is supposed to display it within a table (for better formatting) like so:
All I am trying to do is pull two columns out of a database and load them into an array - I have given up on a multidimensional array because it wasn't working for me - so I figured I could use the split function... For whatever reason - I can't get past the error with mysql_fetch_assoc... Doesn't make any sense. I have checked and double checked all semi-colons, table and column names for the database, and every quotation mark... If you have an easier solution or can tell me what is wrong with this one - please do - I am open to suggestions...
Thanks
~Rachel~
Basically, the function is built in Database.php5
php Syntax (Toggle Plain Text)
function fetchRow($result) { return mysql_fetch_assoc($result); }
Then the function is called from another function in utilities.php5 as follows:
php Syntax (Toggle Plain Text)
function getAllSizes() { $data = array(); $result = $GLOBALS['DB']->exec("select * from pricing"); while ($row = $GLOBALS['DB']->fetchRow($result)) $data[$row['picSize']] = $row['picSize'] . ": " . $row['price']; return $data; }
And of course that function is called from the page I actually want to display it like so:
php Syntax (Toggle Plain Text)
$all_sizes = getAllSizes();
Then the page is supposed to display it within a table (for better formatting) like so:
php Syntax (Toggle Plain Text)
foreach (array_keys ($all_sizes) as $picSize) { list($size, $price) = split(":", $picSize); print '<tr><td>' . $size . '</td>'; print '<td><input type="text" name="' . $size . '" size="15" value="' . $price . '" /></td></tr>'; }
All I am trying to do is pull two columns out of a database and load them into an array - I have given up on a multidimensional array because it wasn't working for me - so I figured I could use the split function... For whatever reason - I can't get past the error with mysql_fetch_assoc... Doesn't make any sense. I have checked and double checked all semi-colons, table and column names for the database, and every quotation mark... If you have an easier solution or can tell me what is wrong with this one - please do - I am open to suggestions...
Thanks
~Rachel~
![]() |
Other Threads in the MySQL Forum
- Previous Thread: Need help with record count involving two tables.
- Next Thread: phpMyAdmin error
Views: 515 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for MySQL
"use" 1 amazon api aws bizspark breathalyzer changingprices cmg communityjournalism contentmanagement contractors copyright count court crm data database design developer development distinct drupal dui ec2 eliminate email enterprise eudora facebook form foss gartner gnu government gpl groklaw groupware hiring hyperic images innerjoins insert ip joebrockmeier journalism keyword keywords kickfire laptop law legal license licensing linux managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple mysql mysqlcolumnupdating mysqlindex mysqlinternalqueries mysqlsearch news opendatabasealliance opengovernment opensource operand oracle pdf penelope php priceupdating query referencedesign remove reorderingcolumns resultset search select simpledb sourcecode spotify sql statement sugarcrm syntax techsupport thunderbird transparency update virtualization





