Michael,
Yes. Just go ahead, and echo $sql to see what you have. You can build quite
complex queries this way, dependent upon input from picklists, checkboxes,
etc., adding and dropping conditions according to whether or not they have
been selected/set.
So why not $sql = " UPDATE $fieldlist $
Have you tried it? I've done this sort of thing before, and it works
just fine. By the time the query string is executed, the variables have
been interpreted.
So, if $colName = "id", and $id = 12, then your query variable looks
something like "select * from myTable where $colName = $id". By
Hi Mark,
... beside of what was mentioned be4, you have also
a logical error in the way you append to your $sql-
query in the while loop.
Look: letz say, $find is "The Fields of the Nephilim",
so your $wordsarray would be:
0 ==> The
1 ==> Fields
2 ==> of
3 ==> the
4 ==> Nephilim
in your while-
d yes, include the mysql_query() as Mark Gordon mentioned.
Mats Remman
PHP Developer/Mysql DBA
Coretrek, Norway
+47 51978597 / +47 916 23566
> -Original Message-
> From: Matthew Loff [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 09, 2001 2:20 AM
> To: 'Ben Bleything
, July 08, 2001 8:13 PM
To: 'Matthew Loff'; 'Mark Gordon'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Dynamic SQL + result resource error
Guess I'm just a big dumbass then, aren't I =P
Oops.
I suppose that would cause it to fail then, wouldn't it?
=> Ben
--
n'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Dynamic SQL + result resource error
The code you're referencing is my modification of his original post. :)
-Original Message-
From: Ben Bleything [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 08, 2001 8:04 PM
To: 'Matthew Lof
The code you're referencing is my modification of his original post. :)
-Original Message-
From: Ben Bleything [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 08, 2001 8:04 PM
To: 'Matthew Loff'; 'Mark Gordon'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Dynamic SQ
Sure he is. Right here:
$queryResult = mysql_query($sql);
what exact error is occurring?
-Original Message-
From: Matthew Loff [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 08, 2001 5:00 PM
To: 'Mark Gordon'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Dynamic SQL + result reso
You aren't calling mysql_query() to execute the query.
//$find is text box input
$wordsarray = explode(" ",$find);
$sql = "SELECT bandname FROM bands WHERE (bandname
LIKE ";
$i = 0;
while ($i < count($wordsarray))
{
$word = current($wordsarray);
next($wordsarray);
$sql=$sql."$wor