Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Displaying Images from a db

Featured Replies

Hi guys,

 

I currently have a table displaying items from a mysql database. I would also like to add images to the table.

I have an images folder already in the same web directory as all my pages, containing the images I would like to display.

 

What code do I need to use to display these images in the table?

 

My code is currently as follows:

 

<?php

// Connect to MYSQL and Select database

$dbc = mysql_connect (*********,'****','*********') OR die('Could not connect to MySQL : ' . mysql_error() );

mysql_select_db ('cse') OR die('Could not select the database : ' .

mysql_error() );

// Perform SQL query

$query = "SELECT * FROM harrison_catergories WHERE Cat_id = 1";

$result = mysql_query ($query);

?>

</p>

<table width="700" border="1">

<tr>

<td width="120" height="32"><strong>Item</strong></td>

<td width="412"><strong>Description</strong></td>

<td width="70"><strong>Cost</strong></td>

<td width="70"><strong>Stock</strong></td>

<td width="70"><strong>Purchase</strong></td>

</tr>

<?php

while($row = mysql_fetch_array($result,MYSQL_ASSOC))

{

Echo "<tr><td>$row[item]</td><td>$row[Description]</td><td>$row[Cost]</td><td>$row[stock]</td><td><a href = 'purchase.php$row[Purchase]'>Buy</a></td></tr>\n";

}

mysql_close();

?>

 

Cheers guys, hope sum1 can help me out?

 

Jay

  • Author
Hi guys,

 

I currently have a table displaying items from a mysql database. I would also like to add images to the table.

I have an images folder already in the same web directory as all my pages, containing the images I would like to display.

 

What code do I need to use to display these images in the table?

 

My code is currently as follows:

 

<?php

// Connect to MYSQL and Select database

$dbc = mysql_connect (*********,'****','*********') OR die('Could not connect to MySQL : ' . mysql_error() );

mysql_select_db ('cse') OR die('Could not select the database : ' .

mysql_error() );

// Perform SQL query

$query = "SELECT * FROM harrison_catergories WHERE Cat_id = 1";

$result = mysql_query ($query);

?>

</p>

<table width="700" border="1">

<tr>

<td width="120" height="32"><strong>Item</strong></td>

<td width="412"><strong>Description</strong></td>

<td width="70"><strong>Cost</strong></td>

<td width="70"><strong>Stock</strong></td>

<td width="70"><strong>Purchase</strong></td>

</tr>

<?php

while($row = mysql_fetch_array($result,MYSQL_ASSOC))

{

Echo "<tr><td>$row[item]</td><td>$row[Description]</td><td>$row[Cost]</td><td>$row[stock]</td><td><a href = 'purchase.php$row[Purchase]'>Buy</a></td></tr>\n";

}

mysql_close();

?>

 

Cheers guys, hope sum1 can help me out?

 

Jay

 

Sorry guys, posted in the wrong forum!! OOOOPS

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.