Hi,
I am stuck again over something silly that I can not resolve.
I am using a link to create a dynamic page.
the link is itself written from the same same table that the dynamic page is written from, so the data must be ok (or the link wouldn't be there )
Anyway the link is :
<a href="expert_disp.php?a=Dave" > Dave Casey </a>
(thats from the source )
Clicking on it runs expert_disp.php: - /*
-
* expert_disp.php
-
*
-
*/
-
@session_start();
-
$page="start";
-
-
require_once("my_functions.php");
-
-
if (@$_SESSION['auth'] == "yes" ){
-
require_once("mem_head.php");
-
} // end if
-
else {
-
require_once("a_head.php");
-
} // end if
-
-
$expert = safe_sql($_GET["a"]);
-
-
echo "Expert: $expert";
-
-
$sql = "SELECT * FROM `clients`
-
WHERE user_id = 'Fred' ";
-
-
$result = mysql_query($sql) or die("could not execute FIND MEMBER query". mysql_error() );
-
-
$row = mysql_fetch_array($result, MYSQL_ASSOC);
-
extract($row);
-
Now that echo displays :
Expert: Dave
and then I get an error:
could not execute FIND EXPERT query Unknown column 'Dave' in 'where clause'
Now the table has user_id as its Primary Key so why am I getting this error ?
I am not looking in a column Dave but in user_id.
Can anyone help ?
Have mis coded this simple query ?
6 1397 Atli 5,058
Expert 4TB
Hi.
The query you posted cant really be causing this error. There are no variables in it. The only value, 'Fred', is hard-coded into it.
So there must be some other explanation for this error. Something that isn't in the code you just posted.
Could something in the "my_functions.php", "mem_head.php" or "a_head.php" files be causing this?
Or possibly in the safe_sql() function?
That's strange; it says you're looking for a column named Dave, but in your query I don't see that. I'm guessing you must've edited to code, maybe?
Thanks for looking into this.
I have taken out that safe_sql() in case it was effecting things.
I have deleted the query line completely and re-typed it.
But no change - still this funny error :(
Here is my new code: - @session_start();
-
$page="start";
-
-
require_once("my_functions.php");
-
-
if (@$_SESSION['auth'] == "yes" ){
-
require_once("mem_head.php");
-
} // end if
-
else {
-
require_once("a_head.php");
-
} // end if
-
-
$expert = $_GET["a"];
-
-
echo "Expert: $expert";
-
-
$sql = "select * from clients where user_id = $expert";
-
-
$result = mysql_query($sql) or die("could not execute FIND MEMBER query". mysql_error() );
-
-
$row = mysql_fetch_array($result, MYSQL_ASSOC);
-
extract($row);
-
My database table set up is like this: - $sql = "CREATE TABLE `clients` (
-
`confirm` char(1) NOT NULL default '',
-
`type` char(1) NOT NULL default '',
-
`user_id` varchar(25) NOT NULL default '',
-
`page` varchar(25) NOT NULL default '',
-
`profile` text NOT NULL default '',
-
`blog` text NOT NULL default '',
-
`lig_pos` int(3) default '0',
-
`contact` varchar(25) NOT NULL default '',
-
`sc_name` varchar(25) NOT NULL default '',
-
`email` varchar(40) NOT NULL default '',
-
`pass` varchar(255) NOT NULL default '',
-
`ref_count` int(3) default '0',
-
`create_date` int(12) default NULL,
-
`last_date` int(12) default NULL,
-
`refd_by_name` varchar(25) NOT NULL default '',
-
`refd_by_email` varchar(40) NOT NULL default '',
-
`vote_count` int(3) default '0',
-
`vid_count` int(3) default '0',
-
`art_count` int(3) default '0',
-
`free_prod` int(3) default '0',
-
`sell_prod` int(3) default '0',
-
KEY `lig_pos` (`lig_pos`),
-
KEY `email` (`email`),
-
PRIMARY KEY (user_id)
-
-
) ENGINE=MyISAM DEFAULT CHARSET=latin1";
-
-
Notice that user_id is NOT numeric but a string.
So whats the problem ???
OK
Its solved !!
I was missing single quotes from this expression:
$sql = "SELECT prod_id,prod_name FROM `products` WHERE user_id = $expert";
it must be
$sql = "SELECT prod_id,prod_name FROM `products` WHERE user_id = '$expert' ";
Thank you very much for your help.
@jeddiki
Remember to post the correct markup. Your first post had absolutely nothing wrong with it, but that wasn't the code that was causing the error. Please remember this in future.
Markus.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Rupa |
last post by:
Hi,
I'm trying to write an xslt to convert an email in xml format to a new
xml format.
<descr>
<xsl:choose> <xsl:value-of select="body"> </xsl:value-of select>
<xsl:when test=" <xsl:value-of...
|
by: williamc |
last post by:
Is there anything wrong with having several classes with the same name
in the same style sheet? Something like...
div.pagedown {
margin: 20px 0px 20px 0px;
border-top: 1px solid #caa;...
|
by: Jim Hubbard |
last post by:
It seems that Microsoft not only does not need the classic Visual Basic
developer army (the largest army of developers the world has ever seen), but
now they don't need ANY Windows developer at a...
|
by: Randell D. |
last post by:
Folks,
I have a table of addresses and a seperate table with contact names -
All addresses tie to one or more names - I would like to keep track of
the number of names 'belonging' to an address...
|
by: Bkr |
last post by:
Gurus,
Here is what I ma trying to do. I have numeric expression stored in a
table column. for e.g. @a + @b + @c. I supply values to the variables
at run time and want them to be computed at run...
|
by: Yannick Turgeon |
last post by:
Hello all,
I'm using SS2K on W2k.
I'v got a table say, humm, "Orders" with two fields in the PK:
OrderDate and CustomerID. I would like to add an "ID" column which
would be auto-increment...
|
by: Andy |
last post by:
.... as I know the answer will be so simple, but here goes...
I cannot creating a new asp.net projects in VS2003 in a directory other
than the default suggested directory (i.e....
|
by: matthewslyman |
last post by:
I have an unusual design and some very unusual issues with my code... I have forced Access to cooperate on everything except one issue - record deletion.
My form design involves a recursively...
|
by: matheussousuke |
last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails.
The goal is: Make it send the email with the URL...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |