Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7909445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:24:49+00:00 2026-06-03T12:24:49+00:00

I am a little bit stuck with a PHP script. The script is for

  • 0

I am a little bit stuck with a PHP script.

The script is for a radio station and it needs to do the following:

  1. Count how many times a radio presenter has booked a slot for the current day. The slots are stored in a table in a database and I would use the code date("l") to determine the current day and then search for all rows which have “day” set to whatever the value of date("l") is.

  2. Then I would need to find out how many hours the presenter already has stored in the “monthly_slots” column in the “users” table in the row which has their username. "SELECT monthly_slots FROM users"

  3. Then I’d need to add whatever the value of the amount of slots the presenter has completed today with the amount of slots which already exist in the monthly_slots column.

Below is my code for this

$currentday = date("l");
$currentslots = mysql_query("SELECT monthly_slots FROM users");
mysql_query("
    UPDATE users
    SET slots = (SELECT COUNT(*) + "$currentslots" 
                 FROM timetable 
                 WHERE timetable.username = users.username 
                   AND day = "$currentday"
                )
"); 

Can anyone see where I am going wrong?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T12:24:52+00:00Added an answer on June 3, 2026 at 12:24 pm

    get the value returned by the resource

    $currentday = date("l");
    $result = mysql_query("SELECT monthly_slots FROM users");
    $currentslots = mysql_fetch_assoc($result);
    
    
    mysql_query("
        UPDATE users
        SET slots = (SELECT COUNT(*) + "$currentslots" 
                     FROM timetable 
                     WHERE timetable.username = users.username 
                       AND day = "$currentday"
                    )
    ");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am little bit stuck with the following problem. I have two models: class
I'm a little bit stuck with the following problem: I would like all my
I'm new to using PDO and have got a little bit stuck- is there
This little bit of syntax has been a bit of a confusion for me
I need a little bit of help, being a newb with php. if($catname !=
Okay i'm a little bit stuck on how to solve this problem. When a
I am developing a Diary Management Script using PHP and MySQL. I am stuck
I am little bit stuck here .. I have a datatable as _ Dim
I'm a little bit stuck with the new ContactsContract-API here. I think I don't
i'm a little bit stuck with deciding what db structure is the best for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.