OK if it is just a test database you can send it over or just rar/zip it and upload it somewhere. I really don't know what might be causing this.
I asked on other forums. No one knows this is the sql -- -- Table structure for table `news_posts` -- CREATE TABLE `news_posts` ( `id` int(11) NOT NULL auto_increment, `title` varchar(70) NOT NULL default '', `avatar` varchar(255) NOT NULL default '', `author` varchar(50) NOT NULL default '', `post` text NOT NULL, `date` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ; PHP:
That's not of much use - can you dump a few lines (just a few!!) of the table so we check that the 'avatar' field is not empty? Also, did you copy and past on this forum the EXACT code you have on your script? Don't re-write it, copy and paste it as it is - otherwise we could lose some typos you might have in the original code
Yeh, let us see a dump and your exact code for this so we can help you. Much cheaper than using the Experts Exchange.
The dump.. INSERT INTO `news_posts` VALUES (3, 'Just Testing', 'http://www.immixstudios.com/work/Templates/Avatars/tbthosting.jpg', 'Prilep', 'Just TestingJust TestingJust Testing Just TestingJust TestingJust Testing Just TestingJust TestingJust Testing Just TestingJust TestingJust Testing Just TestingJust TestingJust Testing Just TestingJust TestingJust Testing Just TestingJust TestingJust Testing ', '2007-01-23 08:55:53'); INSERT INTO `news_posts` VALUES (8, 'adaSDjh', 'http://www.immixstudios.com/work/Templates/Avatars/tbthosting.jpg', 'asjdhasd', 'ADklasjdkasdj\r\nADklasjdkasdj\r\nADklasjdkasdj\r\nADklasjdkasdj\r\nADklasjdkasdj\r\n', '2007-01-23 10:58:35'); PHP:
Seems ok to me... Copy and paste the code (please COPY AND PASTE IT, don't re-write it) - also you might want to add a print_r($row); PHP: in your loop to check what the heck is in there. Maaan I hate when these things happen! Also, what is the URL of your script? Can you put the full script source online so that I can give a better look at it?
this is the whole news.php <html> <head> <link href="style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> function openComments(url) { comments = window.open(url, "Comment", "menubar=0,resizable=0,width=380,height=480") comments.focus() } </script> </head> <body> <?php include ('mysql_connect.php'); $query = "SELECT id, title, avatar, author, post, DATE_FORMAT(date, '%M %d, %Y') as sd FROM news_posts ORDER BY date DESC LIMIT 2"; $result = @mysql_query($query); if ($result) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $url = 'comments.php?id='.$row['id']; echo ' <div id=\"right\"> <img src=\"'.$row['avatar'].'\" style=\"border: 1px dashed #1079D6\" <div id=/"maincontent/"> <center><h3><font size="1" face="Verdana">'.$row['title'].' | Ãà ïèøà Ãî Ãa: '.$row['sd'].' Ãà ïèøà ë: '.$row['author'].'</font></h3></center><br /> '.$row['post'].'<br /> <a href="javascript:openComments(\''.$url.'\')"> Äîäà äè/Âèäè Ãîâè êîìåÃòà ðè</a></p>'; } } else { echo 'There are no news posts to display'; } ?> </body> </html> PHP:
OK here's a test I just did : ibgco.com/test/1.php with one of your values (except I didn't use your insert cause it is auto_increment). You can see that it works just fine over here ... Also I have just noticed something in your query : Please remove "as sd" from it and test it again.
So how come it works on yours but not on mine? I just tryed a different script with an image like this one and it works fine. Its just that one that dosent work .. - Prilep
probably cause your query needs to be something like: $query = "SELECT * FROM news_posts ORDER BY date DESC LIMIT 2"; Code (markup):
Too bad it still dosent work for me. O well i guess thats that. I will give you green rep for coming close to fixing it. Thanks anyways. Ill try to find a different one with better code. - Prilep
Keep the green until it's fixed. If you can give me temp access to the code and the DB I am sure I will be able to do something about it
Well it wasn't mysql related but the way the image was displayed - it actually broke the html and didn't show the image.