Jump to content

Easy Syntax Error?


jjmusicpro

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.