hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Whats wrong...
Reply

Forum Jump

Whats wrong...

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 02-06-2004, 03:59 PM
Philipf Philipf is offline
Web Hosting Master
 
Join Date: Jan 2004
Location: Ellesmere Port, Wirral, UK
Posts: 1,541

Whats wrong...


PHP Code:
<?php

include("header.php");
include(
"connect.php");

$query mysql_query("select maxno from news limit 1");
       
$result mysql_query('$query');
               while(
$maxno mysql_fetch_array($query));


$query mysql_query("select * from news order by date desc limit $maxno");
$result mysql_fetch_array($query));
               
extract($result) {

$date $row['date'];
$title htmlentities ($row['title']);
$news nl2br (strip_tags ($row['news']));
echo(
"<b>$title on $date<BR><BR>$news</b>");

}

?>

This thing refuses to work, i know theres likely to be basic mistakes in here....but im new to php

Thanks, Philip


Last edited by Philipf; 02-06-2004 at 04:07 PM.


Sponsored Links
  #2  
Old 02-06-2004, 04:22 PM
Protollix Protollix is offline
Junior Guru
 
Join Date: Feb 2003
Location: Virginia
Posts: 237
You had some extra stuff going on in your code. Give this a try:

PHP Code:
<?php

include("header.php");
include(
"connect.php");

$query mysql_query("select maxno from news limit 1");
$result mysql_query('$query');
list(
$maxno) = mysql_fetch_array($query);


$query mysql_query("select * from news order by date desc limit $maxno");
while (
$result mysql_fetch_array($query)) {
extract($result

$title htmlentities ($title);
$news nl2br (strip_tags ($news));
echo 
"<b>$title on $date<BR><BR>$news</b>";
}
?>

__________________
Protollix - Sean Finkel
Email
Website
Shared Hosting :: Cloud Hosting

  #3  
Old 02-06-2004, 04:27 PM
Philipf Philipf is offline
Web Hosting Master
 
Join Date: Jan 2004
Location: Ellesmere Port, Wirral, UK
Posts: 1,541
Parse error: parse error in /home2/btihost/public_html/psfnews/main.php on line 12

same as before

Thanks, Philip

Sponsored Links
  #4  
Old 02-06-2004, 04:30 PM
MGCJerry MGCJerry is offline
is useless
 
Join Date: Jan 2002
Location: Ohio
Posts: 3,063
Quote:
Originally posted by Protollix
You had some extra stuff going on in your code. Give this a try:

PHP Code:
<?php

include("header.php");
include(
"connect.php");

$query mysql_query("select maxno from news limit 1");
$result mysql_query('$query');
list(
$maxno) = mysql_fetch_array($query);


$query mysql_query("select * from news order by date desc limit $maxno");
while (
$result mysql_fetch_array($query)) {
extract($result); // Missing semi-colon

$title htmlentities ($title);
$news nl2br (strip_tags ($news));
echo 
"<b>$title on $date<BR><BR>$news</b>";
}
?>
You were missing a semi-colon with the extract($result) line.

__________________
Don't like what I say? Ignore me because it will be the only way you can shut me up.

  #5  
Old 02-06-2004, 04:33 PM
Philipf Philipf is offline
Web Hosting Master
 
Join Date: Jan 2004
Location: Ellesmere Port, Wirral, UK
Posts: 1,541
And an extra ) on line 12

  #6  
Old 02-06-2004, 04:45 PM
Philipf Philipf is offline
Web Hosting Master
 
Join Date: Jan 2004
Location: Ellesmere Port, Wirral, UK
Posts: 1,541
Thanks for the help guys, got it almost working

Reply

Related posts from TheWhir.com
Title Type Date Posted
Firebase Launches Hosting Service for Developers Web Hosting News 2014-05-14 15:52:13
TextDrive ‘Lifetime’ Customer Accounts to End This Week Web Hosting News 2014-03-10 13:54:34
Phoenix NAP Aims to Improve Cloud Hosting through Customer Feedback Website Web Hosting News 2013-01-17 13:59:49
cPanel Releases cPanel, WHM 11.34 with New User Interface Web Hosting News 2012-10-16 13:09:49
cPanel Conference 2012: Branding and How to Do it Better with Felipe Gasper Web Hosting News 2012-10-09 18:00:02


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:
WHT Membership
WHT Membership



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?