Hyperlink in PHP to MySQL record
Posted on
16th Feb 2014 07:03 pm by
admin
Hello,
I am having trouble as i am new to php. I have connected to the database and I have displayed the fields i want on my page. I need to access certain fields by links to each letter.
For example A will link to the products starting with A and so on.
I am using PHP ad MySQL. The database is however on a different server. I only have the .php file at the moment and want to display the data on a HTML page.
I am just unsure of how to make a link to the product field and the price field and display them within a table.
My code is this so far..
<?php
// Connect to the database server
mysql_connect("host", "username", "psssword") or die(mysql_error());
// Open to the database
mysql_select_db("telephon_cscartrestore") or die(mysql_error());
//select records from table
$result = mysql_query("SELECT cscart_product_descriptions.product, cscart_product_prices.price FROM cscart_product_descriptions, cscart_product_prices ORDER BY cscart_product_descriptions.product ASC") or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>Product</th> <th>Price</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['product'];
echo "</td><td>";
echo $row['price'];
echo "</td></tr>";
}
echo "</table>";
?>
I want a link 'A' that opens all records starting in A and so on. Is this possible?
thanks
No comments posted yet
Your Answer:
Login to answer
131
54
Other forums
add to sql result
ok see rite now my sites hit counter is counted from the mysql visitor log i need to clear it aft
Production Order Enterprise Service to Manufacturing Exctn Sys (MES) ???
Hello Experts,
In our current landscape SAP ECC 5.0 is integrated to MES system via PI 7.
how to query data from website using VC?
I want to query some datum from a website,so I need a program to read data from a .csv file, and ass
Please Help my PHP Dating Function.
Hi everyone!
Well here is my code that displays this:
It works wonderful.
Best way to check for end of a record and send it back to the first record
I'm hoping someone can help me out and explain the best way to accomplish this.
What I'm doin
Ten Operator Syntax
Hi Guys,
I can't figure out why i am getting a parse error with this basic ten op code:
Random Number Generation And Probability
Hello, I am working on a function which has to insert data into a SQL table.
we have to suppl
Basic Question Regarding PHP Includes
Hi
Just starting out with PHP.
Working on a site that uses some basic includes, these
How to Handle more than one submit button in single form?
Hi
I have one PHP file which contains one Form. In this form there are two Submit type Buttons
Php Mysql Page Loading Notice
Hi all,
I was wondering if there is a way (Sure there is) of showing a message or an image wh