473,320 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

warning error message by using mysql_num in the mysql_fetch_array()

147 100+
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_array() expects parameter 2 to be long, string given in F:\xampp installed\xampp\htdocs\mysql_fetch_demo1.php on line 8


thanks in advance.i dont know ,why am i facing this error
Mar 25 '10 #1
3 3535
Markus
6,050 Expert 4TB
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 100+
Thanks its working.....in php.ini file ,we should on ERROR_REPORTING(-1).Is it.
Mar 26 '10 #3
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
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
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...
2
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,...
3
by: Pratchaya | last post by:
Hi Everyone ============================================================== About PHP::: Error/Problem PHP Warning: mysql_fetch_array():...
9
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: " ....
1
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...
2
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...
3
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...
1
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...
5
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.