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
cereal
Forum Newbie
Posts: 8 Joined: Wed Oct 02, 2002 10:27 am
Location: Belgium
Contact:
Post
by cereal » Wed Oct 02, 2002 10:27 am
k, what doe sthis error mean?
Parse error: parse error, unexpected T_VARIABLE in d:\phpdev5\www\public\projects\xtrition\poems.php on line 52
Code: Select all
<? $edge_cleanpage = true; ?>
<? include('poems.config.php') ?>
<? include('edge.header.php'); ?>
<?
$tem = (int)$tem;
$fil = checkstr_($fil);
?>
<br>
<br>
<?
if ($tem='')
{
echo '<center><a href=poems.php?tem=1>'.$edge_poemї1].'</a><br>
<a href=poems.php?tem=0>'.$edge_poemї0].'</a></center>';
}
else
{
edge_do_title('<font size=-1>'.$edge_poemї$tem].'</font>');
if (!$fil)
{
echo 'please choose the auhors name.<br>';
echo '<a href=poems.php?tem='.$tem.'&fil=a>a</a> -
<a href=poems.php?tem='.$tem.'&fil=b>b</a> -
<a href=poems.php?tem='.$tem.'&fil=c>c</a> -
<a href=poems.php?tem='.$tem.'&fil=d>d</a> -
<a href=poems.php?tem='.$tem.'&fil=e>e</a> -
<a href=poems.php?tem='.$tem.'&fil=f>f</a> -
<a href=poems.php?tem='.$tem.'&fil=g>g</a> -
<a href=poems.php?tem='.$tem.'&fil=h>h</a> -
<a href=poems.php?tem='.$tem.'&fil=i>i</a> -
<a href=poems.php?tem='.$tem.'&fil=j>j</a> -
<a href=poems.php?tem='.$tem.'&fil=k>k</a> -
<a href=poems.php?tem='.$tem.'&fil=l>l</a> -
<a href=poems.php?tem='.$tem.'&fil=m>m</a> -
<a href=poems.php?tem='.$tem.'&fil=n>n</a> -
<a href=poems.php?tem='.$tem.'&fil=o>o</a> -
<a href=poems.php?tem='.$tem.'&fil=p>p</a> -
<a href=poems.php?tem='.$tem.'&fil=q>q</a> -
<a href=poems.php?tem='.$tem.'&fil=r>r</a> -
<a href=poems.php?tem='.$tem.'&fil=s>s</a> -
<a href=poems.php?tem='.$tem.'&fil=t>t</a> -
<a href=poems.php?tem='.$tem.'&fil=u>u</a> -
<a href=poems.php?tem='.$tem.'&fil=v>v</a> -
<a href=poems.php?tem='.$tem.'&fil=w>w</a> -
<a href=poems.php?tem='.$tem.'&fil=x>x</a> -
<a href=poems.php?tem='.$tem.'&fil=y>y</a> -
<a href=poems.php?tem='.$tem.'&fil=z>z</a>';
}
else
{
$quer = 'SELECT * FROM poems WHERE author like '%$fil%' AND theme='$edge_poemї$tem]' ORDER BY author'
}
}
?>
<? include('edge.footer.php'); ?>
its this line
Code: Select all
$quer = 'SELECT * FROM poems WHERE author like '%$fil%' AND theme='$edge_poemї$tem]' ORDER BY author'
Last edited by
cereal on Wed Oct 02, 2002 10:33 am, edited 1 time in total.
mydimension
Moderator
Posts: 531 Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:
Post
by mydimension » Wed Oct 02, 2002 10:30 am
in this line (i think): $quer = 'SELECT * FROM poems WHERE author like '%$fil%' AND theme='$edge_poem[$tem]' ORDER BY author'
you need to use the concatenate operator ( . ) to join multiple stings. it shouls look like this:
$quer = 'SELECT * FROM poems WHERE author like ' . %$fil% . ' AND theme=' . $edge_poem[$tem] . ' ORDER BY author'
Wayne
Forum Contributor
Posts: 339 Joined: Wed Jun 05, 2002 10:59 am
Post
by Wayne » Wed Oct 02, 2002 10:40 am
try replacing
Code: Select all
$quer = 'SELECT * FROM poems WHERE author like '%$fil%' AND theme='$edge_poemї$tem]' ORDER BY author'
with
Code: Select all
$quer = "SELECT * FROM poems WHERE author like '%$fil%' AND theme='$edge_poemї$tem]' ORDER BY author"
cereal
Forum Newbie
Posts: 8 Joined: Wed Oct 02, 2002 10:27 am
Location: Belgium
Contact:
Post
by cereal » Wed Oct 02, 2002 10:58 am
mydimension wrote: in this line (i think): $quer = 'SELECT * FROM poems WHERE author like '%$fil%' AND theme='$edge_poem[$tem]' ORDER BY author'
you need to use the concatenate operator ( . ) to join multiple stings. it shouls look like this:
$quer = 'SELECT * FROM poems WHERE author like ' . %$fil% . ' AND theme=' . $edge_poem[$tem] . ' ORDER BY author'
well this did the trick, thanks
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Wed Oct 02, 2002 12:13 pm
Shouldn't this:
Code: Select all
$quer = 'SELECT * FROM poems WHERE author like ' . %$fil% . ' AND theme=' . $edge_poemї$tem] . ' ORDER BY author'
be
Code: Select all
$quer = "SELECT * FROM poems WHERE author like '%".$fil."%' AND theme='". $edge_poemї$tem]."' ORDER BY author";
You really need single quotes around strings when you are writing a query and the wilcards (% symbols) need to be inside the string not next to the variable name.
Mac
cereal
Forum Newbie
Posts: 8 Joined: Wed Oct 02, 2002 10:27 am
Location: Belgium
Contact:
Post
by cereal » Thu Oct 03, 2002 8:55 am
well now i get the same error in this script
Code: Select all
<table border = "0">
<tr>
<td>Nick</td><td>Real Name</td>
</tr>
<?
$q = "Select * From people WHERE betaald = '2' ORDER BY nick"
$res = mysql_db_query($edge_database,$q,$mysql);
while ($row = mysql_fetch_object($res))
{
echo '<tr><td>' . $row->nick . '</td><td>' . $row->name . '</td></tr>';
}
?>
</table>
in this line
Code: Select all
$res = mysql_db_query($edge_database,$q,$mysql);
Cereal
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Thu Oct 03, 2002 9:00 am
You forgot a semi-colon (;) at the end of this line:
Code: Select all
$q = "Select * From people WHERE betaald = '2' ORDER BY nick"
Don't use mysql_db_query() it has been deprecated, use mysql_select_db() and mysql_query() instead. You should also add some error handling. Eg. this:
Code: Select all
mysql_select_db($edge_database) or die(mysql_error());
$res = mysql_query($q) or die(mysql_error());
instead of
Code: Select all
$res = mysql_db_query($edge_database,$q,$mysql);
Mac