Page 1 of 1

T_Print Error

Posted: Wed Dec 01, 2004 2:36 am
by PHPMan
Im getting a t_print error..
Now, when I remove the
print
and put echo - i get a t_echo error, here is what the script looks like:
(the last line is linke 16 and the line that seems to be giving me the
t_print error

$result = mysql_select_db($jetlinka_memphisair) or die("Unable to select database");
$query="SELECT * FROM join";
$result=mysql_query($query);

// print the data in a table
if (mysql_num_rows($result)
print "<table cellpadding=2 cellspacing=0 border=0 width=\"100%\>"\n";

Posted: Wed Dec 01, 2004 2:59 am
by kettle_drum

Code: Select all

if (mysql_num_rows($result) 

if (mysql_num_rows($result))

Script Problem

Posted: Wed Dec 01, 2004 3:40 am
by PHPMan
Here is the excate error now:
Parse error: parse error, unexpected T_IF in /home/jetlinka/public_html/memphisair/join/read.php on line 16

Been doing this repeatidly all night long, cant seem to get a consistant script. This is an Entry page where people can few what they posted...thanks...

Here is my excate Script:
<?php

include "config.php";

// connect to the mysql server
mysql_connect("localhost", "jetlinka_mei", "memphis");
mysql_select_db("jetlinka_memphisair");

// read data from database
$result = mysql_select_db($jetlinka_memphisair) or die("Unable to select database");
$resultid = mysql_query("select * from $join order by id desc limit $rows");
or die ("Could not read data because " .mysql_error());;

// print the data in a table
if (mysql_num_rows($result)
if (mysql_num_rows($result))
print "<table cellpadding=2 cellspacing=0 border=0 width=\"100%\">\n";
while ($qry = mysql_fetch_array($result)) {
print "<tr><td><a href=\"" . "$qry[email]\" target=\"_blank\">$qry[name]</a>: ";
print $qry[comment];
print "</td></tr>\n";
}
print "</table>\n";
}

mysql_close();

?>

Posted: Thu Dec 02, 2004 9:02 am
by Dale
Note: DO NOT POST YOUR PASSWORD IN SELECT DATABASE BIT.
Note 2: Please post your code in tags.

Try This:

Code: Select all

<?php 

include "config.php"; 

// connect to the mysql server 
mysql_connect("localhost", "jetlinka_mei", "m*****s"); 
mysql_select_db("jetlinka_memphisair"); 

// read data from database 
$result = mysql_select_db($jetlinka_memphisair) or die("Unable to select database"); 
$resultid = mysql_query("select * from $join order by id desc limit $rows"); 
or die ("Could not read data because " .mysql_error());

// print the data in a table 
if (mysql_num_rows($result)) {
print "<table cellpadding=2 cellspacing=0 border=0 width="100%">\n"; 
while ($qry = mysql_fetch_array($result)) { 
print "<tr><td><a href="" . "$qry[email]" target="_blank">$qry[name]</a>: "; 
print $qry[comment]; 
print "</td></tr>\n"; 
} 
print "</table>\n"; 
} 

mysql_close(); 

?>