php - How to retrieve and display image base on URL and Product-ID? -


i re post code here.. keep getting error of :

notice: undefined index: image url in c:\wamp\www\mysql1.php on line 35.. 

my url value in pimage table : 'c:\wamp\www\toy1.jpg'. may know correct?? appreciate kind response , help..

<html> <head></head> <body> <?php //open connection mysql server $connection = mysql_connect('localhost','root', '')         or die ('unable connect !');  // select database use mysql_select_db('we-toys') or die ('unable select database!');  $query = 'select * product p, pimage p2 p.pid=p2.imagepid'; $result = mysql_query($query)         or die ('error in query: $query. ' . mysql_error());  if (mysql_num_rows($result) > 0) {     echo '<table width = 100% cellpadding = 10 cellspacing = 0 border = 1>';     echo '<tr><td><b>id</b></td>       <td><b>pname</b></td>       <td><b>pgroup</b></td>           <td><b>ptype</‌​b></td>           <td><b>qty</b></td>           <td><b>image></b></td>';      while ($row = mysql_fetch_row($result))      { echo '<tr>     <td>'.$row[0].'</td>     <td>'.$row[2].'</td>     <td>'.$row[4].'</td>     <td>'.$row[5].'</td>     <td>'.$row[6].'</td>     <td><img src="'.$row['imageurl'].'"></td>     </tr>';  }  echo '</table>';   }         else         {             echo 'no rows found!';                 }         mysql_free_result($result);         mysql_close($connection);      ?> </body> </html> 

<?php echo '<table width = 100% cellpadding = 10 cellspacing = 0 border = 1> <tr><td><b>id</b></td> <td><b>pname</b></td> <td><b>pgroup</b></td> <td><b>ptype</‌​b></td> <td><b>qty</b></td> <td><b>image></b> </td></tr>'; while ($row = mysql_fetch_array($result))  { echo '<tr><td>'.$row[0].'</td> <td>'.$row[2].'</td> <td>'.$row[4].'</td> <td>'.$row[5].'</td> <td>'.$row[6].'</td> <td><img src="'.$row['imageurl'].'"></td></tr>'; }  echo '</table>'; ?> 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -