New and Seeking Help =D

Hey,

I am new to PHP and started searching the web on various things im trying to accomplish.

I currently have info in my local host database that I want to extract. Simply put I have my first page with the info I want to display which is correct. I want to be able to show additional information on the product if the user decides to click on the name. Overall product pages with just titles will go to > product details

Here is my code:

Product page (Which displays correctly)
[php]<?php require_once('includes/testConnection.php'); ?>

<?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $maxRows_Recordset1 = 25; $pageNum_Recordset1 = 0; if (isset($_GET['id'])) { $pageNum_Recordset1 = $_GET['id']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; mysql_select_db($database_Connection, $Connection); $query_Recordset1 = "SELECT tbl_name.id, tbl_name.img, tbl_name.sku, tbl_name.name, tbl_name.`description`, tbl_name.price, tbl_name.manufacturer, tbl_name.category FROM tbl_name"; $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $Connection) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; ?> <?php do { ?> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
id img sku name description price manufacturer category
<?php echo $row_Recordset1['id']; ?> <?php echo $row_Recordset1['sku']; ?> <?php echo $row_Recordset1['name']; ?> <?php echo $row_Recordset1['description']; ?> <?php echo $row_Recordset1['price']; ?> <?php echo $row_Recordset1['manufacturer']; ?> <?php echo $row_Recordset1['category']; ?>
<?php mysql_free_result($Recordset1); ?> [/php]

Product detail that will produce desired results. I want to pull the 8 fields.
[php]<?php require_once('includes/testConnection.php'); ?>

<?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_Connection, $Connection); //$query_Recordset1 = "SELECT tbl_name.id, tbl_name.img, tbl_name.sku, tbl_name.name, tbl_name.`description`, tbl_name.price, tbl_name.manufacturer, tbl_name.category FROM tbl_name"; //$id = preg_replace('#[^0-9]#i', '' ,$_GET['id']); $id = ''; $query_Recordset1 = mysql_query("SELECT * FROM tbl_name WHERE id='$id' LIMIT 1"); $Recordset1 = mysql_query($query_Recordset1, $Connection) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); if(isset ($_GET['id'])) { $prodCount = mysql_num_rows($Recordset1); if ($prodCount > 0){ while ($row_Recordset1=mysql_fetch_array($query_Recordset1)){ $name = $row_Recordset1['name']; //$description = $row['description']; //$manufacturer = $row['manufacturer']; //$sku = $row['sku']; //$price = $row['price']; //$img = $row['img']; } } } ?> <?php //if(isset ($_GET['id'])) //{ //$id = preg_replace('#[^0-9]#i', '' ,$_GET['id']); //$sql= mysql_query("SELECT * FROM adult_product WHERE id='$id' LIMIT 1"); //$prodCount = mysql_num_rows($sql); //if ($prodCount > 0){ //while ($row=mysql_fetch_array($sql)){ //$name = $row['name']; //$description = $row['description']; //$manufacturer = $row['manufacturer']; //$sku = $row['sku']; //$price = $row['price']; //$img = $row['img']; //} //} //} ?> <?php echo $row_Recordset1['name']; ?> <?php mysql_free_result($Recordset1); ?>[/php]

I commented out some stuff I have tried, but any help is appreciated. I am working in dreamweaver if that matters.

Regards,
Josh

Sponsor our Newsletter | Privacy Policy | Terms of Service