?
Solved

MySQL and recalling values

Posted on 2003-02-26
4
Medium Priority
?
258 Views
Last Modified: 2006-11-17
Ive created a mysql database that contains say a product id, and then about 10 other variables, how do I implement this into my html code so I can recall each individual variable based on the specified product id at various locations within the html code ?
0
Comment
Question by:MirageSF
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 5

Accepted Solution

by:
harwantgrewal earned 200 total points
ID: 8032013
just concatdinate the id with the variable name

harry
0
 
LVL 2

Assisted Solution

by:Hatemben
Hatemben earned 200 total points
ID: 8032073
<?php

$sqlhostname = "localhost";
$login = "uname";
$password = "passwd";
$base = "database";

// product id
$id = "";

$db_connect = mysql_connect($sqlhostname,$login,$password);
$base_selection = mysql_select_db($base,$db_connect);

$query = "Select * from product_tbl WHERE product_id ='$id'";
$req = mysql_query($query);

if (!$req)
{ echo "<B>Error ".mysql_errno()." :</B> ".mysql_error()."";
exit; }
$res = mysql_num_rows($req);

if ($res == 0)
   { echo "<center><b>Sorry there is no result.</b></center>";}
else
   { while($row = mysql_fetch_array($req))
            {
               extract($row);

                echo"$id<BR>
          $field_1<BR>
          $field_2<BR>
          $field_3<BR>";
    }
mysql_free_result($req);
}

?>
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question