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] Link to comment https://forums.phpfreaks.com/topic/109095-easy-syntax-error/ 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"]; ?> Link to comment https://forums.phpfreaks.com/topic/109095-easy-syntax-error/#findComment-559666 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.