List:MySQL and PHP« Previous MessageNext Message »
From:Priti Solanki Date:April 27 2009 4:02am
Subject:Re: putting php variables into mysql queries
View as plain text  
Hi Troy,


quick answer:

$data = mysql_query("UPDATE product SET url_manual*$x*='$filename'
WHERE dbi = '$dbi'") or die(mysql_error());

$url_manual=' url_manual'.$x;
$query="UPDATE product SET".$url_manual."='$filename' WHERE dbi = '$dbi'";
$data=mysql_query($query) or die(mysql_error);

Hope this solves your problem.

Thanks.
Priti Solanki

On Thu, Apr 23, 2009 at 7:53 PM, Troy Oltmanns <toltmanns@stripped> wrote:

> Hey everyone,
>
> I am working on a php script to upload a series of pdf files to the server
> and save the filenames to the database. I was able to get everything the
> way
> I wanted with a single file upload, but now I am having some issues with
> multifile uploads.
>
> Let me illustrate:
>
> once the for loop script runs through it's check for filesize, filetype,
> and
> does the upload, I have a query to update the database
>
>             $data = mysql_query("UPDATE product SET url_manual='$filename'
> WHERE dbi = '$dbi'") or die(mysql_error());
>
> I would like to put in a variable so the only the field pertenant to the
> loop would be updated, as in:
>
>             $data = mysql_query("UPDATE product SET
> url_manual*$x*='$filename'
> WHERE dbi = '$dbi'") or die(mysql_error());
>
> I'm not sure of the syntax for it all, in fact I'm sure theres a more
> efficient of coding this so there aren't as many queries.
>
> Any advice or resources would be greatly appreciated.
>
> Troy R Oltmanns
>

Thread
putting php variables into mysql queriesTroy Oltmanns23 Apr
  • Re: putting php variables into mysql queriesDaniel Brown23 Apr
  • Re: putting php variables into mysql queriesPriti Solanki27 Apr