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
PHP5/Zend 2.0 - Resources
PHP5 Snapshots
http://snaps.php.net/
ZEND 2.0 Feature Overview and Design (PDF File
help with calculations on a flat text file
hello,
I have this code below that is attached to a flat file like this:
Email:LastName:FirstN
check_changed_data - I can't get data from the called method event
I use check_changed_data to trigger my event method.
The method delivers er_changed_data.
How to change Time Zone
HI
I want to change the time zone of the server to another country.How can do that?
Thanks
Include a php
Hello,
I'm trying to include a function that shows the recent searches.
Example I have <
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.
RTF fomatting to email content
Im trying to sen an email with content is picked up from a rtf-file (file_get_contents('*.rtf'). Mai
Fatal error: Call to a member function fetchrow() on a non-object in C:xamppht
okay i have this query and everytime i add `item_id`=? to it... it gives me the error in the title..
problem when runing a funciton
I am trying to connect to database using a funciton in a functions.php
<?php
funct
At max how many columns is advisable to create in a table/view
Hi All,
I have two transaction table from which i want to create a simple view or material