Jump to content

Stevis2002

Members
  • Posts

    98
  • Joined

  • Last visited

    Never

Everything posted by Stevis2002

  1. Thanks for all the help mate! Got a slight problem....The file has been uploadedUnknown column 'flower.jpg' in 'field list'......And still nothing gets uploaded, either into the folder, or the database. [code] <?php require_once('../../Connections/localhost.php'); if (!function_exists("GetSQLValueString")) {     function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")     {       $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;       $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);       switch ($theType) {         case "text":           $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";           break;            case "long":         case "int":           $theValue = ($theValue != "") ? intval($theValue) : "NULL";           break;         case "double":           $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";           break;         case "date":           $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";           break;         case "defined":           $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;           break;       }       return $theValue;     } } if(isset($_POST['Submit'])) {     $fileImagename = $_FILES['userfile']['name'];     $fileImagesize = $_FILES['userfile']['size'];     $fileImagetype = $_FILES['userfile']['type'];     $uploaddir = '/plants/';     $uploadfile = $uploaddir . basename($_FILES['userfile']['image_name']);     if(move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir)) {         echo "The file ".  basename( $_FILES['userfile']['image_name']).         " has been uploaded";     } else{         echo "There was an error uploading the file, please try again!";     }         $insertSQL = sprintf("INSERT INTO plants (image_name, image_type, image_size, path, plant_name, plant_type, planting_months, blooming_season, plant_description) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",     $fileImagename,     $fileImagetype,     $fileImagesize, GetSQLValueString($_POST['path'], "text"),     GetSQLValueString($_POST['plant_name'], "text"),     GetSQLValueString($_POST['plant_type'], "text"),     GetSQLValueString($_POST['planting_months'], "text"),     GetSQLValueString($_POST['blooming_season'], "text"),     GetSQLValueString($_POST['plant_description'], "text"));     mysql_select_db($database_localhost, $localhost);     $Result1 = mysql_query($insertSQL, $localhost) or die(mysql_error());     $insertGoTo = "plants.php";     if (isset($_SERVER['QUERY_STRING'])) {     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";     $insertGoTo .= $_SERVER['QUERY_STRING'];     }     header(sprintf("Location: %s", $insertGoTo));     exit; } ?> <html> <link href="../../css/stylesheet.css" rel="stylesheet" type="text/css"> <form method="POST" enctype="multipart/form-data" name="upload" id="upload">   <p align="center"><span class="bottomnav">Plant Name</span><br>     <input name="plant_name" type="text" class="logintext" id="plant_name" size="20" maxlength="50">   </p>   <p align="center"><span class="bottomnav">Plant Type </span><br>     <input name="plant_type" type="text" class="logintext" id="plant_type" size="20" maxlength="50">   </p>   <p align="center"><span class="bottomnav">Planting Month(s)</span><br>     <input name="planting_months" type="text" class="logintext" id="planting_months" size="20" maxlength="20"> </p>   <p align="center"><span class="bottomnav">Blooming Season</span><br>     <input name="blooming_season" type="text" class="logintext" id="blooming_season" size="20" maxlength="20"> </p>   <p align="center"><span class="bottomnav">Plant Description</span><br>     <textarea name="plant_description" cols="40" rows="6" class="logintext" id="plant_description"></textarea>   </p>   <p align="center"><span class="bottomnav">Image</span><br>     <input name="userfile" type="file" class="loginbutton" id="userfile">   </p>   <p align="center">     <input name="Submit" type="submit" class="loginbutton" value="Submit">   </p>   </form> </html> [/code] Sorry to be a pain, Steve
  2. No good mate. I don't get the error anymore, but nothing else happens either :( Steve
  3. Ok, so i have now got my form back :) Yey....Thanks!! But, it comes up with 'error uploading file', and nothing goes into the database, or the folder  ::) Sorry for being a pain :) Steve [code] <?php require_once('../../Connections/localhost.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") {   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);   switch ($theType) {     case "text":       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";       break;        case "long":     case "int":       $theValue = ($theValue != "") ? intval($theValue) : "NULL";       break;     case "double":       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";       break;     case "date":       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";       break;     case "defined":       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;       break;   }   return $theValue; } } if(isset($_POST['upload'])) { $fileImagename = $_FILES['userfile']['image_name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileImagesize = $_FILES['userfile']['image_size']; $fileImagetype = $_FILES['userfile']['image_type']; $filePlantname = $_POST['plant_name']; $filePlanttype = $_POST['plant_type']; $filePlantmonth = $_POST['planting_months']; $fileBloomseason = $_POST['blooming_season']; $filePlantdesc = $_POST['plant_description']; $uploaddir = '/plants/'; $uploadfile = $uploaddir . basename($_FILES['userfile']['image_name']); if(move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir)) {     echo "The file ".  basename( $_FILES['userfile']['image_name']).     " has been uploaded"; } else{     echo "There was an error uploading the file, please try again!"; } } ?> <html> <link href="../../css/stylesheet.css" rel="stylesheet" type="text/css"> <form method="POST" enctype="multipart/form-data" name="upload" id="upload">   <p align="center"><span class="bottomnav">Plant Name</span><br>     <input name="plant_name" type="text" class="logintext" id="plant_name" size="20" maxlength="50">   </p>   <p align="center"><span class="bottomnav">Plant Type </span><br>     <input name="plant_type" type="text" class="logintext" id="plant_type" size="20" maxlength="50">   </p>   <p align="center"><span class="bottomnav">Planting Month(s)</span><br>     <input name="planting_months" type="text" class="logintext" id="planting_months" size="20" maxlength="20"> </p>   <p align="center"><span class="bottomnav">Blooming Season</span><br>     <input name="blooming_season" type="text" class="logintext" id="blooming_season" size="20" maxlength="20"> </p>   <p align="center"><span class="bottomnav">Plant Description</span><br>     <textarea name="plant_description" cols="40" rows="6" class="logintext" id="plant_description"></textarea>   </p>   <p align="center"><span class="bottomnav">Image</span><br>     <input name="userfile" type="file" class="loginbutton" id="userfile">   </p>   <p align="center">     <input name="Submit" type="submit" class="loginbutton" value="Submit">   </p>   </form> </html> <?php $filePath = $uploadDir . $fileImagename; $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error uploading file"; exit; } if(!get_magic_quotes_gpc()) { $fileImagename = addslashes($fileImagename); $filePath = addslashes($filePath); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "upload")) { $insertSQL = sprintf("INSERT INTO plants (image_name, image_type, image_size, path, plant_name, plant_type, planting_months, blooming_season, plant_description) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",     $fileImagename,     $fileImagetype,     $fileImagesize,     GetSQLValueString($_POST['plant_name'], "text"),     GetSQLValueString($_POST['plant_type'], "text"),     GetSQLValueString($_POST['planting_months'], "text"),     GetSQLValueString($_POST['blooming_season'], "text"),     GetSQLValueString($_POST['plant_description'], "text")); }   mysql_select_db($database_localhost, $localhost);   $Result1 = mysql_query($insertSQL, $localhost) or die(mysql_error());   $insertGoTo = "plants.php";   if (isset($_SERVER['QUERY_STRING'])) {     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";     $insertGoTo .= $_SERVER['QUERY_STRING'];   }   header(sprintf("Location: %s", $insertGoTo)); ?> <?php mysql_select_db($database_localhost, $localhost); $query_Recordset1 = "SELECT plant_name, plant_type, planting_months, blooming_season, plant_description FROM plants"; $Recordset1 = mysql_query($query_Recordset1, $localhost) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> <?php mysql_free_result($Recordset1); ?> [/code]
  4. So it is mean't to be like this... [code] if(isset($_POST['upload'])) { $fileImagename = $_FILES['userfile']['image_name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileImagesize = $_FILES['userfile']['image_size']; $fileImagetype = $_FILES['userfile']['image_type']; $filePlantname = $_POST['plant_name']; $filePlanttype = $_POST['plant_type']; $filePlantmonth = $_POST['planting_months']; $fileBloomseason = $_POST['blooming_season']; $filePlantdesc = $_POST['plant_description']; } ?> <link href="../../css/stylesheet.css" rel="stylesheet" type="text/css"> <form method="POST" enctype="multipart/form-data" name="upload" id="upload">   <p align="center"><span class="bottomnav">Plant Name</span><br>     <input name="plant_name" type="text" class="logintext" id="plant_name" size="20" maxlength="50">   </p>   <p align="center"><span class="bottomnav">Plant Type </span><br>     <input name="plant_type" type="text" class="logintext" id="plant_type" size="20" maxlength="50">   </p>   <p align="center"><span class="bottomnav">Planting Month(s)</span><br>     <input name="planting_months" type="text" class="logintext" id="planting_months" size="20" maxlength="20"> </p>   <p align="center"><span class="bottomnav">Blooming Season</span><br>     <input name="blooming_season" type="text" class="logintext" id="blooming_season" size="20" maxlength="20"> </p>   <p align="center"><span class="bottomnav">Plant Description</span><br>     <textarea name="plant_description" cols="40" rows="6" class="logintext" id="plant_description"></textarea>   </p>   <p align="center"><span class="bottomnav">Image</span><br>     <input name="userfile" type="file" class="loginbutton" id="userfile">   </p>   <p align="center">     <input name="Submit" type="submit" class="loginbutton" value="Submit">   </p>   </form> <?php $filePath = $uploadDir . $fileImagename; $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error uploading file"; exit; } if(!get_magic_quotes_gpc()) { $fileImagename = addslashes($fileImagename); $filePath = addslashes($filePath); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "upload")) { $insertSQL = sprintf("INSERT INTO plants (image_name, image_type, image_size, path, plant_name, plant_type, planting_months, blooming_season, plant_description) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",     $fileImagename,     $fileImagetype,     $fileImagesize,     GetSQLValueString($_POST['plant_name'], "text"),     GetSQLValueString($_POST['plant_type'], "text"),     GetSQLValueString($_POST['planting_months'], "text"),     GetSQLValueString($_POST['blooming_season'], "text"),     GetSQLValueString($_POST['plant_description'], "text")); }   mysql_select_db($database_localhost, $localhost);   $Result1 = mysql_query($insertSQL, $localhost) or die(mysql_error());   $insertGoTo = "plants.php";   if (isset($_SERVER['QUERY_STRING'])) {     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";     $insertGoTo .= $_SERVER['QUERY_STRING'];   }   header(sprintf("Location: %s", $insertGoTo)); ?> [/code] Thanks again, Steve
  5. Wouldn't it be a case of having to install all of the fonts onto the server, and then using a dropdown in php or something to choose the font type, as the user selects it?
  6. Many Thanks for the reply mate, Now it seems that it isn't even showing the form, just comes up with the error, "There was an error uploading the file, please try again!Error uploading file" Think i've got something in the wrong place now :( Here is the code now... [code] <?php require_once('../../Connections/localhost.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") {   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);   switch ($theType) {     case "text":       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";       break;        case "long":     case "int":       $theValue = ($theValue != "") ? intval($theValue) : "NULL";       break;     case "double":       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";       break;     case "date":       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";       break;     case "defined":       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;       break;   }   return $theValue; } } $uploaddir = '/plants/'; $uploadfile = $uploaddir . basename($_FILES['userfile']['image_name']); if(move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir)) {     echo "The file ".  basename( $_FILES['userfile']['image_name']).     " has been uploaded"; } else{     echo "There was an error uploading the file, please try again!"; } if(isset($_POST['upload'])) { $fileImagename = $_FILES['userfile']['image_name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileImagesize = $_FILES['userfile']['image_size']; $fileImagetype = $_FILES['userfile']['image_type']; $filePlantname = $_POST['plant_name']; $filePlanttype = $_POST['plant_type']; $filePlantmonth = $_POST['planting_months']; $fileBloomseason = $_POST['blooming_season']; $filePlantdesc = $_POST['plant_description']; } $filePath = $uploadDir . $fileImagename; $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error uploading file"; exit; } if(!get_magic_quotes_gpc()) { $fileImagename = addslashes($fileImagename); $filePath = addslashes($filePath); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "upload")) { $insertSQL = sprintf("INSERT INTO plants (image_name, image_type, image_size, path, plant_name, plant_type, planting_months, blooming_season, plant_description) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",     $fileImagename,     $fileImagetype,     $fileImagesize,     GetSQLValueString($_POST['plant_name'], "text"),     GetSQLValueString($_POST['plant_type'], "text"),     GetSQLValueString($_POST['planting_months'], "text"),     GetSQLValueString($_POST['blooming_season'], "text"),     GetSQLValueString($_POST['plant_description'], "text")); }   mysql_select_db($database_localhost, $localhost);   $Result1 = mysql_query($insertSQL, $localhost) or die(mysql_error());   $insertGoTo = "plants.php";   if (isset($_SERVER['QUERY_STRING'])) {     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";     $insertGoTo .= $_SERVER['QUERY_STRING'];   }   header(sprintf("Location: %s", $insertGoTo)); ?> <?php mysql_select_db($database_localhost, $localhost); $query_Recordset1 = "SELECT plant_name, plant_type, planting_months, blooming_season, plant_description FROM plants"; $Recordset1 = mysql_query($query_Recordset1, $localhost) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> <link href="../../css/stylesheet.css" rel="stylesheet" type="text/css"> <form method="POST" enctype="multipart/form-data" name="upload" id="upload">   <p align="center"><span class="bottomnav">Plant Name</span><br>     <input name="plant_name" type="text" class="logintext" id="plant_name" size="20" maxlength="50">   </p>   <p align="center"><span class="bottomnav">Plant Type </span><br>     <input name="plant_type" type="text" class="logintext" id="plant_type" size="20" maxlength="50">   </p>   <p align="center"><span class="bottomnav">Planting Month(s)</span><br>     <input name="planting_months" type="text" class="logintext" id="planting_months" size="20" maxlength="20"> </p>   <p align="center"><span class="bottomnav">Blooming Season</span><br>     <input name="blooming_season" type="text" class="logintext" id="blooming_season" size="20" maxlength="20"> </p>   <p align="center"><span class="bottomnav">Plant Description</span><br>     <textarea name="plant_description" cols="40" rows="6" class="logintext" id="plant_description"></textarea>   </p>   <p align="center"><span class="bottomnav">Image</span><br>     <input name="userfile" type="file" class="loginbutton" id="userfile">   </p>   <p align="center">     <input name="Submit" type="submit" class="loginbutton" value="Submit">   </p>   </form> <?php mysql_free_result($Recordset1); ?> [/code] Thanks again, Steve
  7. Biut they are stated above with the file pointers....How can i correct this? thanks for help & reply :)
  8. Hi all, Please could somebody help me out with this script. I want it to upload all the details into the db, and the image into a folder, storing the image name, size and path on server into db. For some reason though, it doesn't upload the image, or store any of the image details in db, just the other details. Here is the code... [code]<?php require_once('../../Connections/localhost.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") {   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);   switch ($theType) {     case "text":       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";       break;        case "long":     case "int":       $theValue = ($theValue != "") ? intval($theValue) : "NULL";       break;     case "double":       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";       break;     case "date":       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";       break;     case "defined":       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;       break;   }   return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) {   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } $target_path = "../plants/"; $target_path = $target_path . basename( $_FILES['userfile']['image_name']); if(move_uploaded_file($_FILES['userfile']['tmp_name'], $target_path)) {     echo "The file ".  basename( $_FILES['userfile']['image_name']).     " has been uploaded"; } else{     echo "There was an error uploading the file, please try again!"; } if(isset($_POST['upload'])) { $fileImagename = $_FILES['userfile']['image_name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileImagesize = $_FILES['userfile']['image_size']; $fileImagetype = $_FILES['userfile']['image_type']; $filePlantname = $_POST['userfile']['plant_name']; $filePlanttype = $_POST['userfile']['plant_type']; $filePlantmonth = $_POST['userfile']['planting_months']; $fileBloomseason = $_POST['userfile']['blooming_season']; $filePlantdesc = $_POST['userfile']['plant_description']; } $filePath = $uploadDir . $fileImagename; $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error uploading file"; exit; } if(!get_magic_quotes_gpc()) { $fileImagename = addslashes($fileImagename); $filePath = addslashes($filePath); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "upload")) {   $insertSQL = sprintf("INSERT INTO plants (image_name, image_type, image_size, path, plant_name, plant_type, planting_months, blooming_season, plant_description) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",                        GetSQLValueString($_POST['plant_name'], "text"),                        GetSQLValueString($_POST['plant_type'], "text"),                        GetSQLValueString($_POST['planting_months'], "text"),                        GetSQLValueString($_POST['blooming_season'], "text"),                        GetSQLValueString($_POST['plant_description'], "text"));   mysql_select_db($database_localhost, $localhost);   $Result1 = mysql_query($insertSQL, $localhost) or die(mysql_error());   $insertGoTo = "plants.php";   if (isset($_SERVER['QUERY_STRING'])) {     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";     $insertGoTo .= $_SERVER['QUERY_STRING'];   }   header(sprintf("Location: %s", $insertGoTo)); } ?> <?php mysql_select_db($database_localhost, $localhost); $query_Recordset1 = "SELECT plant_name, plant_type, planting_months, blooming_season, plant_description FROM plants"; $Recordset1 = mysql_query($query_Recordset1, $localhost) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> <link href="../../css/stylesheet.css" rel="stylesheet" type="text/css"> <form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="upload" id="upload">   <p align="center"><span class="bottomnav">Plant Name</span><br>     <input name="plant_name" type="text" class="logintext" id="plant_name" size="20" maxlength="50">   </p>   <p align="center"><span class="bottomnav">Plant Type </span><br>     <input name="plant_type" type="text" class="logintext" id="plant_type" size="20" maxlength="50">   </p>   <p align="center"><span class="bottomnav">Planting Month(s)</span><br>     <input name="planting_months" type="text" class="logintext" id="planting_months" size="20" maxlength="20"> </p>   <p align="center"><span class="bottomnav">Blooming Season</span><br>     <input name="blooming_season" type="text" class="logintext" id="blooming_season" size="20" maxlength="20"> </p>   <p align="center"><span class="bottomnav">Plant Description</span><br>     <textarea name="plant_description" cols="40" rows="6" class="logintext" id="plant_description"></textarea>   </p>   <p align="center"><span class="bottomnav">Image</span><br>     <input name="userfile" type="file" class="loginbutton" id="userfile">   </p>   <p align="center">     <input name="Submit" type="submit" class="loginbutton" value="Submit">   </p>   <input type="hidden" name="MM_insert" value="upload"> </form> <?php mysql_free_result($Recordset1); ?> [/code] Thanks in advance all, Steve
  9. Hi all, I have a page (choice.php), with a dropdown menu, populated with categories, (A-Z). When one is chosen, it populates the page, (view.php), with the contents of the category which has artists in. The category is chosen when the selection is made from teh dropdown, which passes the appropiate id, (http://www.srtfdgtr.com/view.php?id=1, (A-1, Z-26)). What i wish to know is how i can get the outputted artists names to make a link which will then go to another page which will display the appropiate info for each artist from the database fields, artist_name, album_title, and album info? Here's the code for view.php [code] <?php require('Connections/xxxdb.php'); ?> <?php $maxRows_Recordset1 = 10; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) {   $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; $colname_Recordset1 = "-1"; if (isset($_GET['category'])) {   $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['category'] : addslashes($_GET['category']); } mysql_select_db($database_xxxdb, $xxxdb); $query_Recordset1 = sprintf("SELECT id, artist_name, album_title, category FROM upload2 WHERE category = '%s' ORDER BY artist_name DESC", $colname_Recordset1); $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $xxxdb) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) {   $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else {   $all_Recordset1 = mysql_query($query_Recordset1);   $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; ?> <link href="/standard.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- .style10 {     font-size: 14;     color: #999933; } --> </style> <title>xxx - Search Results</title><p>&nbsp;</p> <div align="center" class="style1 style10">   <p><?php echo $totalRows_Recordset1 ?> Category Result Found<br>   </p> </div> <table width="383" border="0" align="center" cellpadding="8" cellspacing="5">   <tr>     <td><div align="center" class="style5">Artist / Group </div></td>     <td><div align="center" class="style5">Album Title </div></td>   </tr>      <?php do { ?>     <tr>       <td class="style6"><div align="center"><?php echo $row_Recordset1['artist_name']; ?> </div></td>       <td class="style6"><div align="center"><?php echo $row_Recordset1['album_title']; ?></div></td>     </tr>     <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </table> <?php mysql_free_result($Recordset1); ?> [/code] Thanks all
  10. Please can sombody help me with this? On one page i want a list of links which will each pass a variable along with the url..eg.. [a href=\"http://sdrgrestg.com/view.php?id==n\" target=\"_blank\"]http://sdrgrestg.com/view.php?id==n[/a] Then i want the page that views to get all the entries in the db which start with 'n' I have created a recordest on the view page, and optioned it to get all records from a_group and b_group, filter them by url variable, and list by a_group, ascending first, but it doesn't seem to work when i pass the variable to it. Thanks
  11. [!--quoteo(post=368593:date=Apr 25 2006, 08:37 PM:name=litebearer)--][div class=\'quotetop\']QUOTE(litebearer @ Apr 25 2006, 08:37 PM) [snapback]368593[/snapback][/div][div class=\'quotemain\'][!--quotec--] Just an old coot's observation, and we know old guys can be wrong. that being the case. would not this [code] $img = $my_data['path']; echo "<img src='http://www.xxxxx.co.uk/images/$img'>"; [/code] result in this [code] <img src="http://www.xxx.co.uk/images//images/hftht.jpg"> [/code] presuming the image folder is just below the script folder, why not simply [code] $img = $my_data['path']; echo '<img src="' . $img . '">'; [/code] Lite... [/quote] Thanks for that...That did the trick :)
  12. [!--quoteo(post=368581:date=Apr 25 2006, 07:59 PM:name=sanfly)--][div class=\'quotetop\']QUOTE(sanfly @ Apr 25 2006, 07:59 PM) [snapback]368581[/snapback][/div][div class=\'quotemain\'][!--quotec--] how about [code]$img = $my_data['path']; echo "<img src='http://www.xxxxx.co.uk/images/$img'>";[/code] [/quote] Thanks for the help...No luck though. Still displaying as a box where the image should be followed by ../images/picture.jpg
  13. Hi all, i have my images location paths stored in my db as "/images/hftht.jpg" etc I am trying to pull them from the db and display them on the page, but when i do, i don't get the images displayed. Is this code ok? echo "<img src='http://www.xxxxx.co.uk/images/'>", $my_data['path']; Thanks
  14. [!--quoteo(post=368559:date=Apr 25 2006, 07:05 PM:name=Mortier)--][div class=\'quotetop\']QUOTE(Mortier @ Apr 25 2006, 07:05 PM) [snapback]368559[/snapback][/div][div class=\'quotemain\'][!--quotec--] Yes, I think the best way is using a database, like MySQL. If you have this on your website/server you're fine with that I suppose you have no experience with that; Then you can use 1 page ( And that would list e.g. all albums (I think u mean this:) and once u click on an album you'll get more detailed info. PHP can make a script (which can be like 50 lines) that will list all the albums using the (MySQL)database. Then you can give each album a link (you only have to do it once and php will do this for all of your database items== your albums) And each link will carry the unique ID of that album which will load the data as the tracks and the album cover. So that can be indeed, much and much more efficient -> if I understand you correctly. [/quote] Thanks for that. That is exactly what i mean. I did think about that, and i did start storing info into a database. Everything went in ok apart from the image bit. I got them uploading into the image folder on my server, but then i couldn't work out how to get a link to them from the location into the database. Well, i did get them linking, but only using the full path, eg. c:/domains/xxxx.com/wwwroot/images/ I asked for help on these forums, but i couldn't reeally get my head around it, even though the man was very helpful. Then, how do i get the info displayed from the db, into a table? I can get it to display, but i don't know how to display it in a table, (is it possible tyo layout the table etc, and then just get the db to extract the info into the row i want? Many Thanks Also, Is it really better to store images on the web server and not in the database?
  15. Hi all, I am creating a site that lists album reviews. At the moment i am making a page called (name of artisit).php, and then listing all their albums on that page, with a small description. Then i am linking each album, and creating a page which shows album cover and track listing etc. So i have 1 page for each artist, and then 1 page for each of the artists albums. All of which i am hand entering. Is there a more efficient way of doing this? Thanks
  16. [b]edit[/b]: also, i wouldnt recommend you store anything other than the filename in the DB anyway. if you ever change your server or directory names, all the DB filenames will be broken links. if you store the path in variables (for example, in a config.php file which you include into your pages as required), then all you need to store in the DB is just the filename (eg, myimage.jpg and not c:/blahblah/blah/wwwroot/images/myimage.jpg) [/quote] Ok, guess i will start again then as i cant get it working properly anyway. Just get the image holder, and when i right click it just tells me that the image location should be admin, when it shouldn't. I'll look aroubnd and try and find out what you are going on about with the config.php as i dont understand, and i should imagine your patience is wearing a bit thin with me know :) Thanks for all the help
  17. It's the full path... C:/domains/xxxxxxx/wwwroot/images/givea....jpg So far i have this to output the data from every record... $sql = "SELECT * FROM upload2"; $data = mysql_query($sql); while($my_data = mysql_fetch_array($data)) { printf("%s,<br> %s,<br> %s,<br> %s, <br />", $my_data['artist_name'], $my_data['album_title'], $my_data['album_info'], $my_data['path']); } This is fine, although a bit nasty looking, but i will sort that after i have everything listing ok....probably use tables to lay it out. I can't seem to find a way of turning the image path, into the actual image though. Thanks I have managed to change the stored url to ../images/erg4tr.jpg now, but if i change it to [a href=\"http://www.sgrt.co.uk/images/\" target=\"_blank\"]http://www.sgrt.co.uk/images/[/a], then it doesn't work
  18. Thanks Mark, The post statements did the trick. I just need to figure out the best way of calling the info back and displaying it on screen. I don't suppose you have a line or 2 of code to set me in the right direction, as i'm not sure about how to disp[lay the uploaded image via the link which is stored in the db. Many Thanks again
  19. [!--quoteo(post=367693:date=Apr 23 2006, 03:59 PM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Apr 23 2006, 03:59 PM) [snapback]367693[/snapback][/div][div class=\'quotemain\'][!--quotec--] hi, not sure what error youre getting, but i'm guessing it's gonna be a permissions thing. have you made sure that the c:/...blahblah.../images directory is 'writable' by the script? by default, it wont be, so you'll need to change this so that you can write to the images directory. try that first, see how it goes, then onto round two... cheers Mark [/quote] Thanks again Mark, I know have images uploading into the correct directory on the web server, and i have got the path saved in the db. Any ideas what is wrong here though...it doesn't want to upload the other information which goes with the images.. if(isset($_POST['upload'])) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $fileArtname = $_FILES['userfile']['artist_name']; $fileAlbtitle = $_FILES['userfile']['album_title']; $fileAlbinfo = $_FILES['userfile']['album_info']; $filePath = $uploadDir . $fileName; $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error uploading file"; exit; } if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath = addslashes($filePath); } $query = "INSERT INTO upload2 (name, size, type, path, artist_name, album_title, album_info) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$filePath', '$fileArtname', '$fileAlbtitle', '$fileAlbinfo')"; It inserts the image, the path and the filename, but none of the rest. Thanks
  20. Thanks for the help mark I am using dreamweaver, and when i try to upload the picture, i get the error...here is my code <form action="/admin/upload_script.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> Select Image <label> <input type="file" name="file" /> <br /> <input type="submit" name="Submit" value="Submit" /> </label> </form> and the handling script... <?php // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead // of $_FILES. $uploaddir = 'c:/domains/xxxxxxxxx/wwwroot/images/'; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); echo '<pre>'; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "Possible file upload attack!\n"; } echo 'Here is some more debugging info:'; print_r($_FILES); print "</pre>"; ?> Now i'm stuck before i even get to the part of adding the link into the database :( Thanks again
  21. I can store the uploaded file into the images directory on the webserver, but then i don't know how to store the link to the image into the database Many Thanks
  22. Hi all, Please could somebody help me to store an image link in mysql database instead of storing the actual image. EG. users uploads file which goes into images folder on webserver, and at same time, a link to it gets saved in the db for future reference. Thanks
×
×
  • 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.