Member Avatar

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);}

Recommended Answers

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());
Jump to Post

All 2 Replies

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

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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.