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

  • SEARCH
  • Home
  • 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 3983988
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:42:55+00:00 2026-05-20T05:42:55+00:00

I want to select a row from mysql which matches a specific id. I

  • 0

I want to select a row from mysql which matches a specific id. I want to get the result if the ID matches, if the ID does not exists in the database, it should not do anything.

I run sth like this:

$q = "SELECT * FROM entries where id= '1'";
$result = mysql_query($q) or die(mysql_error());

if($result){
    $row = mysql_fetch_array($result) or die(mysql_error());
    $name = $row['name'];   
    }

echo "hello".$name;

If the id ‘1’ exists in the db, it should get the name, otherwise nothing or at least it should give the error, but when i use this, it just display no any content of the page which comes after this code. What I’m doing 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-05-20T05:42:56+00:00Added an answer on May 20, 2026 at 5:42 am

    If it does not display any code after this code, this is probably due to an error occuring and your error handling being set so the error is not displayed.

    Try searching for the php error log file (normaly php_error.log) that should contain the error that you do not see.

    Another thing i would try is adding more echo statements to see where exactly php stops interpreting.
    Like this:

    $q = "SELECT * FROM entries where id= '1'";
    
    $result = mysql_query($q);
    
    echo '<br />Query is send';
    if(!$result) {
        die('<br/>MySQL Error: ' . mysql_error());
    }
    else {
        echo '<br />Result is true';
        $row = mysql_fetch_array($result);
        echo '<br />tryed fetching row';
        if ($row === FALSE) {
            echo '<br />$row is not false.';
            $name = $row['name'];
            echo '<br />$name now is "' . $name . '"';
        }
        else {
            die('<br/>MySQL Error: ' . mysql_error());
        }
    }
    
    echo '<br />hello: "' . $name . '"';
    

    That might help to get some more information about your problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table in a MySQL database from which I want to select
i want to know how to edit a single row (which i select) from
I have a UITableView , which when I select a row, I want to
I'm planning on a multithreaded application to get 1 row from MySQL, process data
If i SELECT a row for updating in MS SQL Server, and want to
Below is my stored procedure. I want use stored procedure select all row of
i have users table and i have posts table i want select from users
I want to SELECT a formatted date string from a datetime type in SQL
I'm making a newsfeed type of thing and I want to select from multiple
I'm converting a webapp from mysql to SQL Server. Now I want to convert

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.