GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 06-Oct-2004, 04:59
bwd bwd is offline
New Member
 
Join Date: Oct 2004
Posts: 4
bwd is on a distinguished road

T variable error in php code


I'm getting an error saying

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/sites/site31/web/showitems.php on line 13


here is my code.

PHP Code:

<?
$CID=$_GET['CID'];
$TID=$_GET['TID'];

include 'templates/toptemplate.php'; ?>
    <td width="790" valign="top" background="images/screen_back.gif" class="screentext"><table width="100%" border="0" cellspacing="0" cellpadding="6">
        <tr> 
          <td valign="top" align="center" class="screentext"> <p><strong>Your Chosen Items</strong></p>
            <p>

<? 
$group=urlencode($_GET['group']); 
include "http://www.website.com/content/item-list.php?CID=612&TID=$_GET['TID']&group=$group&list_columns=5&list_rows=6&link_url=orderitem.php&list_page=$_GET['index']&list_in_new=0&cat=$_GET['cat']"; 
?>


</p>
            </td>
        </tr>
      </table></td>
  </tr>
</table>

</body>
</html>

I can not see any problems but have been looking at it and working on it for a while so might be overlooking something.

can anyone see any problems?

thanks
Last edited by LuciWiz : 06-Oct-2004 at 05:06. Reason: Please insert your php code between [php] [/php] tags
  #2  
Old 06-Oct-2004, 05:39
Allowee's Avatar
Allowee Allowee is offline
Regular Member
 
Join Date: May 2003
Location: The Netherlands
Posts: 339
Allowee has a spectacular aura about
I'm not able to reproduce this error (on PHP 5.0.1)
but you could try quoting your vars, like
PHP Code:

include "http://www.website.com/content/item-list.php?
CID=612&
TID=".$_GET['TID']."&
group=".$group."&
list_columns=5&
list_rows=6&
link_url=orderitem.php&
list_page=".$_GET['index']."&
list_in_new=0&
cat=".$_GET['cat']; 


__________________
Pastebin
PHP Documentation Site
Allowee's Blog http://allowee.net
  #3  
Old 06-Oct-2004, 07:28
bwd bwd is offline
New Member
 
Join Date: Oct 2004
Posts: 4
bwd is on a distinguished road
Quote:
Originally Posted by Allowee
I'm not able to reproduce this error (on PHP 5.0.1)
but you could try quoting your vars, like
PHP Code:

include "http://www.website.com/content/item-list.php?
CID=612&
TID=".$_GET['TID']."&
group=".$group."&
list_columns=5&
list_rows=6&
link_url=orderitem.php&
list_page=".$_GET['index']."&
list_in_new=0&
cat=".$_GET['cat']; 




Thanks

I tried this and got the error

Warning: Failed opening 'http://www.website.com/content/item-list.php? CID=612& TID=8& group=java games& list_columns=5& list_rows=6& link_url=orderitem.php& list_page=& list_in_new=0& cat=' for inclusion (include_path='.:/usr/local/lib/php') in /home/sites/site31/web/showitems.php on line 22


I'm off to check the permissions of the file.

thanks

lee
  #4  
Old 06-Oct-2004, 08:47
Allowee's Avatar
Allowee Allowee is offline
Regular Member
 
Join Date: May 2003
Location: The Netherlands
Posts: 339
Allowee has a spectacular aura about
hmm, for some reason the php tags add a space after each line.

it works fine when you remove the space after each line.

if this file is a local file(because you mentioned permission) it would be better to include it local, but that can only be done if it's on the same server
__________________
Pastebin
PHP Documentation Site
Allowee's Blog http://allowee.net
  #5  
Old 06-Oct-2004, 09:18
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Hello bwd,

You just have to remember that if you insert an array inside a string, between double quotes, you can write something like $_GET['TID'] the following ways:

PHP Code:

<?php

$str = "What's the value? {$_GET['TID']}";

// OR

$str = "What's the value? $_GET[TID]";

?>

  #6  
Old 06-Oct-2004, 09:22
bwd bwd is offline
New Member
 
Join Date: Oct 2004
Posts: 4
bwd is on a distinguished road
Thanks

I'm just upgrading to PHP5.0.2 now so hopefully this will sort the problem out and I can use my original code.

If not I will try removing the spaces.

either way I'll let you know the outcome.

regards

lee
  #7  
Old 06-Oct-2004, 09:43
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
This has nothing to do with PHP being version 4 or 5. It will report the same error if you do not make the changes that Allowee or I suggested above.
  #8  
Old 06-Oct-2004, 09:48
bwd bwd is offline
New Member
 
Join Date: Oct 2004
Posts: 4
bwd is on a distinguished road
Quote:
Originally Posted by JdS
This has nothing to do with PHP being version 4 or 5. It will report the same error if you do not make the changes that Allowee or I suggested above.


I just tried allowee's way and still get the same error.

I'll try the other way.

Lee
  #9  
Old 06-Oct-2004, 09:55
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
I also am not certain why there's a space after the newline on the web page cause I can't find them in the HTML source... anyway, let me edit Allowee's suggestion for you and it shouldn't fail if you try this instead:

PHP Code:

<?

include "http://www.website.com/content/item-list.php?CID=612&TID=".$_GET['TID'].
"&group=".
$group.
"&list_columns=5&list_rows=6&link_url=orderitem.php&list_page=".
$_GET['index'].
"&list_in_new=0&cat=".
$_GET['cat'];

?>

 
 

Recent GIDBlogFirst week of IA training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Formatting C / C++ code WaltP C Programming Language 1 06-Jan-2008 23:59
Parsing PHP code that's stored in a database. JdS MySQL / PHP Forum 3 13-May-2004 09:15
PHP code snippet library - Anyone have any use for this? jrobbio MySQL / PHP Forum 1 02-Mar-2003 15:18

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 00:53.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.