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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.