I'm trying to run mysql_fetch_array with a variable in place of the
optional result type constant, like so
mysql_fetch_array($result, $rtype) where, obviously, $rtype is one of the
three valid values for the result type. This throws an error:
"mysql_fetch_array() [function.mysql-fetch-array]: The result type should
be either MYSQL_NUM, MYSQL_ASSOC or MYSQL_BOTH."
I'm not quite sure what the issue here is, other than that I'm replacing a
constant with a variable. I'm looking for a solution that will allow me to
(variably) be able to dictate this value.
TIA
--
Karl Groves 2 4618
Karl Groves wrote:
I'm trying to run mysql_fetch_array with a variable in place of the
optional result type constant, like so
mysql_fetch_array($result, $rtype) where, obviously, $rtype is one of the
three valid values for the result type. This throws an error:
"mysql_fetch_array() [function.mysql-fetch-array]: The result type should
be either MYSQL_NUM, MYSQL_ASSOC or MYSQL_BOTH."
I'm not quite sure what the issue here is, other than that I'm replacing a
constant with a variable. I'm looking for a solution that will allow me to
(variably) be able to dictate this value.
TIA
I assume your variable $rtype contains string of the constants.
"MYSQL_NUM, MYSQL_ASSOC or MYSQL_BOTH" are CONSTANTS.
As such, $rtype need to contains the value of the constants.
ie. assign $rtype = MYSQL_NUM *NOT* $rtype = 'MYSQL_NUM'
(Note the quote)
Hendri
Hendri Kurniawan <as****@email.comwrote in
news:13*************@corp.supernews.com:
Karl Groves wrote:
>I'm trying to run mysql_fetch_array with a variable in place of the optional result type constant, like so
mysql_fetch_array($result, $rtype) where, obviously, $rtype is one of the three valid values for the result type. This throws an error: "mysql_fetch_array() [function.mysql-fetch-array]: The result type should be either MYSQL_NUM, MYSQL_ASSOC or MYSQL_BOTH."
I'm not quite sure what the issue here is, other than that I'm replacing a constant with a variable. I'm looking for a solution that will allow me to (variably) be able to dictate this value.
TIA
I assume your variable $rtype contains string of the constants.
"MYSQL_NUM, MYSQL_ASSOC or MYSQL_BOTH" are CONSTANTS.
As such, $rtype need to contains the value of the constants.
ie. assign $rtype = MYSQL_NUM *NOT* $rtype = 'MYSQL_NUM'
(Note the quote)
UGH. So simple. Thanks
--
Karl Groves This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Noel Wood |
last post by:
Hello I keep getting a warning ...
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in "name of my php file" when I run this query....
SELECT Menu_Item,...
|
by: Theo |
last post by:
hi all
this is probably another simple one, but the web doesnt seem to have an
answer that I can find.
Veeeery simple code. each row has 10 columns.
require('db.php');
$query = "SELECT *...
|
by: wrw[three] |
last post by:
Hey Okay so i have a page that lists a bunch of clients... then another
page that would limit it to a specific chosen client.... the one that
lists all the clients is working just fine, however...
|
by: Petr Vileta |
last post by:
Hi, I'm new here and excuse me if this question was be here earlier.
I have a simple code
<html><body>
<?php
<?php
$link = mysql_connect("localhost", "user", "password")
or die("Grr: " ....
|
by: monomaniac21 |
last post by:
Hi all!
How can you get rid of the error that displays if you do a query which
returns no result and then try and fetch the array, WITHOUT having to
put the while in another conditional like if...
|
by: Patrick |
last post by:
Hi
I am trying to write a simple database class to encapsulate all the
database functions in one. Howerver I am having problems with
while($row = mysql_fetch_array($IsResult,MYSQL_NUM)) line it...
|
by: lsmamadele |
last post by:
I am getting the following error messages in my search:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mamadele/public_html/BESTPLAYS/search.php on...
|
by: jmDesktop |
last post by:
In my code I cannot figure out how to retrieve multple rows from my
returned array from a class method. I have tried:
<?php
class myClass
{
private $connection;
/* Class constructor */...
|
by: byteit101 |
last post by:
I was working with OOP, and was testing a sql result class, but it gives me the following error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource. I think it has...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |