I have produced an admin area which allows users to add, edit and delete
stories plus images. Everything has gone great, thanks to all of you who
answered previous postings.

Just stuck on the very last point...editing...the script below updates the
name and email fine, but uploading a new image it does not do. Does any one
have any ideas why the image upload is not working...it echos the new name
but does not upload the new file????

Thanks in advance 

Cheers 
Will 




PHP:
------------------------------------------------------------------------

<?



$db_name = "main";



$table_name = "main";



$connection = @mysql_connect("www.main.net", "main", "main") or die ("couldn
't connect.");



$db = @mysql_select_db($db_name, $connection) or die ("couldn't select
database.");



$sql = "UPDATE $table_name SET



name = \"$name\",

email = \"$email\",

picture_name = \"$picture_name\"

where id = \"$id\"



";





$result = @mysql_query($sql, $connection) or die ("couldn't execute query");





if ($picture) {



$path = "/home/main/main/php/";

$path1 = "http://www.main.net/php/";;

$b_id = mysql_insert_id();

$new_pic_name = "$b_id$picture_name";

$imageFile = $path1.$new_pic_name;



copy($picture,$path . $new_pic_name);

        



}







?> 





<html>

<head>

<title>my contact management system: add a contact</title>

</head>

<body>



  <table cellspace=3 cellpadding=5>

    <tr> 

      <th>Name & email information</th>

      <th>&nbsp;</th>

    </tr>

    <tr> 

      <td valign=top>

        <p><stong><font size="-2" face="Verdana, Arial, Helvetica,
sans-serif">name:</font><br>

        <? echo "$table_name"; ?>

          <? echo "$name"; ?>

        </p>

        <p><stong><font size="-2" face="Verdana, Arial, Helvetica,
sans-serif">email:</font><br><? echo "$email"; ?>

          

          <br>

        </p>

        <font size="-2" face="Verdana, Arial, Helvetica, sans-serif">File

        to Upload:</font><br>





<?

$new_pic_name = "$id$picture_name";

$path1 = "http://www.main.net/php/";;

$imageFile = $path1.$new_pic_name;

        



if ($new_pic_name == "$id") {

        

print ("<img src=\"http://www.main.co.uk/images/no_image_available.gif\";
width=\"162\" height=\"113\" border=\"0\">");

       

} else { 

      

      

        print "<img src=".$imageFile.">";





               

     

     }

     ?>

         

         

         

         

         <br> 

      <p><stong></p>

      </td>

      <td valign=top>&nbsp;</td>

    </tr>

    <tr> 

      <td align=center colspan=2>

        <div align="left"><br>

        </div>

        <p align="left">

          <input type="submit" name="submit" value="add to contact system">

        </p>

        <div align="left"></div>

        </td>

    </tr>

  </table>

</body>

</html>










-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to