473,787 Members | 2,938 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dont know how to get rid of syntax error, unexpected T_VARIABLE

53 New Member
i have check the code thoroughly to find the error i am still getting the following error: Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\Cat alogue.php on line 23
[php]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<?php
$conn = mysql_connect(" localhost","roo t","")
or die (mysql_error()) ;
mysql_select_db ("Shop_Test",$c onn) or die (mysql_error()) ;

$display_block = "<h1>Categories </h1>
<p>Select Category</p>";

$get_cat = "SELECT Cat_ID, cat_title, cat_description FROM Store_Categorie s ORDER BY cat_title";
$get_cat_result = mysql_query ($get_cat) or die (mysql_error()) ;

if (mysql_num_rows ($get_cat_resul t) < 1) {
$display_block = "<p><em>I'm sorry nothing to browse.</em></p>";
} else {

while ($cat = mysql_fetch_arr ay($get_cat_res ult)) {
$Cat_ID = $cat[Cat_ID];
$cat_title = strtoupper (stripslashes($ cat[cat_title]));
$cat_desc = stripslashes ($cat[cat_description]);

$display_block .= "<p><a
href=\ "$_SERVER['PHP_SELF']?Cat_ID=$Cat_ID \">$cat_titl e</a><br>$cat_desc </p>";


if ($_GET[Cat_ID] == $Cat_ID) {
$get_items = "SELECT Store_ID, Item_title, Item_Price FROM
Store_Items WHERE Cat_ID = $Cat_ID
ORDER BY Item_Title";
$get_item_resul ts = mysql_query ($get_items) or die (mysql_error()) ;

if (mysql_num_rows ($get_item_resu lts) < 1 {
$display_block = "<p><em>Sor ry No Items</em></p>";
} else {

$display_block .= "<ul>";

while ($items = mysql_fetch_arr ay ($get_items_res ults)) {
$item_id = $items [Store_ID];
$item_title = stripslashes ($items[Item_Title]);
$item_price = $items[Item_Price];

$display_block .= "<li><a href=\ "showitem.php?i tem_id=$item_id \ ">$item_tit le</a>
/</strong> (\$$item_price) ";
}

$display_block .= "<ul>";
}
}
}
}
?>[/php]
sorry bout the layout. i have specified the part which says has an error
really appreciate the help.

To make it more clear enclose any code within the proper code tags. - moderator
Feb 25 '08 #1
7 2225
Markus
6,050 Recognized Expert Expert
Change it to:
[php]
$display_block .= "<p><a
href=\
"" . $_SERVER['PHP_SELF'] . "?Cat_ID=$Cat_I D\">$cat_titl e</a><br>$cat_desc </p>";
[/php]
Welcome to theScripts.

Please remember to post code using the code tags, if you want to keep posting here.
Feb 25 '08 #2
ashraf02
53 New Member
i have check the code thoroughly to find the error i am still getting the following error: Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\Cat alogue.php on line 23

[PHP]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<?php
$conn = mysql_connect(" localhost","roo t","")
or die (mysql_error()) ;
mysql_select_db ("Shop_Test",$c onn) or die (mysql_error()) ;

$display_block = "<h1>Categories </h1>
<p>Select Category</p>";

$get_cat = "SELECT Cat_ID, cat_title, cat_description FROM Store_Categorie s ORDER BY cat_title";
$get_cat_result = mysql_query ($get_cat) or die (mysql_error()) ;

if (mysql_num_rows ($get_cat_resul t) < 1) {
$display_block = "<p><em>I'm sorry nothing to browse.</em></p>";
} else {

while ($cat = mysql_fetch_arr ay($get_cat_res ult)) {
$Cat_ID = $cat[Cat_ID];
$cat_title = strtoupper (stripslashes($ cat[cat_title]));
$cat_desc = stripslashes ($cat[cat_description]);

$display_block .= "<p><a
href=\ "$_SERVER['PHP_SELF']?Cat_ID=$Cat_ID \">$cat_titl e</a><br>$cat_desc </p>";

if ($_GET[Cat_ID] == $Cat_ID) {
$get_items = "SELECT Store_ID, Item_title, Item_Price FROM
Store_Items WHERE Cat_ID = $Cat_ID
ORDER BY Item_Title";
$get_item_resul ts = mysql_query ($get_items) or die (mysql_error()) ;

if (mysql_num_rows ($get_item_resu lts) < 1 {
$display_block = "<p><em>Sor ry No Items</em></p>";
} else {

$display_block .= "<ul>";

while ($items = mysql_fetch_arr ay ($get_items_res ults)) {
$item_id = $items [Store_ID];
$item_title = stripslashes ($items[Item_Title]);
$item_price = $items[Item_Price];

$display_block .= "<li><a href=\ "showitem.php?i tem_id=$item_id \ ">$item_tit le</a>
/</strong> (\$$item_price) ";
}

$display_block .= "<ul>";
}
}
}
}
?>[/PHP]
Feb 25 '08 #3
ashraf02
53 New Member
Change it to:
[php]
$display_block .= "<p><a
href=\
"" . $_SERVER['PHP_SELF'] . "?Cat_ID=$Cat_I D\">$cat_titl e</a><br>$cat_desc </p>";
[/php]
Welcome to theScripts.

Please remember to post code using the code tags, if you want to keep posting here.
Thanks alot mate i really appreciate it
Feb 25 '08 #4
ronverdonk
4,258 Recognized Expert Specialist
One error is in 23
[php]$display_block .= "<p><a href=\"{$_SERVE R['PHP_SELF']}?Cat_ID=$Cat_I D\">$cat_titl e</a><br>$cat_desc </p>";[/php]
the other one is in stmt 31
[php]if (mysql_num_rows ($get_item_resu lts) < 1) {[/php]
another in stmt 41[php]$display_block .= "<li><a href=\"showitem .php?item_id=$i tem_id\">$item_ title</a>
/</strong> (\$$item_price) ";[/php]Ronald
Feb 25 '08 #5
ashraf02
53 New Member
One error is in 23
[php]$display_block .= "<p><a href=\"{$_SERVE R['PHP_SELF']}?Cat_ID=$Cat_I D\">$cat_titl e</a><br>$cat_desc </p>";[/php]
the other one is in stmt 31
[php]if (mysql_num_rows ($get_item_resu lts) < 1) {[/php]
another in stmt 41[php]$display_block .= "<li><a href=\"showitem .php?item_id=$i tem_id\">$item_ title</a>
/</strong> (\$$item_price) ";[/php]Ronald
Thanks alot roger i was gonna post another error but u already pointed it out. really appreciate it.
Feb 25 '08 #6
ashraf02
53 New Member
Thanks alot roger i was gonna post another error but u already pointed it out. really appreciate it.
Ronver sorry !!!! not roger lol
Feb 25 '08 #7
ronverdonk
4,258 Recognized Expert Specialist
It's okay. Glad to be of help. And see you again.

Ronald
Feb 25 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
11627
by: bovanshi | last post by:
got this annoying error I'm completly new to php... and i have no clue what is wrong here, from what i can tell there is nothing rong with this code... but that isn't what the borwser say :P Parse error: parse error, unexpected T_VARIABLE in main.php on line 15 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title></title>
1
1406
by: mdouble | last post by:
I'm a complete novice with HTML and PHP. Recently I purchased an auto responder that requires me to edit a PHP file during the installation process as per directions provided in a read me file. After editing the required file (globals.php) I am directed to run the installation program on the website by using my browser. However, on doing is I am presented with an error message as follows: Parse error: parse error, unexpected...
4
4413
by: needhelp08 | last post by:
I am getting the error Parse error: syntax error, unexpected T_VARIABLE on line 4 but I can't seem to find what is wrong. Could someone please help. <?php $conn = @mysql_connect("localhost", "root", "password ") $rs1 = @mysql_create_db( $_REQUEST ); $rs2 = @mysql_list_dbs( $conn ); for( $row =0; $row < mysql_num_rows( $rs2 ); $row++ ) { $list .= mysql_tablename( $rs2, $row) ." | "; }
1
2192
by: msara | last post by:
I cant understand the error of this programm <? php $email = $_REQUEST ; $message = $_REQUEST ; mail( "info@premierentals.com","Feedback Form Results",$message, "From: $email" ); header( "Location: http://www.premierentals.com/thankyou.html" );
5
1357
by: sravani2 | last post by:
Hi, i used the below sentence echo "<td><a href=<?=$row?>>".$row."</a></td>"; In that i got the error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /usr/local/etc/httpd/sites/tanbo.com/abstractgamearchive/mockup/designers.php on line 169 what's the mistake in that.Plz tell that.
2
3245
by: fburn | last post by:
I need some help with an error I'm getting using php 5.2.5 running on linux. I receive an error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/html/inventoryControl/supplier.php on line 26 (line number changed to match code tags) The code is as follows: // get a supplier using the supplier id
5
3010
by: stanman | last post by:
I have been trying to get past this error all day. I am unable to determine why I get syntax error from the following code: //modify a record $myDataID = mysql_query("UPDATE members SET first_name = $name_update WHERE email = $targetEmail", $connectID); Can someone tell me what is wrong with this. Thank You Gerald Stanley
6
2661
by: mushfiq | last post by:
hi.i have got a problem. error message: Parse error: syntax error, unexpected T_VARIABLE in c:\wamp\www\dynamic2.php on line 12 for the line:
3
5068
by: broll911 | last post by:
I am gettin a error message on this script can someone help me. I am a complete newbie on this stuff. Thanks in advance for any help you can give me. here is the error. Parse error: syntax error, unexpected T_VARIABLE in /home/content/m/i/x/mixxsalon/html/FormToEmail.php on line 1 here is the code. <?php $my_email = "user@example.com"; /*
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10172
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.