jjmusicpro Posted June 7, 2008 Share Posted June 7, 2008 so i pass in a id value, and query the db for the result, for some reason i cant get back data from the query, i echo out my query string, put it into mssql and it works fine... but my page shows blank values for the item it gets any ideas? $id = $_POST['id']; if($id != ""){ if($db = mysql_connect("localhost", "xxx","jxxx")){ if(mysql_select_db("xxxxxx",$db)){ $acc1 = "select * from newitems where ID='".$id."'"; $query = mysql_query($acc1); } echo $id; echo $acc1; echo'<div style="background-image:url(tmp/backgroundrepeat.gif); background-repeat:repeat; padding-bottom:4px; padding-top:4px; padding-left:4px; padding-right:4px; border:solid #FFFFFF thin; margin-right:15px;"><strong>Selected Article - '. $query["newstitle"] .' </strong> </div>'; echo"<font class=\"smaller low\">Data of Article-".$id." ".$query["dateadded"]."</font><br>"; echo $result["newsinformation"];[code] [/code] Quote Link to comment Share on other sites More sharing options...
sasa Posted June 7, 2008 Share Posted June 7, 2008 try <?php $id = $_POST['id']; if($id != ""){ if($db = mysql_connect("localhost", "xxx","jxxx")){ if(mysql_select_db("xxxxxx",$db)){ $acc1 = "select * from newitems where ID='".$id."'"; $query = mysql_query($acc1); $query = mysql_fetch_array($query); // add thi line } echo $id; echo $acc1; echo'<div style="background-image:url(tmp/backgroundrepeat.gif); background-repeat:repeat; padding-bottom:4px; padding-top:4px; padding-left:4px; padding-right:4px; border:solid #FFFFFF thin; margin-right:15px;"><strong>Selected Article - '. $query["newstitle"] .' </strong> </div>'; echo"<font class=\"smaller low\">Data of Article-".$id." ".$query["dateadded"]."</font><br>"; echo $result["newsinformation"]; ?> Quote Link to comment 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.