473,809 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with my SELECT

Hi,

I have a page with a link

<a href="Contribut or.php?action=& SubCat=<?php echo $row["writer"];
?>"><?php echo $row["writer"];?></a>

that does to a page with a SELECT

$query = "SELECT * FROM news WHERE writer='$SubCat ' ";

But it is not pulling any data from the database. If I do this
$query = "SELECT * FROM news WHERE writer='Bob Smith' ";
works great??

also
the ULR reads -
Contributor.php ?action=&SubCat =Bob%20Smith
so I know the link is correct ....

but for the life of me I can't figure out whats wrong with the SELECT
statement?

If anyone can help me with this I would be forever in your Debt.

Thanks

here is the complete Contributor.php script.

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><!--
#BeginTemplate "/Templates/journ.dwt" -->
<head>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1" />
<!-- #BeginEditable "doctitle" -->
<title>paper</title>
<!-- #EndEditable -->
<link rel="stylesheet " href="Styles/template.css" type="text/css" />
</head>
<body>

<div id="container" >
<div id="logo"><img src="Images/logo.jpg" border="0"
alt="logo"></div>
<div id=bar><form action="a.php" method="POST">
<label for="searchtxt" >Search our archives:</label>
<input id="searchtxt" type="text" name="searchtxt " value="" />
<input class="button" type="submit" value="Search" /></form>
</div>
<div id="header">
<!-- #BeginEditable "Adds" --><div
id="athlete"><i mg
src="../Images/Athlete.gif" border="0" alt="AthleteMon th">
<img src="../Images/AthleteMonth.jp g"
border="0"
alt="AthleteMon th"><br>
Susan smith</div>
<br>
<? include("Ads.ph p") ?><!--
#EndEditable -->
</div>
<div id="sidebar">

<div id=writer>Your News</div>
<div id="navcontaine r">

<ul id="navlist">
<table>
<?
$query = "SELECT DISTINCT cat FROM news";
$result = mysql_query($qu ery)
or die ("no can do.");
while($row = mysql_fetch_arr ay($result))
{
?>
<tr>
<td>
<li><a href="../<?php echo $row["cat"];?>"><?php echo
$row["cat"];?></a></li>
</td>
</tr>
<?php
}
?>
</table>
------------------------
<li><a href="Classifie d.php">Classifi ed Ads</a></li>
<li><a href="Advertise .php">Advertise With Us</a></li>
<li><a href="About.php ">About Us</a></li>
<li><a href="FindUs.ph p">Contact Us</a></li>
</ul>
</div>
<div id=writer>Visit our Sponsor</div>
<!-- #BeginEditable "Left" -->{Left}<!--
#EndEditable -->
</div>
<!-- #BeginEditable "middle" -->
<!--
-----------------------------------------NEWS-------------------------------------------------------------
-->
<div id="content">
<div id="bodymenu">N ews</div>
<table>
<?
$query = "SELECT * FROM news WHERE writer='$SubCat ' ";
$result = mysql_query($qu ery)
or die ("no can do.");
while($row = mysql_fetch_arr ay($result))
{
?>
<tr>
<td>
<div id="bodyhead">< ?php echo $row["heading"];?></div>
</td>
<td>
Issue: <a href="#"><?php echo $row["date"];?></a>
</td>
</tr>
<tr>
</tr>
<tr>
<td colspan=2>
<div id=bodywords>
<?php
$abc = ($row["article"]);
$abc=substr($ab c,0,400);
echo $abc;
?>
......<span class="class1"> <a href="#">Read the article</a></span>
</div>
</td>
</tr>
<?php
}
?>
</table>
</div>
<!-- #EndEditable --</div>

</body>
<!-- #EndTemplate --></html>

Oct 26 '06
12 1680
Jeasus - I hope I'm not Top Posting and I have deleted the above post
all together ....

anyway - here is what it spits at me

Parse error: syntax error, unexpected '}' in
/home/journ6/public_html/Contributor.php on line 102

Oct 26 '06 #11
Rik
bokke wrote:
Jeasus - I hope I'm not Top Posting and I have deleted the above post
all together ....
Well, that's a way to do it, normally you keep the relevant parts of the
previous post in your reply. Remember this is usenet: others my not see a
previous post, which could arrive later or not at all, and could still be
interested to know what the conversation is about.
anyway - here is what it spits at me

Parse error: syntax error, unexpected '}' in
/home/journ6/public_html/Contributor.php on line 102

Well, that's not related to it, as this is a parse error.
Check your php code, the '}' is not in my snippit....

--
Rik Wasmus
Oct 26 '06 #12
Rick you genius ---- aftre 2 days - 40 coffees - I am left with this!

<?
$query = "SELECT * FROM news WHERE
writer='".mysql _real_escape_st ring($_GET["SubCat"])."'";
$result = mysql_query($qu ery)
or die ("no can do.");
while($row = mysql_fetch_arr ay($result))
{
?>

works like a charm!!!!!!

used to have this

$query = "SELECT * FROM news WHERE writer='$SubCat ' ";
$result = mysql_query($qu ery)
or die ("no can do.");
while($row = mysql_fetch_arr ay($result))
{

Thanks man - thank you - sorry about the topposting et all

Oct 26 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3412
by: nanookfan | last post by:
Hi all, I'm having a bizarre problem converting XML files to HTML using an XSLT. The problem is only occuring in my Netscape 7.0 browser. What makes it more bizarre is that it is only happening when I put my XML files and the .xsl files on my ISP's system for my home page. If I try to open the XML files in Netscape 7.0 on my own machine (ie, not on the ISP's system), the pages convert file and the result is displayed in HTML.
5
7423
by: Clifford W. Racz | last post by:
Has anyone solved the issue of translating lists in Word 2003 (WordML) into xHTML? I have been trying to get the nested table code for my XSLT to work for a while now, with no way to get the collection that I need. To begin, I am using xsltproc that conmes with Cygwin as my processor. I have no particular affinity to this processor except that it is open source and standards compliant. I don't like M$, but if using a M$ processing...
5
1598
by: Nick Shaw | last post by:
Hi, I'm trying to put my resume on my website, and I want to do it using XML and XSL. If I don't include the schema in the mix, the xml displays without a problem. When I add the schema location to the xml, however, it doesn't seem to be displaying the html tags. It just puts all the information on the screen in one big block, almost like it's reading the xml information, but not the html I have in my XSL. I know all the XML/XSL/XSD...
3
6120
by: DarthMacgyver | last post by:
Hello, I recently wrote a survey application. Each question is very similar. The first questions gives me a problem when there are multiple people taking the survey (The Database connection Timed out) I am using the Data Access Application Blocks as ASP.NET (using VB.NET) and SQL 2000. In there first question there can be up to 27 answers. So I figured instead of making 27 different trips to the database I woulc just concatenate my...
8
3375
by: mytfein | last post by:
Hi Everyone, Background: Another department intends to ftp a .txt file from the mainframe, for me to process. The objective is to write a vb script that would be scheduled to run daily to process this .txt file. Goal: I am working on a vba script to:
2
9931
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell (multi-select without modifier keys). I got that working fine, but I also wanted to keep rows selected after a sort, which I do by storing the row's id in an arraylist. The idea was to do the sort and then go back and re-select the rows with that...
20
2516
by: Development - multi.art.studio | last post by:
Hello everyone, i just upgraded my old postgres-database from version 7.1 to 7.4.2. i dumped out my 7.1 database (with pg_dump from 7.1) as an sql-file with copy-commands and to one file using insert-statements. after initalizing and starting postgres 7.4 on a different port and datadirectory, i tried to import the sql-dump with the copy statements. this import fails, but importing the dump-file with inserts took a long time but was...
4
4347
by: Christofer Dutz | last post by:
Hi, I am having a small problem, that is driving me nuts. My application reads some Xml and runs 2 Xsl Transformations to generate HTML. As soon as my second XSL introduces some <br/tags, the application crashes with the same error message I would get when writing <brand no closing tag. To make everything a little stranger, even <br></brseems to be bad while <lbr/is fine. Ive tried some other tag names and the problem only appears with...
2
2289
by: Ravi Joshi | last post by:
The menu on my site works fine in IE6 and Firefox. In IE7, there is a problem with the menu: when you mouse over the various main catagories, the sub-catagories all appear to the right as they should; however, as soon as you mouse towards any but the TOP sub-catagory, all those sub-catagories still view there. It will work first time quite fine..but if user clicks outsite anywhere in screen then this problem occur.. i think it's css...
2
3158
by: swethak | last post by:
Hi, I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error message as in alert box as " Internet Explorer cannot open the Internet site http://google.citycarrentals.com.au/viewalllocations.php . Operation aborted". It is working in Mozilla . Here i mentioned my code . I am facing this problem several...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10640
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
10376
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...
1
10387
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10120
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
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
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
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.