Jump to content

Anything wrong?


Schlo_50

Recommended Posts

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); 
?> 

Link to comment
https://forums.phpfreaks.com/topic/37432-anything-wrong/
Share on other sites

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...

Link to comment
https://forums.phpfreaks.com/topic/37432-anything-wrong/#findComment-179011
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.