Im quite new to php and mysql but ive figured out how to upload and display content from my database, but im still facing quite a lot of problems.

- First how do you display an image uploaded in the database?
- Second how do you make the content only display a certain amount of rows per page + how to make it automatically make new pages?
- Third how to make only the newest content display?
- Finally how do you make content display side-by-side in two columns instead of directly under each other?

Output code:

<?
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM tutorials WHERE tut_program='Photoshop' AND tut_category='Text Effects' ";
$result=mysql_query($query);

$num=mysql_numrows($result); 

mysql_close();

echo "<b><center>Database Output</center></b><br><br>";

?>
<link href="file:///C|/Users/Scott/SlyGraphics/style.css" rel="stylesheet" type="text/css" />

<title>SlyGraffix: Database Test</title><table width="287" border="0" align="center" cellpadding="2" cellspacing="0">
             
<?
$i=0;
while ($i < $num) {
$tut_name=mysql_result($result,$i,"tut_name");
$tut_link=mysql_result($result,$i,"tut_link");
$tut_program=mysql_result($result,$i,"tut_program");
$tut_category=mysql_result($result,$i,"tut_category");
$tut_video=mysql_result($result,$i,"tut_video");
$tut_download=mysql_result($result,$i,"tut_download");
$tut_image=mysql_result($result,$i,"tut_image");
?>

 <tr>
                <td width="140"><a href="<? "$tut_link"; ?>"><img src="images/tutorials/fire_reflection.jpg" alt="d" width="140" height="120" border="0" /></a></td>
                <td width="139" valign="top"><p align="left"><a href="<? "$tut_link"; ?>"><? echo "$tut_name"; ?> </a> </p>
                    <p align="left"> Video: <? echo "$tut_video"; ?><br />
                      Download: <? echo "$tut_download"; ?><br />
                      External Link: Yes <br />
                      <br />
                      &gt;
                      <? echo "$tut_program"; ?></p>
                    </td>
              </tr>
<?
++$i;
} 
echo "</table>";


?>

Input Code/page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template-tut.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>SlyGraffix: Tutorials</title>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
body {
	background-repeat: repeat-x;
	background-image: url(images/background.png);
	background-color: #08167F;
}
-->
</style>
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
.style3 {font-size: 10px}
-->
</style>
<style type="text/css">
<!--
.style4 {color: #FFFFFF}
-->
</style>
<!-- InstanceEndEditable -->
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:link {
	color: #00FFFF;
}
a:visited {
	color: #00FFFF;
}
a:hover {
	color: #0099FF;
}
a:active {
	color: #00FFFF;
}
.style1 {font-size: 4px}
.style2 {color: #000000}
-->
</style></head>

<body>
<script language="JavaScript1.2" src="http://www.killersites.com/mvnforum/mvnplugin/mvnforum/js/vietuni.js" type="text/javascript"></script>
<script type="text/javascript">
function SubmitForm() {
  if (ValidateForm() == true ) {
  
    document.submitform.submitbutton.disabled=true;
    document.submitform.submit();
  }
}

function ValidateForm() {
  if (document.submitform.tut_name.value=="") {
    alert("Please check your Tutorial Name, it might not be there!"); return false;
  }

  if (document.submitform.tut_link.value=="http://") {
    alert("Please check your Tutorial Link, it might not be there!"); return false;
  }
  
    if (document.submitform.tut_program.value=="") {
    alert("Please select a Program!"); return false;
  }
  
  if (document.submitform.tut_category.value=="") {
    alert("Please select a Category!"); return false;
  }
  
  if (document.submitform.antispam.value=="") {
    alert("Please check your Anti-Spam Measure, it might not be there or wrong!"); return false;
  }

  return true;
}
</script>

<script type="text/javascript">
function SubmitFormSearch() {
  if (ValidateFormSearch() == true ) {
    document.submitformsearch.submitbutton.disabled=true;
    document.submitformsearch.submit();
  }
}

function ValidateFormSearch() {
  if (isBlank(document.submitformsearch.key, "Search")) return false;
  return true;
}
</script>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="7"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="banner" align="right" valign="middle"><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
          <br />
          <br />
          <br />
          <br />
          <br />
          <br />
          <br />
          <br />
          <br />
          <br />
          <span class="style1"><span class="style2"><br />
          .
          .</span></span><br />
          <input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.paypal.com/en_AU/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_AU/i/scr/pixel.gif" width="1" height="1">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHTwYJKoZIhvcNAQcEoIIHQDCCBzwCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYAPmbVMz77gbQx2zIQM1ZKnFw9Ku2U7cptd4SNcC7uBmLuq9E2pZA57wlbv1l+AGvgZ82qBzkGH6v8+3EOZhYRpLzIeujGdcheqBA/BVnndf3aQgjroB0iwr9Cjar10V2lT/H33zN2B13Jy6mFbKE6TqTF2a/lUhQSL4ObJvdNT5zELMAkGBSsOAwIaBQAwgcwGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQI6Squhb6P1yiAgagi+w1g2qU9x+GFW448FZiorGNS9zlZk1LCu1Xury8RdUQRCzM1s1osiG0ZeFdyDd0bAtPOnrGGMVje1xPUPg5EOsSAlWezDZcn/fnkAOfMyjId/tM6C1gQ3w5TFnpUtJWFck7cTOylO7f3KORfIuxhQS5tVXuJWLtsXLvENkg+kXGCPAy+PowCLru388b4wO3Xj9fhNdtR4SKCMrruQvri2/UMGuv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dgIONth+8kSK//Y/4ihuE4Ymvzn5ceE3S/iBSQQMjyvb+s2TWbQYDwcp129OPIbD9epdr4tJOUNiSojw7BHwYRiPh58S1xGlFgHFXwrEBb3dgNbMUa+u4qectsMAXpVHnD9wIyfmHMYIBmjCCAZYCAQEwgZQwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wODAyMjQxMDE5MzRaMCMGCSqGSIb3DQEJBDEWBBSdda1dzMgMYgRLV95pf0B6zkKx4DANBgkqhkiG9w0BAQEFAASBgFvZCAewsHlerECOdVS2NYkJiEXzA8yZAMR4fkXDESi1fEWmNscSrLUtATgmIHPfTvDcs/j2Ee0AX2wSvTU2+Ivi5aYJFtB0cGoQdyPFha+b0I0rD3u6VEPX1tkDJ10Lh8+IHqRcPs4hoDrjzgBL9CKkJw5Vh5mIZX6f8J8W4py4-----END PKCS7-----
">
        </form></td>
      </tr>
    </table>    </td>
  </tr>
  <!-- InstanceBeginEditable name="nav" -->
  <tr>
    <td><a href="/index.html" class="navhome"></a></td>
    <td><img src="/images/nav-tutorials-ro.png" width="125" height="45" /></td>
    <td><a href="/gallery.html" class="navgallery"></a></td>
    <td><a href="/downloads.html" class="navdownloads"></a></td>
    <td><a href="/forums" class="navforums"></a></td>
    <td><a href="/about.html" class="navabout"></a></td>
    <td><a href="/contact.html" class="navcontact"></a></td>
  </tr>
  <!-- InstanceEndEditable -->
  <tr>
    <td colspan="7" background="images/content-background.png"><!-- InstanceBeginEditable name="Content" --> <div align="center">
        <table width="450" border="0" cellspacing="0" cellpadding="4">
          <tr>
            <td width="200"><p><span class="bold">Photoshop Tutorials:</span> 37</p></td>
            <td width="50">&nbsp;</td>
            <td width="200"><p><span class="bold">Fireworks Tutorials:</span> 0</p></td>
          </tr>
          <tr>
            <td background="tutorials/text_effect_tutorials.html"><div align="left">
                <ul class="style1">
                  <p><a href="tutorials/effect_tutorials.html">Effects</a> (7)<br />
                  <a href="tutorials/interface_tutorials.html">Interface</a> (9)<br />
                  Basics<br />
                  <a href="tutorials/textures_patterns_tutorials.html">Textures/Patterns</a> (4)<br />
                  <a href="tutorials/text_effect_tutorials.html">Text Effects</a> (11)<br />
                  <a href="tutorials/filter_effect_tutorials.html">Filter Effects</a> (6)<br />
                    Website Layouts                  </p>
                </ul>
            </div></td>
            <td background="tutorials/text_effect_tutorials.html">&nbsp;</td>
            <td background="tutorials/text_effect_tutorials.html"><div align="left">
              <ul class="style1">
                <p>Effects<br />
                    Interface<br />
                    Basics<br />
                    Textures/Patterns<br />
                    Text Effects<br />
                    Filter Effects<br />
                  Website Layouts </p>
              </ul>
            </div></td>
          </tr>
          <tr>
            <td background="tutorials/text_effect_tutorials.html">&nbsp;</td>
            <td background="tutorials/text_effect_tutorials.html">&nbsp;</td>
            <td background="tutorials/text_effect_tutorials.html">&nbsp;</td>
          </tr>
          <tr>
            <td background="tutorials/text_effect_tutorials.html"><p><span class="bold">Illustrator Tutorials:</span> 0</p></td>
            <td background="tutorials/text_effect_tutorials.html">&nbsp;</td>
            <td background="tutorials/text_effect_tutorials.html"><p><span class="bold">Flash Tutorials:</span> 0</p></td>
          </tr>
          <tr>
            <td background="tutorials/text_effect_tutorials.html"><div align="left">
              <ul class="style1">
                <p>Effects<br />
                  Interface<br />
                  Basics<br />
                  Textures/Patterns<br />
                  Text Effects<br />
                  Filter Effects<br />
                  Website Layouts </p>
              </ul>
            </div></td>
            <td background="tutorials/text_effect_tutorials.html">&nbsp;</td>
            <td background="tutorials/text_effect_tutorials.html"><div align="left">
              <ul class="style1">
                <p>Effects<br />
                  Interface<br />
                  Basics<br />
                  Textures/Patterns<br />
                  Text Effects<br />
                  Filter Effects<br />
                  Website Layouts </p>
              </ul>
            </div></td>
          </tr>
        </table>
        <br />
        <table class="submit" width="65%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><div align="center" class="bold">
              <p class="bold">Submit a Tutorial <span class="style8 style3 style4">(Under Construction)</span></p>
              <form action="/insert.php" method="post" name="submitform"> 
                <input type="hidden" name="require" value="tut_name,tut_link,tut_program,tut_category,tut_image,antispam">
              <input type=hidden name="missing_fields_redirect" value="http://www.slygraffix.com/tutorials.html">
              <table width="100%" border="0" cellspacing="0" cellpadding="2">
                  <tr>
                    <td width="30%"><div align="left">
                      <p class="style6">Tutorial Name:</p>
                      </div></td>
                    <td width="70%"><label>
                      <div align="left">
                        <input name="tut_name" type="text" maxlength="30" />
                        </label>
                      </div></td>
                  </tr>
                  <tr>
                    <td><div align="left">
                      <p class="style6">Tutorial Link:</p>
                      </div></td>
                    <td><label>
                      <div align="left">
                        <input name="tut_link" type="text" value="http://" size="50" maxlength="255" />
                      </div>
                    </label></td>
                  </tr>
                  <tr>
                    <td><div align="left">
                      <p class="style6">Graphic Program:</p>
                      </div></td>
                    <td><label>
                      <div align="left">
                        <select name="tut_program">
                          <option selected="selected">Please Select One...</option>
                          <option value="Photoshop">Adobe Photoshop</option>
                          <option value="Fireworks">Adobe Fireworks</option>
                          <option value="Illustrator">Adobe Illustrator</option>
                          <option value="Flash">Adobe Flash</option>
                        </select>
                        </div>
                    </label></td>
                  </tr>
                  <tr>
                    <td><div align="left">
                      <p class="style6">Graphic Category:</p>
                      </div></td>
                    <td><div align="left">
                      <label>
                      <select name="tut_category" id="tut_category">
                        <option selected="selected">Please Select One...</option>
                        <option value="Effects">Effects</option>
                        <option value="Interface">Interface</option>
                        <option value="Basics">Basics</option>
                        <option value="Textures/Patterns">Textures/Patterns</option>
                        <option value="Text Effects">Text Effects</option>
                        <option value="Filter Effects">Filter Effects</option>
                        <option value="Website Layouts">Website Layouts</option>
                      </select>
                      </label>
                    </div></td>
                  </tr>
                  <tr>
                    <td><p align="left">Video:</p>                      </td>
                    <td><div align="left">
                      <select name="tut_video">
                        <option value="Yes">Yes</option>
                        <option value="No" selected="selected">No</option>
                      </select>
                    </div></td>
                  </tr>
                  <tr>
                    <td><p align="left">Download:</p>                      </td>
                    <td><div align="left">
                      <select name="tut_download">
                        <option value="Yes">Yes</option>
                        <option value="No" selected="selected">No</option>
                      </select>
                    </div></td>
                  </tr>
                  <tr>
                    <td><p align="left">Image:<br />
                      <span class="style7"><span class="style3">(Please add an image with the dimentions of 140px x 120px)</span></span></p>                      </td>
                    <td valign="top"><div align="left">
                      <input name="tut_image" type="file" />
                    </div></td>
                  </tr>
                  <tr>
                    <td valign="top"><div align="left">
                      <p class="style6">Anti-Spam Measure:</p>
                      </div></td>
                    <td><label>
                      <div align="left">
                        <input type="text" name="antispam" id="antispam" />
                        <img id="imgCaptcha" src="create_image.php" /><br />
                      </div>
                      </label></td>
                  </tr>
                  <tr>
                    <td colspan="2"><div align="left"></div>
                      <div align="left">
                        <label></label>
                       </div>
                      <label>
                        <div align="left"></div>
                        </label>
                        <label>
                        <div align="left"></div>
                        </label></td>
                    </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td><div align="left">
                      <label>
                      <input name="submitbutton" type="button" class="mainoption" value="Submit" onClick="javascript:SubmitForm();">
    <input type="reset" value="Reset" class="liteoption">
                      </label>
                    </div></td>
                  </tr>
                </table>
                </form>
              </div></td>
          </tr>
        </table>
        <p>&nbsp;</p>
      </div><!-- InstanceEndEditable -->      <br />
      <center><script type="text/javascript"><!--
google_ad_client = "pub-3504045271097060";
/* SlyGraffix Ads */
google_ad_slot = "8787691705";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center><br /><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="images/footer.png" width="800" height="45" /></td>
        </tr>
      </table>    </td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>

I hope someone here can help me with atleast one of my problems.

If you want to see the pages they are: Input Page Output Page

Sorry for the double post but its getting kind of late here, ill probably stay around for another 10 min or so then go to bed.

If anyone can help i'd really appreciate it but everything posted after 10 min i will have to check tomorrow.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.