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
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
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
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
is useless
 
Join Date: Jan 2002
Location: Ohio
Posts: 3,087
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.

__________________
Glioblastoma Multiforme (GBM) Brain Cancer Awareness. Gray Matters! My (quick) Story of supporting someone close who has it.
Incurable, 6-18 months prognosis, no survivors longer than 3 years.
Don't like what I say? Ignore me.

  #5  
Old
Web Hosting Master
 
Join Date: Jan 2004
Location: Ellesmere Port, Wirral, UK
Posts: 1,541
And an extra ) on line 12

  #6  
Old
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
Linode Pours $45 Million in Cloud Infrastructure and Services Upgrades Web Hosting News 2014-04-17 10:21:06
TextDrive ‘Lifetime’ Customer Accounts to End This Week Web Hosting News 2014-03-10 13:54:34
European Cloud Providers See Local Players, Not AWS, as Biggest Competition: Study Web Hosting News 2013-10-24 12:38:19
Phoenix NAP Aims to Improve Cloud Hosting through Customer Feedback Website Web Hosting News 2013-01-17 13:59:49


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?
WHT Host Brief Email:

We respect your privacy. We will never sell, rent, or give away your address to any outside party, ever.

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?