Schlo_50 Posted February 7, 2007 Share Posted February 7, 2007 Anyone see anything wrong with this? It used to work and since i copied and pasted it to my new layout it doesn't want to work at all. ??? <?php $conn= mysql_connect("host" ,"dombar0_work" ,"password" ) ; if(!$conn) { echo "Unable to connect to DB: " . mysql_error(); exit; } if (!mysql_select_db("dombar0_work")) { echo " Unable to select gallery Database: " . mysql_error() ; exit; } $sql = "SELECT * FROM stock_tbl"; $result = mysql_query( $sql); if ( mysql_num_rows($result) == 0) { echo "No Documents Available at this time"; } else { $num_results = mysql_num_rows($result) ; echo "There are currently", $num_results, " images available<br>"; while ( $row = mysql_fetch_assoc( $result)) { echo $row["st_id"], " - <img src=", $row["image"], " /><br>", $row["descr"], " - ", $row["price"] ,"<br>"; ?> <?php echo "<br>"; } } mysql_free_result($result); ?> Quote Link to comment Share on other sites More sharing options...
paul2463 Posted February 7, 2007 Share Posted February 7, 2007 what doesnt work about it??? Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 7, 2007 Share Posted February 7, 2007 this here may be the cause of your problem, whatever that problem may be as you havnt stated it. even if it isnt, change this echo: echo $row["st_id"], " - <img src=", $row["image"], " /> ", $row["descr"], " - ", $row["price"] ," "; very very messy. change it to something like this: echo $row['st_id']." - <img src='.$row['image']."' />".$row['descr']." - ".$row['price']; your code is very very messy to begin with... 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.