Jump to content

[SOLVED] URL variable in WHERE clause


brettpower

Recommended Posts

I am attempting to pull a URL variable and drop it into a WHERE clause, however, I am having no luck!  The URL variable does seem to pass to the mySQL query, but the query fails.  From my research, it appears to be a syntax issue.

Here is what I have:

[code]$cid = $_GET['campaign'];
mysql_select_db($database_Offer, $Offer);
$query_Offer = "SELECT tos FROM offers WHERE campaign = `'$cid'`";
$Offer = mysql_query($query_Offer, $Offer) or die(mysql_error());
$row_Offer = mysql_fetch_assoc($Offer);
$totalRows_Offer = mysql_num_rows($Offer);[/code]

The error I get is as follows:

[quote]Unknown column ''10000'' in 'where clause'[/quote]

I have a text box that will be populated with the data being pulled form the above query in which I have the following code:
[quote]<?php echo $row_Index['tos']; ?>[/quote]

The table name is "offers" and the columns I am attempting to pull data from are "tos" and "campaign".  The URL for this page is http://www.allinonevacations.net/collect.php?campaign=10000.

Thanks.
Link to comment
https://forums.phpfreaks.com/topic/32054-solved-url-variable-in-where-clause/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.