ok here is my problem when i do a sql query i get the right data display on the screen.
but when i use the sql in php code for some reason it doesn't display the corrected data I needed. i cannot use tbl_products.fld_name(tablename n fieldname together) to point to that field in that table, it comes out blank. but if i use fld_name, it will only show the data from categories table for it. both table have the same field name. I don't want to change the field name for both table to fix this error. Is there any other method.
what I'am doing wrong here.?
Code: Select all
<?php
require("config.php");
$dbh1 = mysql_connect($dbhost, $dbuser, $dbpasswd) or die("Could not connect");
mysql_select_db($dbname, $dbh1) or die("Could not select database");
$result = mysql_query("SELECT tbl_products.fld_prodid, tbl_products.fld_barcode, tbl_products.fld_name, tbl_products.fld_description, tbl_products.fld_price, tbl_categories.fld_name, tbl_products.fld_manuid FROM tbl_products, tbl_categories WHERE tbl_products.fld_catid = tbl_categories.fld_catid");
while ($row = mysql_fetch_array($result))
{
printf ("ID: %s Barcode: %s Name: %s Des: %s Price: %s catid: %s manuid: %s", $row["'tbl_products.fld_prodid"], $row["fld_barcode"], $row["fld_name"],$row["fld_description"], $row["fld_price"], $row["fld_name"], $row["fld_manuid"]);
echo "<br>";
}
mysql_free_result($result);
?>then get tbl_categories.fld_name to display with the rest of tbl_products data.