Ever see a variable not resolve in a Query?
| From: | Lara Fabans | Date: | Sat, 20 May 2000 05:02:39 +0000 |
| Subject: | Ever see a variable not resolve in a Query? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-55@lists.php.net to get a copy of this message | ||
I couldn't find anything like this in the archives (or the FAQ)
Here is my query:
$extopic4 = "INSERT into entries (CREATOR, CREATED, COMMENT, APPROVER, ";
$extopic4 .= "APPROVED, TITLE, ABSTRACT, BODY, ENT_TYPE, ABLOB, BOARDID) VALUES";
$extopic4 .= " ('$aoumem', '$today', '$aorbit_comment_access', 'NULL', 'NULL', ";
$extopic4 .= "'$orbit_msgboard_title', '$orbit_msgboard_description', 'NULL', ";
$extopic4 .= "'Message','NULL', $boardid)";
I have numerous print statements (and I do query or die). So I know $boardid
is being set to an integer in the previous mysql_query. I pull the result properly.
However, it will not resolve in this query.
Here's where the queries get called:
// get the topicid
$mysql_result = mysql_query($extopic3, $dbh) or die("Query: $extopic3<BR>\n" . mysql_error());
$topicrec = mysql_fetch_array($mysql_result);
$topicid = $topicrec["ID"];
// return boardid
$result = mysql_query($extopic2, $dbh) or die("Query: $extopic2<BR>\n" . mysql_error());
$boardid = mysql_insert_id($result);
print "<h2>board ID is $boardid</h2>";
// putting everything else in its places
print "<h2>about to put the $boardid into $extopic4</h2>";
$result3 = mysql_query($extopic4, $dbh) or die("Query: $extopic4<BR>\n" . mysql_error());;
And here's what shows up in my window:
board ID is 21
about to put the 21 into INSERT into entries (CREATOR, CREATED, COMMENT, APPROVER, APPROVED, TITLE, ABSTRACT, BODY, ENT_TYPE, ABLOB, BOARDID) VALUES ('rjackson', 'FridayMay19, 2000', 'Member', 'NULL', 'NULL', 'Lara\'s 21st test', 'This is a test to put a board under an existing topic. Keeping prefs the same.', 'NULL', 'Message','NULL', )
Query: INSERT into entries (CREATOR, CREATED, COMMENT, APPROVER, APPROVED, TITLE, ABSTRACT, BODY, ENT_TYPE, ABLOB, BOARDID) VALUES ('rjackson', 'FridayMay19, 2000', 'Member', 'NULL', 'NULL', 'Lara\'s 21st test', 'This is a test to put a board under an existing topic. Keeping prefs the same.', 'NULL', 'Message','NULL', )
You have an error in your SQL syntax near ')' at line 1
Any thoughts would be greatly appreciated,
Thank you so much,
Lara