Jump to content

[SOLVED] Code only work when not included?


phpretard

Recommended Posts

I am trying to combine 2 words from a row called key. The row key has 20 entries and all are different words.

 

For example one word in row key is "Green"

 

Anthoer is "Spoon".

 

On a random basis I would like to echo "GreenSpoon" // or any other combination of words

 

The code below only works on one page by itself.

I need to include it in another page and when I do it only echos 1 word.

 

 

<?
include ("../db.php");

$EmailKey=mysql_query("SELECT * FROM emailkeys ORDER BY RAND() limit 2");

if (!$EmailKey){die(mysql_error());}

WHILE ($row=mysql_fetch_array($EmailKey)){

$key1=$row['key'];

echo $key1;
}

mysql_close($con);

?>

 

Thank you!

Link to comment
https://forums.phpfreaks.com/topic/150859-solved-code-only-work-when-not-included/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.