This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > March 2004 > PHP sequence error





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author PHP sequence error
Adrian Leontovich

2004-03-01, 3:28 am

I'm trying to retrieve a recordset, where one value in the mysql table/field
= the letter W. When I run the .php file on the testing server, I get the
message:

You have an error in your SQL syntax near 'W''' at line 1

Anyone have any ideas why? Here's teh syntax:

<?php
mysql_select_db($database_booklist, $booklist);
$query_wants = "SELECT * FROM books WHERE have_want = ''W''";
$wants = mysql_query($query_wants, $booklist) or die(mysql_error());
$row_wants = mysql_fetch_assoc($wants);
$totalRows_wants = mysql_num_rows($wants);

mysql_select_db($database_booklist, $booklist);
$query_has = "SELECT * FROM books WHERE have_want = ''H''";
$has = mysql_query($query_has, $booklist) or die(mysql_error());
$row_has = mysql_fetch_assoc($has);
$totalRows_has = mysql_num_rows($has);
?>


Steve Fleischer

2004-03-01, 3:28 am

On Sun, 29 Feb 2004 22:37:02 -0800, Adrian Leontovich wrote:

> I'm trying to retrieve a recordset, where one value in the mysql table/field
> = the letter W. When I run the .php file on the testing server, I get the
> message:
>
> You have an error in your SQL syntax near 'W''' at line 1
>
> Anyone have any ideas why? Here's teh syntax:
>
> <?php
> mysql_select_db($database_booklist, $booklist);
> $query_wants = "SELECT * FROM books WHERE have_want = ''W''";
> $wants = mysql_query($query_wants, $booklist) or die(mysql_error());
> $row_wants = mysql_fetch_assoc($wants);
> $totalRows_wants = mysql_num_rows($wants);



I think you need to replace this line:

$query_wants = "SELECT * FROM books WHERE have_want = ''W''";

with this:

$query_wants = "SELECT * FROM books WHERE have_want = 'W'";

--
Steve
www dot flyingtigerwebdesign dot com
Hong Kong, 01-Mar-04 2:46:55 PM
Adrian Leontovich

2004-03-01, 9:28 pm

Thats true Steve... that does now work.. wonder why DW wants to put in
double ticks?

Also.. I know how to pass URL parameters to a Details page using ASP, but
this function seems to be missing when I'm tryin gto build in PHP.. any
ideas how to do this?

Anyone?


Steve Fleischer

2004-03-01, 10:28 pm

On Mon, 1 Mar 2004 17:21:19 -0800, Adrian Leontovich wrote:

> Thats true Steve... that does now work.. wonder why DW wants to put in
> double ticks?
>
> Also.. I know how to pass URL parameters to a Details page using ASP, but
> this function seems to be missing when I'm tryin gto build in PHP.. any
> ideas how to do this?


Just replied in the other thread. :-)
--
Steve
www dot flyingtigerwebdesign dot com
Hong Kong, 02-Mar-04 9:53:42 AM
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews