Re: sending a MySQL query



Thanks for the reply, the problem is the example I gave is one of the
eager queries, the reason I want to send it via a link it because trying
to work out the queries in the makezip.php is going to be REALLY hard
as the combination is so big

Brian


"J.O. Aho" <user@xxxxxxxxxxx> wrote in message
news:3fhbofF7tvh8U1@xxxxxxxxxxxxxxxxx
> Brian wrote:
>> Hi
>>
>> I might be trying to do something that can't be done
>>
>> I have a PHP script that creates a zipped CSV file on the fly.
>> I am trying to send it the MySQL query via a link but I get errors as if
>> it
>> has not received the query
>>
>> the link is
>>
>> <a href="makezip.php?q=SELECT * FROM js WHERE lcase(dnote) =
>> lcase('T1107837')" target="exportWindow">EXPORT<a>
>>
>> the error is supplied argument is not a valid MySQL result
>>
>> the code on the makezip.php is
>>
>> $result = mysql_query($q,$db);
>> if ($myrow = mysql_fetch_array($result)) {..........
>>
>> is there any reason why I can't send my query to it and get it to run?
>
>
> You should avoid to send whitespaces in a HTML-request.
>
> Sending a whole sql-query, even if it wouldn't had included any
> whitespaces, better you set up a list of sql-queries that you would
> usually allow to be exported as a zipped file and see what arguments you
> would be able to adjust.
>
> eg:
> <a href="makezip.php?q=1&dnote=T1107837" target="exportWindow">EXPORT<a>
>
> where in your php script:
>
> switch($q) {
> case 1:
> $query="SELECT * FROM js WHERE lcase(dnote) = lcase('$dnote')";
> break;
> case 2:
> $query="SELECT * FROM js WHERE lcase(name) = lcase('$name')";
> break;
> case 3:
> ...
> }
>
> $result = mysql_query($q,$db);
> if ($myrow = mysql_fetch_array($result)) {
> ...
>
>
> This way your script would be a lot more secure too, than letting anyine
> to do what they want, even able to delete data.
>
>
>
> //Aho


.



Relevant Pages

  • RE: Query Problem, Please Help!!
    ... > this table to be laid out the way it is. ... The reason that experts recommend using a query as the Record Source for a ... The query ... will allow the designer to display the data in just about any way needed. ...
    (microsoft.public.access.queries)
  • Re: Issue with order placement...
    ... David's suggestion to use Me.Dirty = False is a good one. ... variable again to re-execute the same query, but I can also tell you this -- ... executing the identical update query to set a field to zero twice in a row ... There is good reason to set ...
    (comp.databases.ms-access)
  • Re: Converting bad table design to good design
    ... There isn't really a whole lot to learn about append queries. ... query) they are queries like any other. ... >> newsgroup, but if you have a good reason to send me e-mail, you'll find ... >>> Category for review ...
    (microsoft.public.access.externaldata)
  • Re: Report Layout for Vertical and Horizontal
    ... Sounds as if you need a Crosstab query as the source for your report. ... your Reason field and at the bottom select group header "Yes" and group ...
    (microsoft.public.access.reports)
  • Re: How can I assign the result of dateadd to a variable ?
    ... The reason why I used text is because the length of the packet_data varies, ... > What bugged me more was the difference in execution time between the query ... > using the text in row option. ... > there will be no rows returned to the client, ...
    (microsoft.public.sqlserver.programming)