coogie Posted March 6, 2008 Share Posted March 6, 2008 Hello, i have a phpmyedit file which loads this table below: Email, Product_name, shape, freebie, colour, texture, shape, smoothness, preference_name I then have a seperate PHP file, which displays data from this table, and data from other tables with a mysql 'where' statement I'd like to make it so when i click on the 'product_name" in my phpmyedit table, it will then opens my php (shown below) and gives values in the mysql statement, where i have the fields 'email', 'product_name' and 'preference_name' How can i achieve this? My php experience is very poor and i'm trying to learn Regards, coogie This is my separate php file where i would like to update the mysql statement according to what product the user clicks on: <?php require_once('Connections/main.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $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_main, $main); $query_Recordset1 = "SELECT * FROM preferences WHERE email = ***email*** AND preferences_name = ***preference_name***"; $Recordset1 = mysql_query($query_Recordset1, $main) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); mysql_select_db($database_main, $main); $query_products_tbls = "SELECT * FROM products_tbl INNER JOIN ordered_products ON products_tbl.product_name=ordered_products.product_name WHERE products_tbl.product_name = ****Product_name****"; $products_tbls = mysql_query($query_products_tbls, $main) or die(mysql_error()); $row_products_tbls = mysql_fetch_assoc($products_tbls); $totalRows_products_tbls = mysql_num_rows($products_tbls); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>orders</title> </head> <body> product order form <table height="169" border="1"> <tr> <td><table border="1"> <tr> <td>length</td> <td><?php echo $row_Recordset1['length_inch']; ?></td> </tr> <tr> <td>height</td> <td><?php echo $row_Recordset1['height_inch']; ?></td> </tr> <tr> <td>width</td> <td><?php echo $row_Recordset1['width_inch']; ?></td> </tr> <tr> <td colspan="2"> </td> </tr> </table></td> <td><table border="1"> <tr> <td>Order:</td> <td><?php echo $row_products_tbls['orderid']; ?></td> </tr> <tr> <td>product:</td> <td><?php echo $row_products_tbls['product_name']; ?></td> </tr> <tr> <td>shape:</td> <td><?php echo $row_products_tbls['shape']; ?></td> </tr> <tr> <td>freebie:</td> <td><?php echo $row_products_tbls['freebie']; ?></td> </tr> <tr> <td> </td> <td> </td> </tr> </table></td> </tr> <tr> <td colspan="2"><table width="490" border="1"> <tr> <td width="153"><?php echo $row_products_tbls['colour']; ?></td> <td width="315"><?php echo $row_products_tbls['shape']; ?></td> </tr> <tr> <td><?php echo $row_products_tbls['texture']; ?></td> <td><?php echo $row_products_tbls['smoothness']; ?></td> </tr> </table></td> </tr> </table> <p> </p> <p> </p> <p> </p> </body> </html> <?php mysql_free_result($Recordset1); mysql_free_result($products_tbls); ?> Quote Link to comment Share on other sites More sharing options...
coogie Posted March 6, 2008 Author Share Posted March 6, 2008 I have found out how i can pass one value of the table row into another php. but after lots of searching, i cannot find a way to pass 3 values from the row. This is how my code looks, which successfully passed one Value $fdd['product_name']['URL'] = 'http://localhost/phpMyEdit-5.1/orders.php?id=$value'; //$fdd["product_name"] = array( // 'name'=>'Shirt name', // 'select'=>'T', // 'type'=>'int', // 'maxlen'=>8, // 'nowrap'=>false, // 'required'=>true, // 'sort'=>true //); But i want to do something exactly like this (this does not work) $fdd['product_name']['URL'] = 'http://localhost/phpMyEdit-5.1/orders.php?id=$value&email=$field1&profile=$profile'; is this possible? If it is, i can complete my code ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.