newbie echoing help

A

Anonymous

Guest
The first part of my script is working fine searching database and retrieving data held within according to searchterm. The html part is working to showing the number of records I know are held in the database.

I am using phpdev's program using windows 95 and my files are kept in the www file as advised by their instruction.

The problem is when I echo, or print even tried printf functions I dont seem to be able veiw them in my browser. This is the way I have defined and written the echo statement below:

<?php

include_once("databasequery.php");

$id= $result["id"];

{
while ($row = mysql_fetch_array($result));
echo (htmlspecialchars(stripslashes($row["$id"])));
}

<?

I have written and tried a getdate() script which worked fine so im a little lost on this one as the script is being parsed and Im receiving no errors. As I itterated above I have tried echo, print and printf to no avail.


Thanks Dan
 
You have mistakes:
Code:
<?php 
include_once("databasequery.php"); 

$id= $result["id"]; ??? What it?
 
while ($row = mysql_fetch_array($result)); 
{ #
echo (htmlspecialchars(stripslashes($row["$id"]))); 
} 
# no use <?
?>
 
<?

$d = $result["id"];

//declaring variables I got fom a tutorial. In fact I kept getting an Undefined Variable Error in he echo part below before I put it in.


{
while ($row = mysql_fetch_array($result));
echo (htmlspecialchars(stripslashes($row["$id])));
}
?>

// the echo section was taken from Sam's PHP Mysql Web Development.

What should it be

<?php
echo ($row["id"]
?>

I thought that to addslashes which works ok in the script I had to therefore use the stripslashes function on return.
 
da9nlc said:
<?

$d = $result["id"];

//declaring variables I got fom a tutorial in tutorial. In fact I kept getting an Undefined Variable Error in he echo part below before I put it in.


{
while ($row = mysql_fetch_array($result));
echo (htmlspecialchars(stripslashes($row["$id])));
}
?>

// the echo section was taken from Sam's PHP Mysql Web Development.

What should it be

<?php
echo ($row["id"]
?>

I thought that to addslashes which works ok in the script I had to therefore use the stripslashes function on return.
 
http://www.php-forum.com/p/viewtopic.php?t=1483

if you just bought that book.. take it back.. if you can't take it back.. burn it.

You will run into nothing but problems.
 
Back
Top