/    Sign up×
Community /Pin to ProfileBookmark

hi, im an amateur at php.. just having problems with my dissertation.. i have made my database using phpmyadmin, im using php triad, i found this was working for me, neways, im trying to pull the data out of my database, i have a text book im following etc.. but.. having real trouble at this scrip

[CODE] <?php
//connect database
$conn = mysql_connect (“localhost”, “”, “”)
or die(mysql_error());
mysql_select_db(“tiles”,$conn);

$display_block = “Tiles Categories</h1>
<P>Select a category to see items</P>”;

//show categories first
$get_cats = “select id, cat_title, cat_desc from
categories order by cat_title”;
$get_cats_res = mysql_query($get_cats) or die(mysql_error());

if (mysql_num_rows($get_cats_res) < 1) {
$display_block = “<P><em> Sorry , no categories to browse. </em></p>”;
} else {

While ($cats = mysql_fetch_array($get_cats_res)) {
$cat_id = $cats[id];
$cat_title = strtoupper(stripslashes($cats[cat_title]));
$cat_desc = stripslashes ($cats[cat_desc]);

$display_block .= “<p><strong><a
href=”$_SERVER[PHP_SELF]?cat_id=$cat_id”>$cat_title</a></strong>
<br>$cat_desc</p>;

if ($_GET[cat_id] == $cat_id) {
//get items
$get_items = “select id, item_title, item_price
from items where cat_id = $cat_id
order by item_title”;
$get_items_res = mysql_query($get_items) or die(mysql_error());

if (mysql_num_rows($get_items_res) < 1) {
$display_block = “<P><em>Sorry, no items in
this category.</em></p>”;
} else {

$display_block .= “<ul>;

while ($items = mysql_fetch_array($get_items_res)) {
$item_id = $items[id];
$item_title = stripslashes($items[item_title]));
$item_price = $items[item_price];

$display_block .= “<li><a
href=”showitem.php?item_id=$item_id”.$item_title</a>
</strong> ($$item_price)”;
}

$display_block .= “</ul>”;
}
}
}
}
?>
<HTML>
<HEAD>
<TITLE> Tiles Library</TITLE>
</HEAD>
<BODY>
<?php echo $display_block; ?>
</BODY>
</HTML>

[/CODE]

mozilla says its a error on line 30, iv checked everything.. really dont knw what the prblem is.. if anyone could have a quick look it would be appreciated. thanx

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@chazzyMar 24.2006 — you never closed your double quote in this area:

[code=php]
$display_block .= "<p><strong><a
href="$_SERVER[PHP_SELF]?cat_id=$cat_id">$cat_title</a></strong>
<br>$cat_desc</p>;
[/code]
Copy linkTweet thisAlerts:
@mohammed_hajatauthorMar 24.2006 — cheers dude.. gone a bit square eyed with all the code..
Copy linkTweet thisAlerts:
@mohammed_hajatauthorMar 24.2006 — can you see anything wrong with line 48???
Copy linkTweet thisAlerts:
@chazzyMar 24.2006 — you have the same problem on line 41

[code=php]
$display_block .= "<ul>;
[/code]


and 48-50 should be
[code=php]
$display_block .= "<li><a
href="showitem.php?item_id=$item_id".$item_title</a>
</strong> ($$item_price)";
[/code]
Copy linkTweet thisAlerts:
@mohammed_hajatauthorMar 24.2006 — legend mate.. thank you soo much.
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYMar 24.2006 — You should use a syntax-highlighting text editor if you don't already
Copy linkTweet thisAlerts:
@mohammed_hajatauthorMar 25.2006 — where do i get one of them from???
×

Success!

Help @mohammed_hajat spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...