[thelist] Random Page Titles is it possible with php/MySQL

UDHIEN milis at udhien.net
Thu Sep 18 06:39:16 CDT 2003


how about like this :

echo "<title>".$myrow["page_title"]."</title>";



Regards,




UDHIEN
__________________________________________
/* http://www.udhien.net - TECHVOLUTION */



>  -----Original Message-----
>  From: thelist-bounces at lists.evolt.org
>  [mailto:thelist-bounces at lists.evolt.org]On Behalf Of Andre Genic
>  Sent: Thursday, September 18, 2003 6:21 PM
>  To: Thelist at Lists. Evolt. Org
>  Subject: [thelist] Random Page Titles is it possible with php/MySQL
>  
>  
>  Hi All,
>  	Been trying to get my head around a little problem, I want 
>  to add a series
>  of random page titles into a page from a MySQL table, just 
>  really something
>  so there's a different title on the page everytime it's refreshed or
>  re-visited, here's the code I cooked up to try and do it.
>  
>  So far zip!
>  
>  <?php
>  mysql_connect($server, $user, $pass) or die ("Can't connect!");
>  mysql_select_db($db) or die ("Can't open database!");
>  $sql = "SELECT * FROM $t1";
>  $result = mysql_db_query($db, $sql);
>  if ($result)
>  {
>  $count = mysql_num_rows($result);
>  
>  $sqlshow = "SELECT * FROM $t1 ORDER BY RAND() LIMIT 0, 1";
>  $result = mysql_db_query($db, $sqlshow);
>  
>  while (($myrow = mysql_fetch_array($result)))
>  {
>  echo "<title>$page_title"</title>;
>  }
>  }
>  else
>  echo "Error!";
>  mysql_close();
>  ?>
>  
>  But all I am getting back is this:
>  
>  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>  <html>
>  <head>
>  <title></title>
>  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
>  <LINK href="favicon.ico" rel="shortcut icon">
>  </head>
>  
>  Any pointers as to where I'm going wrong?


More information about the thelist mailing list