php error

How to use phpmyadmin.... phpmyadmin related arguments. Even phpMyAdmin issues

Moderators: macek, egami, gesf

wijayabahu
New php-forum User
New php-forum User
Posts: 2
Joined: Sun Mar 03, 2013 9:08 am

php error

Postby wijayabahu » Sun Mar 03, 2013 9:27 am

Code: Select all

<?php
  session_start();
 
 
  mysql_connect('localhost','root','') or die(mysql_error());
  mysql_select_db('sh_chart') or die(mysql_error());
 
 

function product(){
   $get =mysql_query('SELECT price FROM sh_chart WHERE price<10.00 ORDER BY DESC');
   echo mysql_num_rows($get);
       
}



i have this error
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\shopingchart\chart.php on line 12

plz give me a right answer :help:

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: php error

Postby seandisanti » Wed Mar 06, 2013 3:17 pm

That particular error typically means that your query failed. It could be because of a connection issue (bad hostname or credentials) a syntax error, etc. Typically the best way to identify the issue is to either view source on the page where you're seeing it, to see if the SQL error is embedded in your source code, or to output your assembled sql string prior to executing it, and paste it into phpmyadmin or mysql to see what error it spits out.


Return to “phpMyAdmin”

Who is online

Users browsing this forum: No registered users and 1 guest

cron