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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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