Jump to content

display news (<=script=>)


ahmed17

Recommended Posts

hello..,

i create news script to display news but i want to display the subject of news into javascript page
and there's problem ,if user select the title of news how i can make select title tie to its subject

here's script
1st:database
[code]CREATE TABLE `news` (
`id` TINYINT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`title` VARCHAR( 50 ) NOT NULL ,
`subject` VARCHAR( 51 ) NOT NULL
) ENGINE = innodb;[/code]

php code:
========
[code]<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
      <title>Title here!</title>
</head>
<body>
<?php

$host="localhost";
$user="root";
$pass="";
$database="news";
$table="news";

$link = mysql_connect('localhost', "$user", "$pass")or print"failed connection";
        mysql_select_db($database,$link)or print "not exists";
       
$_sql="INSERT INTO $table(title,subject)VALUES('my test script...news','this is my topic')";
$result=mysql_query($_sql,$link);
/*if($result)
{
    echo"sucess entery data";

}else{
    echo"failed entery data";
} */


$query=("select * from $table");
$result= mysql_db_query($database,$query,$link);

?>
<table width=100% height=100>
<tr>
<td bgcolor=iceyellow>
<marquee direction="right" onmouseover="this.scrollAmount=0" onmouseout="this.scrollAmount=4">
  <? while ($row = mysql_fetch_assoc($result) )
          {
                          $title  =$row['title'];
                          $subject =$row['subject'];
                          echo "<a href='inselect.php?title=$title'>.::::.$title</a>";
          }
  ?>
</marquee>

</td>
</tr>
</table>
</body>
</html>[/code]
Link to comment
Share on other sites

well you could just do a javascript popup with the id in it. example:
[code]<a href="javascript: openpopup('1');">Open News</a>[/code]

then in your openpopup() javascript function have it open a php page like http://www.site.com/news/java_popup.php?newsid=1 then just get the news info from the database by using the newsid.

but i am still not sure on what your asking.
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.