Member Avatar for nova37

hello
i want to know that how pass parameters to mysql query inside php function
i have written function but giveing me error

   error: mysql_fetch_array(): supplied argument is not a valid MySQL result resource


function d_loader($r_ip){   
global $con;
$result = mysql_query("SELECT * FROM table WHERE h_ip ='$r_ip'");

$row=mysql_fetch_array($result);}

Tray adding or die(mysql_error()) to the end of your query to see if that helps with finding out what is going wrong:

$result = mysql_query("SELECT * FROM table WHERE h_ip ='$r_ip'") or die(mysql_error());
Member Avatar for nova37

ya thanks for that .... i find where is problem :D

or die(mysql_error());

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.