...

View Full Version : problems uploading files to mysql using php



cs1h
09-04-2007, 02:22 PM
Hi,

I am trying to upload photos to a mysql databse but with no luck. I'm not getting any error messages, the problem is that nothing appears in the database.

the form proccessor is as follows,

<?php
mysql_connect("localhost","adder","clifford");
mysql_select_db("real");
$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
$result=MYSQL_QUERY("INSERT INTO items (continent,country,type,Email,Title,Abstract,Article,data,filename,filesize,filetype) ". "VALUES ('menuSubjectsDMA','menuFilesDMA','Catagory','$Email','$title','$message','$messagetwo','$form_descr iption','$data','$form_data_name','$form_data_size','$form_data_type')");
$id= mysql_insert_id();
print "<p>File ID: <b>$id</b><br>";
print "<p>File Name: <b>$form_data_name</b><br>";
print "<p>File Size: <b>$form_data_size</b><br>";
print "<p>File Type: <b>$form_data_type</b><p>";
print "To upload another file <a href=http://www.myroho.com/add.html> Click Here</a>";
?>

the form is as follows,

<FORM name=myform action=send-mail.php method=post enctype="multipart/form-data">
<table border="0" width="588" cellspacing="0" cellpadding="0" id="table9">
<tr>
<td width="574">
<table border="0" width="574" cellspacing="0" cellpadding="0" id="table10">
<tr>
<td width="14" height="28" background="line_left_corner_top.png">&nbsp;</td>
<td height="28" background="line_top.png" width="546" colspan="3">&nbsp;</td>
<td width="14" height="28" background="line_right_corner_top.png">&nbsp;</td>
</tr>
<tr>
<td width="14" background="line_left.png" rowspan="35" bgcolor="#FFFFFF">&nbsp;</td>
<td colspan="3" width="546" bgcolor="#FFFFFF"><font color="#00518D"><span class="style10">
Submit Articles to Roaming Hordes Magazine</span></font></td>
<td width="14" background="line_right.png" rowspan="35" bgcolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td colspan="3" width="546" bgcolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td colspan="3" width="546" bgcolor="#FFFFFF"><span class="style51">
Adding to the members' magazine is easy. Simply fill
out the form below to submit an article <small>(all fields are required to submit). </small></span></td>
</tr>
<tr>
<td colspan="3" bgcolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><span class="style68"><font color="#EE7F01">1</font></span><span class="style62"><font color="#EE7F01">.</font></span><span class="style62"> E<span class="style78">mail:</span></span></td>
<td bgcolor="#FFFFFF">&nbsp;</td>
<td bgcolor="#FFFFFF"><label>
<input name="Email" type="text" id="Email" size="28" maxlength="250">
</label></td>
</tr>
<tr>
<td colspan="3" width="546" bgcolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td width="546" align="left" valign="top" bgcolor="#FFFFFF"><span class="style68"><font color="#EE7F01">2</font></span><span class="style62"><font color="#EE7F01">.</font></span> <span class="style62">T<span class="style78">itle:</span></span></td>
<td width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td style="width: 421px" align="left" valign="top" bgcolor="#FFFFFF">
<input name="title" type="text" class="userpass" id="title" style="width: 421" value="" size="28" maxlength="250"></td>
</tr>
<tr>
<td width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td style="width: 421px" align="left" valign="top" bgcolor="#FFFFFF">&nbsp;
</td>
</tr>
<tr>
<td width="546" height="20" bgcolor="#FFFFFF">
<span class="style58"><font color="#000000">(20 character limit)</font></span></td>
<td width="546" height="20" bgcolor="#FFFFFF">&nbsp;</td>
<td style="width: 421px" align="left" valign="top" height="20" bgcolor="#FFFFFF">
<span class="style58"><font color="#00518D"><em>i.e.</em> catchy description of article's content</font></span></td>
</tr>
<tr>
<td colspan="3" bgcolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td colspan="3" bgcolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top" width="546" bgcolor="#FFFFFF">
<span class="style68"><font color="#EE7F01">3</font></span><span class="style62"><font color="#EE7F01">.</font>A<span class="style78">bstract:</span></span>
<p class="style58">
<font color="#00518D"><em>i.e.</em> short overview and introduction to full article</font></p>
<p class="style58"><font color="#000000">(300 character limit)</font></p>
<p>&nbsp;</td>
<td align="left" valign="top" width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" style="width: 421" bgcolor="#FFFFFF"><font size="1" face="arial, helvetica, sans-serif"><br>
<textarea name=message wrap=physical cols=50 rows=7 onKeyDown="textCounter(this.form.message,this.form.remLen,300);" onKeyUp="textCounter(this.form.message,this.form.remLen,300);"></textarea>
<br>
<input readonly type=text name=remLen size=3 maxlength=3 value="300">
<font face="Verdana, Arial, Helvetica, sans-serif">characters left</font></font><font face="Verdana, Arial, Helvetica, sans-serif">&nbsp;</font>&nbsp;</td>
</tr>
<tr>
<td colspan="3" bgcolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td colspan="3" bgcolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top" width="546" bgcolor="#FFFFFF"><span class="style68"><font color="#EE7F01">4</font></span><span class="style62"><font color="#EE7F01">.</font></span> <span class="style62">A<span class="style78">rticle:</span></span>
<p><span class="style58">
<font color="#00518D"><em>i.e.</em> full article</font></span></p>
<p><span class="style58"><font color="#000000">(4000 character limit)</font></span></p>
<p>&nbsp;</td>
<td align="left" valign="top" width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" bgcolor="#FFFFFF"><font size="1" face="arial, helvetica, sans-serif"><br>
<textarea name=messagetwo wrap=physical cols=50 rows=7 onkeydown="textCounter(this.form.messagetwo,this.form.remLen2,4000);" onkeyup="textCounter(this.form.messagetwo,this.form.remLen2,4000);"></textarea>
<br>
<input readonly type=text name=remLen2 size=4 maxlength=4 value="4000"> characters left</font>&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top" width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" bgcolor="#FFFFFF">&nbsp;
</td>
</tr>
<tr>
<td align="left" valign="top" width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" bgcolor="#FFFFFF">
<span class="style86"><font color="#EE7F01">&gt;&gt;</font>
<font color="#00518D"><a href="add%20item.html">
<font color="#00518D">Save article to personal email account</font></a> </font><font color="#EE7F01">&gt;&gt;</font><font color="#EE7F01"></font><font color="#EE7F01"></font></span></td>
</tr>
<tr>
<td width="546" colspan="3" bgcolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td width="546" bgcolor="#FFFFFF"><span class="style68"><font color="#EE7F01">5</font></span><span class="style62"><font color="#EE7F01">.</font></span> <span class="style62">L<span class="style78">ocation:</span></span></td>
<td width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" bgcolor="#FFFFFF"><select name="menuSubjectsDMA" onChange="changeFilesDMA()">
<option value="none">Select a Continent
<option value="">Africa
<option value="">Asia
<option value="">Europe
<option value="">North America
<option value="">Oceania
<option value="">South America
</select>

<!-- this menu holds the files to go-->

<select name="menuFilesDMA" style="width:300">

<option value="none"> Choose Country
</select>&nbsp;</td>
</tr>
<tr>
<td width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" bgcolor="#FFFFFF">&nbsp;
</td>
</tr>
<tr>
<td width="546" bgcolor="#FFFFFF"><span class="style58">
<font color="#000000">(20 character limit)</font></span></td>
<td width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" bgcolor="#FFFFFF">
<span class="style58"><font color="#00518D"><em>i.e.</em>where and when did the events you have written about occur? </font></span></td>
</tr>
<tr>
<td width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" bgcolor="#FFFFFF">&nbsp;
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><span class="style68"><font color="#EE7F01">6</font></span><span class="style62"><font color="#EE7F01">. </font> P<span class="style78">hotos:</span></span></td>
<td bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" bgcolor="#FFFFFF"><label>
<input name="userfile" type="file" id="userfile">
</label></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">&nbsp;</td>
<td bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" bgcolor="#FFFFFF">&nbsp;</td>
</tr>

<tr>
<td width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" bgcolor="#FFFFFF">&nbsp;
</td>
</tr>
<tr>
<td width="546" height="42" bgcolor="#FFFFFF"><span class="style68">
<font color="#EE7F01">7</font></span><span class="style62"><font color="#EE7F01">. </font>C<span class="style78">atagory:</span></span></td>
<td width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="middle" width="546" bgcolor="#FFFFFF"><select name="Catagory" id="Catagory">
<option>Magazine</option>
<option>News</option>
<option>Review</option>
<option>List</option>
</select></td>
</tr>
<tr>
<td width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" bgcolor="#FFFFFF">&nbsp;
</td>
</tr>
<tr>
<td width="546" height="20" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" height="20" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" height="20" bgcolor="#FFFFFF">
<span class="style18">
<a href="catagories.html"><font color="#00518D">Choose the c</font></a></span><span class="style10"><a href="catagories.html"><font color="#00518D">atagory that best suits your article (if unsure click here)</font></a></span> </td>
</tr>
<tr>
<td width="546" height="19" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" height="19" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" height="19" bgcolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td width="546" height="19" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" height="19" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" height="19" bgcolor="#FFFFFF">&nbsp;
</td>
</tr>
<tr>
<td width="546" height="20" bgcolor="#FFFFFF"><font color="#EE7F01">
<span class="style68">8.</span> </font>
<span class="style62">S<span class="style78">ubmit:</span></span></td>
<td width="546" height="20" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" height="20" bgcolor="#FFFFFF"><span class="style51">By submitting you agree to the <span class="style17"> <a href="register.html"><font color="#00518D">terms of use</font></a></span> and <span class="style17"><a href="register.html"><font color="#00518D">privacy policy</font></a></span>.</span></td>
</tr>
<tr>
<td width="546" height="20" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" height="20" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" height="20" bgcolor="#FFFFFF">&nbsp; </td>
</tr>
<tr>
<td width="546" height="20" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" height="20" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" height="20" bgcolor="#FFFFFF"><label>
<INPUT type=submit value=Submit name=submit>
</label></td>
</tr>
<tr>
<td width="546" height="20" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" height="20" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" height="20" bgcolor="#FFFFFF">&nbsp; </td>
</tr>
<tr>
<td width="546" height="20" bgcolor="#FFFFFF">&nbsp;</td>
<td width="546" height="20" bgcolor="#FFFFFF">&nbsp;</td>
<td align="left" valign="top" width="546" height="20" bgcolor="#FFFFFF">
<span class="style51">Having problems with a submission? Email
<a href="mailto:info@mysite.com">
info@mysite.com</a>.</span></td>
</tr>
<tr>
<td width="14" height="28" background="line_left_corner.png" bgcolor="#FFFFFF">&nbsp;</td>
<td height="28" width="546" background="line_base.png" colspan="3" bgcolor="#FFFFFF">&nbsp;</td>
<td width="14" height="28" background="line_right_corner.png" bgcolor="#FFFFFF">&nbsp;</td>
</tr>
</table>
</td>
<td width="14">&nbsp;</td>
</tr>
<tr>

<td width="574">&nbsp;</td>
<td width="14">&nbsp;</td>
</tr>
</table></form>


Any help is much appriciated,

Colin

Pennimus
09-04-2007, 04:53 PM
I'm not getting any error messages

Turn on error reporting (http://uk3.php.net/error_reporting) then.

Also please wrap your code in PHP tags so its easy for people to read.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum