Jump to content

Why Wont My Query Run?


dev-ria

Recommended Posts

I would try and debug your query:

 

       $query = mysql_query("

           SELECT domain,

           COUNT(domain) AS domaincount

           FROM domaindata

           WHERE email_sent_date = '' 

           GROUP BY domain") or trigger_error(mysql_error());

 

Should tell you if your query is bad etc. See what that says and report back.

Link to comment
Share on other sites

ive tried that....when the graph runs first it displays the graph but wont run the query part...and when query runs i get results but not the graph. i'm trying to figure whats prevent it from running everything. there error i get when i run query first is this.

 

( ! ) Notice: in C:\wamp\www\jpgraph\test.php on line 18

Call Stack # Time Memory Function Location 1 0.0041 685928 {main}( ) ..\test.php:0 2 0.0410 7442184 trigger_error ( ) ..\test.php:18

 

when graph goes first i get no errors

Edited by dev-ria
Link to comment
Share on other sites

yes, because when i remove the graph code i get all my results of the query.....so im 100% both codes are running properly (separated) but they wont run on one page. I think that because the code exits at the end of each run it wont run the next code....so when the graph goes first....it will run and then exit at the end so it wont run the query code

Link to comment
Share on other sites

You cannot use an image header on any page you wish to echo text to. That must be done on a different page. When you send something with the header content as an image, then the whole document is treated and interpreted as an image.

 

PHP's default header content type is 'text/html', that is why you don't have to set it for a regular page.

 

If we had a clearer understanding of what you are trying to do, we could walk you through it.

Link to comment
Share on other sites

ah that makes sense....well what i am trying to do is use the mysql data to create a pie graph. So i am running a query to get the data then putting the data in the $data = array(stuff from query) so that i can display it on the graph. how can i run the query if i cant have anything on this page?

Link to comment
Share on other sites

You can have queries in the page, you just can't echo the results. The results must be sent to the image generator.

 

So, if you want the query in the data variable.

 $query = mysql_query("
           SELECT domain,
           COUNT(domain) AS domaincount
           FROM domaindata
           WHERE email_sent_date = ''
           GROUP BY domain");
       while($run = mysql_fetch_array($query))
       {

           $data[] = $run['domaincount'];
}

is the date_email_sent really suppose to be blank?

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.