Jump to content

Recommended Posts

I want to get a number from a data base use it in another script increment by 1 and insert back into that column. In this script how can I get the numeric value of que?

 
$query = $db->query("SELECT `que` FROM `tracker` ");
while($rows = $query->fetch(PDO::FETCH_ASSOC)){
echo  $rows['que']; (prints que)
 
echo que;   (does not work)
 

Link to comment
https://forums.phpfreaks.com/topic/282746-que-count/
Share on other sites

I need que to be an integer value..  A number I can use math on. Ill provide a link to survey page Whatever the que is a query SELECTS  the data in that row.  What I want to do is on the next operation got to the next ID..

 

  http://libertarianpartylc.org/survey.php

Link to comment
https://forums.phpfreaks.com/topic/282746-que-count/#findComment-1452851
Share on other sites

This is a phone survey script... survey php prints the current reg voters data on the survey page. The surveyor attempts a call and gets a no answer or contact and Selects this result from a dropdown which calls operation.php. Operation.php increments the row id and stores it into table tracker.  survey.php then prints the new data for the next call ..  this code is almost working.. this is a link to the survey page.  and link to the code below that.

 

survey page    http://libertarianpartylc.org/survey.php

 

code   http://pastebin.com/9dx04UDP

Link to comment
https://forums.phpfreaks.com/topic/282746-que-count/#findComment-1452939
Share on other sites

Survey.php

 

Line 9: The query uses a parameter "?" (mysqli type, not PDO!) but no bindParam() statement.

 

Does each operator have their own que_id?

 

It looks like you need to pass the$row['id'] of the last call made in the form (hidden field) to operation.php (or use the $_SESSIONto store).

 

 

operator.php

When you update tracker table I think you need a "WHERE que_id = :queid"

Link to comment
https://forums.phpfreaks.com/topic/282746-que-count/#findComment-1452950
Share on other sites

Originally que_id was the increment variable and i was passing between pages. the table tracker has 2 columns id (not auto incremented) and que_id.

 

each operator after login will start at the current que_id  or id..

 

Yes I had where Que_id= que_id but changed it

 

As you can see I have put a lot of time in this project and way over my head trying to develop this code and pulling my hair. Syntax in this particular operation is the problem..

Link to comment
https://forums.phpfreaks.com/topic/282746-que-count/#findComment-1452954
Share on other sites

Everything works but the SELECT COUNT

 

$q = $db->prepare("SELECT COUNT(id) as records FROM tracker WHERE que_id = 3");
            $q->execute();    
            $records = (int) $q->fetch(PDO::FETCH_OBJ)->records;
            echo '$records =', $records;

Link to comment
https://forums.phpfreaks.com/topic/282746-que-count/#findComment-1452966
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.