Wrox Programmer Forums
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 16th, 2005, 04:12 PM
Registered User
 
Join Date: Apr 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Agentofnight Send a message via MSN to Agentofnight
Default Whats wrong?

Hey, can anyone tell me whats wrong w/ this?DW says its line 7

<?php
if ($sstory==""||$lstory==""||$name=="") {
echo "Fill up all the information";
} else {
$connect== mysql_connect ("localhost","root","");
$db== mysql_select_db ("Agentofnight",$connect);
$sql= SELECT name, short_story, long_story, category, date FROM news;
$mysql_result = mysql_query ($sql,$connect);
$num_rows= mysql_num_rows(mysql_result);
if ($num_rows=="0"){
echo "There is no information."
} else {
while ($row= mysql_fetch_array($mysql_result))
{
$name=$row[name];
$category=$row[category];
$short_story=$row[short_story];
$long_story=$row[long_story];
$date=$row[date];

echo "<table width="100%" height="100%" border="0" align="center">
  <tr>
    <th height="56" scope="col">$Name</th>
    <th scope="col">$category</th>
    <th scope="col">$date</th>
  </tr>
  <tr>
    <td colspan="3">$short_story</td>
  </tr>
</table>"
?>

 
Old April 16th, 2005, 07:13 PM
Authorized User
 
Join Date: Jan 2005
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default

$sql= SELECT name, short_story, long_story, category, date FROM news;

try this:

$sql= "SELECT name, short_story, long_story, category, date FROM news";

----------------
Never bother to learn something not knowing which does not do you any harm, and never neglect to learn something whose negligence will increase your ignorance - Imam Jafar Sadeq
 
Old April 16th, 2005, 10:26 PM
Registered User
 
Join Date: Apr 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Agentofnight Send a message via MSN to Agentofnight
Default

arrrrrrrrrr
now it says line 12
which should be "} else {"
and i dont see anything wrong with anything be4 that

 
Old April 17th, 2005, 04:11 AM
Authorized User
 
Join Date: Apr 2005
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

need semicolin at end of line 11
echo "There is no information."
===Should Be=====
echo "There is no information.";

Everything is temporary, some things are just more temporary than others... except for death, that seems to be pretty permanent





Similar Threads
Thread Thread Starter Forum Replies Last Post
Whats wrong with the GUI display Sandz Java GUI 1 February 5th, 2005 08:28 AM
whats wrong with this code? sand133 VB.NET 2002/2003 Basics 2 September 12th, 2004 10:07 PM
Whats wrong with this code? Thomas82 Classic ASP Databases 6 February 26th, 2004 09:40 AM
Whats the diff?? nsakic XSLT 2 January 17th, 2004 07:11 PM
whats wrong with this code ? qwprince Classic ASP Basics 5 July 27th, 2003 07:46 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.