echo '<table cellspacing="1" cellpadding="

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

echo '<table cellspacing="1" cellpadding="

Post by nigma »

I get this error when I try to run this error when I run the script that this line falls in:

Parse error: parse error, unexpected T_LNUMBER in C:\Program Files\Apache Group\Apache2\mc0\viewMemberInfo.php on line 25

That line is line 25. Someone know what is wrong with it?

Thanks for all help and advice provided. It is greatly apreciated.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

What does the line (and the few lines above it) look like?

Mac
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Here is the whole thing:

<html>

<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>

<?php

$csname = $_GET["memName"];

require("util.php");
$sql = new MySQL_Class;
$sql->Create("mc0");

$sql->Query("Select * from users where (csName = '$csname');
$fname = $sql->data[0];
$lname = $sql->data[1];
$csname = $sql->data[2];
$gun = $sql->data[3];
$rank = $sql->data[4];
$os = $sql->data[5];

print $fname;
print $lname;
print $csname;
print $gun;
print $rank;
print $os;
?>

<table cellspacing=1 cellpadding=1 border=1 bordercolor=black>
<tr><td>First Name: <?php print $fname; ?></td></tr>
<tr><td>Last Name: <?php print $lname; ?></td></tr>
<tr><td>CS Name: <?php print $csname; ?></td></tr>
<tr><td>Favorite Gun: <?php print $gun; ?></td></tr>
<tr><td>current Rank: <?php print $rank; ?></td></tr>
<tr><td>Current OS: <?php print $os; ?></td></tr>
</table>

</body>
</html>

It could have to do with the database interaction because I know very little about it and have done only a few things with MySQL databases from php.
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Change

Code: Select all

$sql->Query("Select * from users where (csName = '$csname');
... to ...

Code: Select all

$sql->Query("Select * from users where (csName = '$csname')");
Image Image
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Thanks a bunch man. I can't belive I missed that while running through code and checking for obvious problems.
rodrigocaldeira
Forum Commoner
Posts: 27
Joined: Wed Mar 05, 2003 6:40 pm
Location: Brazil
Contact:

Post by rodrigocaldeira »

Try to do this:

echo "<table cellpadding=\"2\"....";

this works perfectly!!
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

HTML doesn't actually make a difference whether or not you use quotes around values. :)
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

patrikG wrote:HTML doesn't actually make a difference whether or not you use quotes around values. :)
It does if there is a space in the value, plus HTML is slowly but surely going to give way to XHTML which does require that all attribute values are quoted with double quotes. It's a good idea to get into the habit of that now so your code won't have issues with browsers in the long run.

Mac
Post Reply