Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to keep one variable in memory
Message
From
24/02/2013 07:52:11
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
How to keep one variable in memory
Miscellaneous
Thread ID:
01566822
Message ID:
01566822
Views:
77
Hi all,

I would like to keep one variable in memory for
my next sql query.
mysql_connect('localhost', 'root', '')
  or die("Mysql connection failed");
mysql_select_db("blog")
  or die("Can't find database 'blog'");


$sql = "select * from user,article where article.userID=user.ID order by article.ID desc limit 5";
$result = mysql_query($sql);
if (!$result)
	die("SQL error: ".$sql." ERROR: ".mysql_error());

while ($row = mysql_fetch_assoc($result)) {
	printf("<hr><h3><a href=\"article.php?id=%d\">%s</a></h3><b>author %s, date %s</b><p>%s</p>",$row['ID'], 
	$row['title'], $row['username'],$row['timestamp'], $row['content']);	
	
}

my next query to get id number id=%d , how to have it  ?

$sql = "select a.ID,c.content from article as a inner join comment as c on a.ID = c.articleID

 group by a.ID,c.content order by a.ID desc limit 5  where a.ID = ???? ";
$result = mysql_query($sql);
if (!$result)
	die("SQL error: ".$sql." ERROR: ".mysql_error());

while ($row = mysql_fetch_assoc($result)) {
  //printf($row['ID'],$row['content']);	

  printf("<hr>%s<p>%s</p>",$row['ID'], $row['content']);	
}
please help me, I really appreciated.

Thank you,
Next
Reply
Map
View

Click here to load this message in the networking platform