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 8287101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:56:41+00:00 2026-06-08T11:56:41+00:00

My Code wont work. It just prints out the default Here is the php

  • 0

My Code wont work.
It just prints out the default

Here is the php

$updatesQuery = "SELECT * FROM updates WHERE Isnote = 0";
        $rs  = mysql_query($updatesQuery) or
        die("SQL: $usersQuery)<br />".mysql_error());
        while($row = mysql_fetch_array($rs)) {
            switch ($i){
                case $row[CatID]=1:
                    $i = "kunder";
                    break;
                case $row[CatID]=2:
                    $i = "bokningar";
                    break;
                case $row[CatID]=3:
                    $i = "offerter";
                    break;
                case $row[CatID]=4:
                    $i = "leverantorer";
                    break;
                case $row[CatID]=5:
                    $i = "kalender";
                    break;
                default:
                    $i = "no work";
                    break;
            }
            echo $i;                
        }

The sql query is valid.
But my output from this is just the default value. “no work”.

What have I written wrong?

  • 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-08T11:56:42+00:00Added an answer on June 8, 2026 at 11:56 am

    Switch on your variable, in this case $row['CatID']:

    switch ($row['CatID']){
        case 1:
            $i = "kunder";
            break;
        case 2:
            $i = "bokningar";
            break;
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

not sure why my code wont work, im teaching myself javascript i know php
for some reason this code wont work, it doesn't seem to read the javascript.php
So i have this small piece of code which just wont work: while c<b:
I have a very simple JavaScript/jquery code which won't just work correctly. The problem
For some reason my bind events won't work. You can see my code here:
So, here's my question: Why won't the code in the first snippet work when
I'm stumling upon a weird problem: The code just wont be able to access
I have an issue with php where code works on on computer but wont
NOTE: I just figured out that this will make it work: $.Storage.set(whichp, +myindex) ,
Can anyone enlighten me as to why the following code won't work in IE7

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.