Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple image display Error in very simple code.

Status
Not open for further replies.

Programz8

Programmer
Mar 27, 2007
33
0
0
US
Hmm I've got to go back to the basics I just can't seem to figure out why this code doesn't work???????


<?php

session_start();
// Start an if block that checks the value of $valid
if ($_SESSION[valid] != "yes") {
session_register('valid'); }

$db_name = "database";
$table_name = "Articles";
$connection = @mysql_connect("localhost", "database", "password") or die (mysql_error());
$query = "SELECT image FROM Articles WHERE a_id = 1 ";
$result = mysql_query($query) or die('Error, sonOfaB');

echo "$result";
?>


Nothing major and the error I get is Error, sonOfaB I don't know what I"m doing wrong but this has to be a stupid mistake because this code is so simple in the image field I have a line of code to an image stored on the server like <img source="picture.jpg">
 
Code:
<?php
session_start();
if(!isset($_SESSION['valid'])){
 $_SESSION['valid'] = true;
}

$db_name = "database";
$table_name = "Articles";
$connection = @mysql_connect("localhost", "database", "password") or die (mysql_error());
$query = "SELECT image FROM Articles WHERE a_id = 1 ";
$result = mysql_query($query) or die(mysql_error());
while ($row=mysql_fetch_assoc($result)){
print_r ($row);
}
?>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top