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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:03:32+00:00 2026-06-06T04:03:32+00:00

I have a table where is a row called ID and I want to

  • 0

I have a table where is a row called ID and I want to save that ID to variable that I can use later on the same PHP file. How can I do it?

<?php
include 'config.php';

// Connect to server and select databse.
mysql_connect("$dbhost", "$dbuser", "$dbpass")or die("cannot connect");
mysql_select_db("$dbname")or die("cannot select DB");

$result = mysql_query("SELECT * auto_matkat");

$row = mysql_fetch_array($result)
  $IND = $row['IND'];
  echo $IND;
  }

mysql_close($con);
?> 
  • 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-06T04:03:33+00:00Added an answer on June 6, 2026 at 4:03 am

    In case CoDe ADDict’s code is a bit complex for you this one may be a bit simpler:

    mysql_connect("$dbhost","$dbuser","$dbpass")or die(mysql_error());
    mysql_select_db("$dbname")or die(mysql_error());
         $query="SELECT * FROM auto_matkat";
    $result=mysql_query($query)or die(mysql_error());
    $num=mysql_numrows($result);
    mysql_close();
    $i=0;
    while($i<$num){
    $id[$id]=mysql_result($result,$i,"id");
    }
    echo $id;
    

    Here is a great website for beginners learning PHP & MySQL connections: http://www.freewebmasterhelp.com/tutorials/phpmysql

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

Sidebar

Related Questions

I have this database with a table and a row called 'rank'. In that
I have a table that's generated by a normal PHP loop. What I want
I have a table in mysql with a row called 'newrelease'. If the item
I have a table called pollData. It will always contain only 1 row. It
I have a table row, and within that, I have a td (whatever it
I have a table row that needs to be hidden when the anchor with
I have a table row that has the error message in it. <tr runat=server
I have a table called Token in my database that represents texts tokenized. Each
I have a table called devicesegments , each row of which contains a large
I have one table called gallery . For each row in gallery there are

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.