1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Rep Power
    I'm trying to write a javascript to syndicate the news on one of my clients pages. However, I am unable to get it to work. After about 6 hours of playing around, I've now got fed up. At best I've managed it to print $title or {$title} instead of the actual value of the variable. Now even that's not working!

    $result = mysql_query("select sid, title from stories order by time desc limit 10");
    while(list($sid, $title) = mysql_fetch_row($result)) {
    $b = 'var headline =' .".$title.".';'.'n';
    echo $b;
    $a = 'document.write("<li><a href=http://www.action-figure.com/article.php?sid='.$sid.'>");';

    $c = 'document.write(headline+ "</a>");';
    echo $a ."n";
    echo $c ."n";
  2. #2
  3. No Profile Picture
    The Dude Abides
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2000
    grass valley,ca
    Rep Power
    Well if you are really tired of trying to make it work, here's a headline grabber I've used. I made changes to suit your setup and haven't tested it as is, but it gives a general idea.

    //Connection info

    $result = mysql_query ("SELECT sid, $title FROM stories WHERE sid LIKE '%' order by time desc limit 10");
    print ("<ul>");
    if ($row = mysql_fetch_array($result)) {
    do {

    print ("<li>");
    print ("<A HREF="http://www.action-figure.com/article.php?sid='.$sid.'">");
    print ("<font size="2" face="helvetica, arial" color="000000">");
    print $row["title"];
    print ("</a></font></li>");
    } while($row = mysql_fetch_array($result));
    } else {print "";}

    [This message has been edited by thedude (edited October 08, 2000).]

Similar Threads

  1. Replies: 5
    Last Post: February 2nd, 2005, 12:28 AM
  2. UTF-8 problem in 4.1.1a
    By mehran20 in forum MySQL Help
    Replies: 1
    Last Post: February 8th, 2004, 02:21 PM
  3. Wierd problem inserting data with VB6
    By gregquinn in forum MySQL Help
    Replies: 5
    Last Post: February 2nd, 2004, 07:37 AM
  4. WinNT4 problem
    By sandipguha in forum Windows Help
    Replies: 0
    Last Post: January 27th, 2004, 02:06 AM
  5. Session Variable problem :(
    By modesty in forum PHP Development
    Replies: 1
    Last Post: January 15th, 2004, 04:00 AM

IMN logo majestic logo threadwatch logo seochat tools logo