Jump to content


Photo

display news (<=script=>)


  • Please log in to reply
12 replies to this topic

#1 ahmed17

ahmed17
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 11 October 2006 - 10:29 PM

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
CREATE TABLE `news` (
`id` TINYINT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`title` VARCHAR( 50 ) NOT NULL ,
`subject` VARCHAR( 51 ) NOT NULL
) ENGINE = innodb;

php 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>


#2 JasonLewis

JasonLewis
  • Members
  • PipPipPip
  • Advanced Member
  • 3,351 posts
  • LocationVictoria, Australia

Posted 12 October 2006 - 03:25 AM

what do you actually mean? the code is fine from my looking. i really don't no why your actually trying to do...
Good luck with your coding.
Jason / ProjectFear / Jaysonic

#3 ahmed17

ahmed17
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 12 October 2006 - 09:33 PM

thanks, i want to display the subject of news into javascript page

#4 ahmed17

ahmed17
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 12 October 2006 - 11:26 PM

:) ?

#5 ahmed17

ahmed17
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 13 October 2006 - 02:29 PM

help me ?

#6 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 13 October 2006 - 03:28 PM

What do you mean by 'into javascript page' do you have a working example on a site somewhere?  Where did the idea come from?

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#7 ahmed17

ahmed17
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 13 October 2006 - 06:13 PM

when i uer selct the titlt then he will move to page where the subject of news display so i want
the subject display in javascript page not in normal page  and the way to do that ?

#8 ahmed17

ahmed17
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 13 October 2006 - 07:07 PM

important help  ???

#9 ahmed17

ahmed17
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 14 October 2006 - 02:20 PM

display news in page like this
http://www.mo3afa.co...=11608365104069

#10 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 14 October 2006 - 06:22 PM

Oh, so you want it to open in a new window...

That's not a php issue, it's HTML/Javascript

Try googling for javascript +"open new window"

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#11 ahmed17

ahmed17
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 14 October 2006 - 09:43 PM

but how i can use it to display news ?

#12 ahmed17

ahmed17
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 15 October 2006 - 09:01 PM

plz help me ?

#13 JasonLewis

JasonLewis
  • Members
  • PipPipPip
  • Advanced Member
  • 3,351 posts
  • LocationVictoria, Australia

Posted 22 October 2006 - 06:23 AM

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

then in your openpopup() javascript function have it open a php page like http://www.site.com/...up.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.
Good luck with your coding.
Jason / ProjectFear / Jaysonic




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users