jmac2501 Posted January 24, 2008 Share Posted January 24, 2008 Sorry for starting a new thread bout the same thing but i simplified my script to see if i could get an answer easier this way. I am pulling info from a field in my database called "reo" I need to echo this results into a http string but i am having no luck. I have marked in red the $reo that i need echoed <?php error_reporting(E_ALL ^ E_NOTICE); $link = mysql_connect('mysql6.*****.com', '******', '*****') or die('Could not connect: ' . mysql_error()); mysql_select_db('dcremax') or die('Could not select database'); $query="SELECT * FROM Listings"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { [color=red]$reo[/color]=mysql_result($result,$i,"reo"); require_once("class_http.php"); $h = new http(); $h->dir = "/home/foo/bar/"; if (!$h->fetch("http://metrolistmls.com/cgi-bin/GetOneR.cfm?County=SA&iRow=0&nJL=7&MLSNum=[color=red]$reo[/color];")) { echo "<h2>There is a problem with the http request!</h2>"; echo $h->log; exit(); } if($beg = strpos($h->body, "http://mlsmedia.metrolistmls.com/bigphoto/", 0 )) {$end = strpos($h->body, ".jpg", $beg ); $pic = substr($h->body, $beg, ($end + 4) - $beg ); echo("$pic"); echo("<br />"); } $i++; } ?> If i manuly add the "reo" info it works fine. but if i try to use the $reo query it times out. Any helf would be great. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/87499-solved-echo-problem/ Share on other sites More sharing options...
pdkv2 Posted January 24, 2008 Share Posted January 24, 2008 You have closed the connection with mysql an trying to fetch the results from db mysql_close(); is used before mysql_result($result,$i,"reo"); Rgds Quote Link to comment https://forums.phpfreaks.com/topic/87499-solved-echo-problem/#findComment-447551 Share on other sites More sharing options...
jmac2501 Posted January 24, 2008 Author Share Posted January 24, 2008 Where should i put it? I tried puting it below $reo=mysql_result($result,$i,"reo"); but i get a Warrning: mysql_closed (). error Quote Link to comment https://forums.phpfreaks.com/topic/87499-solved-echo-problem/#findComment-447553 Share on other sites More sharing options...
mmarif4u Posted January 24, 2008 Share Posted January 24, 2008 Mostly ppl put it at the end of code before closing php tag. Quote Link to comment https://forums.phpfreaks.com/topic/87499-solved-echo-problem/#findComment-447554 Share on other sites More sharing options...
jmac2501 Posted January 24, 2008 Author Share Posted January 24, 2008 ok so i did that and I don't get that error anymore. So I guess my question is How do i echo $reo=mysql_result($result,$i,"reo"); into here if (!$h->fetch("http://metrolistmls.com/cgi-bin/GetOneR.cfm?County=SA&iRow=0&nJL=7&MLSNum=$reo;")) { Quote Link to comment https://forums.phpfreaks.com/topic/87499-solved-echo-problem/#findComment-447557 Share on other sites More sharing options...
pdkv2 Posted January 24, 2008 Share Posted January 24, 2008 ok so i did that and I don't get that error anymore. So I guess my question is How do i echo $reo=mysql_result($result,$i,"reo"); into here if (!$h->fetch("http://metrolistmls.com/cgi-bin/GetOneR.cfm?County=SA&iRow=0&nJL=7&MLSNum=$reo;")) { ya do it like this if (!$h->fetch("http://metrolistmls.com/cgi-bin/GetOneR.cfm?County=SA&iRow=0&nJL=7&MLSNum=".$reo)) { Quote Link to comment https://forums.phpfreaks.com/topic/87499-solved-echo-problem/#findComment-447565 Share on other sites More sharing options...
jmac2501 Posted January 24, 2008 Author Share Posted January 24, 2008 Thanks that work. You are the man Quote Link to comment https://forums.phpfreaks.com/topic/87499-solved-echo-problem/#findComment-447567 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.