anocweb Posted September 20, 2007 Share Posted September 20, 2007 ive been designing a website for a card company. lately he has been having issues uploading cards but i have no issues when i try. the only difference is i am on firefox and he is on ie7. could this have any difference? ** UPDATE ** i also cant upload now either. im at a complete loss. please help my code is as follows. i apologize if it is messy and uncommented, any questions please ask ill be happy to answer <?php include('header.inc.php'); include('../mysql.inc.php'); ?> <?php # connect to database $connect = $servername . ":" . $port; $sql = mysql_connect($connect,$username,$password); # check if connection succeeded if (!$sql) {die('Could not connect: ' . mysql_error());} # selects the database mysql_select_db($database, $sql); if ($_POST['step'] == "4") { move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'], "/var/www/vhosts/tradeart.no-ip.org/httpdocs/cards/" . $_POST['style'] . ".a.jpg"); echo 'DONE UPLOADING ' . $_POST['style'] . '!'; } elseif ($_POST['step'] == "3") { move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'], "/var/www/vhosts/tradeart.no-ip.org/httpdocs/cards/" . $_POST['style'] . ".i.jpg"); echo '<form method="post" enctype="multipart/form-data" url="card_upload.php"><table style="text-align: left; width: 80%;" border="0" cellpadding="2" cellspacing="2"> <tbody><input type="hidden" name="step" value="4"><input type="hidden" name="style" value="' . $_POST['style'] . '"> <tr> <td>Inside Image:</td> <td><input name="uploadFile" type="file"></td> </tr> <tr> <td></td> <td><input value="step 4" type="submit"></form></td> </tr> </tbody> </table>'; } elseif ($_POST['step'] == "2") { $inset = 'cards/' . $_POST['style'] . '.a.jpg'; $location = 'cards/' . $_POST['style'] . '.i.jpg'; $check = mysql_query("INSERT INTO product (style, description, category, location, inset, wide) VALUES ('" . $_POST['style'] . "', '" . $_POST['desc'] . "', '" . $_POST['cat'] . "', '$location', '$inset', '" . $_POST['wide'] . "')"); if ($check == "false") { echo "ERROR PLEASE GO BACK!"; } echo '<form method="post" enctype="multipart/form-data" url="card_upload.php"><table style="text-align: left; width: 80%;" border="0" cellpadding="2" cellspacing="2"> <tbody><input type="hidden" name="step" value="3"><input type="hidden" name="style" value="' . $_POST['style'] . '"> <tr> <td>Outside Image:</td> <td><input name="uploadFile" type="file"></td> </tr> <tr> <td></td> <td><input value="step 3" type="submit"></form></td> </tr> </tbody> </table>'; } else { echo '<table style="text-align: left; width: 80%;" border="0" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="text-align: right;">Style</td> <td><form method="post" url="card_upload.php"><input type="hidden" name="step" value="2"><input name="style"></td> </tr> <tr> <td style="text-align: right;">Category</td> <td> <select size="1" name="cat">'; $result = mysql_query("SELECT * FROM category"); while($row = mysql_fetch_array($result)) { echo '<option>' . $row['cat'] . '</option>'; } echo '</select> </td> </tr> <tr> <td></td> <td>Horizontal<input checked="checked" name="wide" value="1" type="radio"> Vertical <input name="wide" value="0" type="radio"> </td> </tr> <tr> <td style="text-align: right;">Description</td> <td><textarea cols="35" rows="3" name="desc"></textarea></td> </tr> <tr> <td></td> <td><input value="Step 2" type="submit"></form></td> </tr> </tbody> </table>'; } mysql_close($sql); ?> <?php include('footer.inc.php'); ?> Quote Link to comment Share on other sites More sharing options...
anocweb Posted September 21, 2007 Author Share Posted September 21, 2007 anybody? ??? Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 21, 2007 Share Posted September 21, 2007 Make sure you have errors enabled at the top of the page: ini_set('display_errors', 1); error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
anocweb Posted September 21, 2007 Author Share Posted September 21, 2007 already have that done in the config, but added it to the page anyways to make sure. i don't get any errors and mysql doesn't seem to give much error help, it connects and the query returns false i just don't understand why it would work for a while and then not work at all after that Quote Link to comment Share on other sites More sharing options...
anocweb Posted September 21, 2007 Author Share Posted September 21, 2007 sorry for double posting missed the time to edit by a hair i have also added or die(mysql_error()); to the query, it displays no error Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 21, 2007 Share Posted September 21, 2007 put <?php error_reporting(1); ini_set('error_reporting', E_ALL); ?> at the top of your script. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 21, 2007 Share Posted September 21, 2007 if (!$sql) {die('Could not connect: ' . mysql_error());} <----- this line is not needed Try: <?php $sql= mysql_connect($connect,$username,$password) or { die ('Could not connect: ' . mysql_error());}?> also make sure your user name and password are correct database wise Quote Link to comment Share on other sites More sharing options...
anocweb Posted September 21, 2007 Author Share Posted September 21, 2007 didnt help persay but does clean it up a bit. thanks. the { and } will cause a parse error though. fixed version: <?php $sql= mysql_connect($connect,$username,$password) or die ('Could not connect: ' . mysql_error()); ?> Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 21, 2007 Share Posted September 21, 2007 also im thinking it has to do with check===false always returning false Quote Link to comment Share on other sites More sharing options...
anocweb Posted September 21, 2007 Author Share Posted September 21, 2007 how so? please explain your thoughts. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 21, 2007 Share Posted September 21, 2007 try if($check!=="false") {insert SQL} else if ($check=="false") {echo "error";} Quote Link to comment Share on other sites More sharing options...
anocweb Posted September 21, 2007 Author Share Posted September 21, 2007 that stops them from going further, thanks again. i checked the statistics for my mysql and apparently ~90% of the queries fail... most being inserts. everything else works though. any ideas? Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 21, 2007 Share Posted September 21, 2007 haha i see why they fail if you already have $variable=$_POST[variable]; no need to put it again. just do VALUES ($variable1,$variable2) Quote Link to comment Share on other sites More sharing options...
anocweb Posted September 21, 2007 Author Share Posted September 21, 2007 are you referring to: $inset = 'cards/' . $_POST['style'] . '.a.jpg'; $location = 'cards/' . $_POST['style'] . '.i.jpg'; if so, it didn't make a difference before. it worked fine for... a couple days and then stopped working could it have anything to do with the mysql ini? if so, i can post it here Quote Link to comment Share on other sites More sharing options...
anocweb Posted September 21, 2007 Author Share Posted September 21, 2007 --bump Quote Link to comment Share on other sites More sharing options...
anocweb Posted September 21, 2007 Author Share Posted September 21, 2007 --bump please help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.