473,664 Members | 2,995 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

warning error message by using mysql_num in the mysql_fetch_arr ay()

147 New Member
Hi,


Expand|Select|Wrap|Line Numbers
  1. <?php
  2. mysql_connect('localhost','root','');
  3. mysql_select_db('test');
  4. $query="select * from phonedirectory";
  5. $result=mysql_query($query);
  6. echo "One Way To Print";
  7. echo "<br>";
  8. while($row=mysql_fetch_array($result,mysql_num))
  9. {
  10.    echo $row[0]." ".$row[1]." ".$row[2]."<br>";
  11. }
  12.  
  13. ?>

Warning Error Message:

One Way To Print

Warning: mysql_fetch_arr ay() expects parameter 2 to be long, string given in F:\xampp installed\xampp \htdocs\mysql_f etch_demo1.php on line 8


thanks in advance.i dont know ,why am i facing this error
Mar 25 '10 #1
3 3559
Markus
6,050 Recognized Expert Expert
PHP's constants are case-sensitive.

Expand|Select|Wrap|Line Numbers
  1. mysql_num != MYSQL_NUM
Turn on error reporting to find problems like these.

Expand|Select|Wrap|Line Numbers
  1. error_reporting(-1);
Mar 25 '10 #2
santhanalakshmi
147 New Member
Thanks its working.....in php.ini file ,we should on ERROR_REPORTING (-1).Is it.
Mar 26 '10 #3
Gears of Codes
1 New Member
Expand|Select|Wrap|Line Numbers
  1. $query = "SELECT Name,Mobile,Website,Rating FROM grand_table order by 4";
  2.  
  3.  
  4. // Passing Variables to execute and check
  5.  
  6. $result = mysql_query($query);
  7.  
  8. while( $data = mysql_fetch_array($result))
  9. {
  10.   echo("<tr><td>$data[0]</td><td>$data[1]</td><td>$data[2]</td><td>$data[3]</td></tr>");
  11.  
  12.  }
Hope by this query you can solve up your error...
I was too suffering from that problem but instead of using regular sqlquery of WHERE i had replaced that and using ORDER BY and also its not necessary to use WHERE and ORDER BY query coz thats the query in which we are ordering and selecting a specified field...

Thanks
Jul 21 '13 #4

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

Similar topics

3
2927
by: josh dismukes | last post by:
/// here is the code i'm getting a parse error on the last line of the code which /// is </html> any help will be much appreciated. <?php session_start ();
8
2187
by: Polar | last post by:
I am having troubles finding the parse error in this script. I've been checking for weeks. I am too new to the subject I guess. I am trying to show a readord and them have a form at the bottom of the page for inputting data to Update the record. I get a parse error that points to the last line in the script so I know it is something I am missing earlier in the script but doing a line by line it seems fine to me. Thanks for any...
2
7973
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, Quantity FROM restorder_item WHERE Order_Number =58 The code I use to do it is.... $query = "select Menu_Item, Quantity from restorder_item"; $query .= " where Order_Number = ".$_REQUEST;
3
3427
by: Pratchaya | last post by:
Hi Everyone ============================================================== About PHP::: Error/Problem PHP Warning: mysql_fetch_array(): ============================================================== In the past i use my code/script work fine with Mandrake 9.1 - 10.1 ( + apache ,mysql ) Now i move to redhat EL4 with the same code/script
9
7419
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: " . mysql_error()); mysql_select_db("my_dbf") or die("Grr");
1
2086
by: myaashik | last post by:
Hello! All I have a Error message saying that: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/rocks/public_html/colorado3.php on line 32 I have error on this code below: <html> <head> <titleColorado</title>
2
4633
by: Karl Groves | last post by:
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() : 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...
3
3088
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 never executes the loop. $IsResult is reeves no value. What am I doing wrong Thanks
1
2702
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 line 113 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mamadele/public_html/BESTPLAYS/search.php on line 127 My code is below. Any help would be much appreciated. ...
5
9125
by: lisles | last post by:
i have a page funtion.php which hs the function to connect to the db /* Mysql Connection */ function connect(){ global $db_server,$db_user,$db_pass,$db;//Global Values from the config.php $conn = @mysql_connect($db_server,$db_user,$db_pass) or die("Connection to Database Server Failed"); @mysql_select_db($db) or die("Database Selection Failed"); return $conn; }
0
8348
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7375
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6187
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4351
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2764
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1759
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.