SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2008
    0 Post(s)
    0 Thread(s)

    SQL Quick Fix again. Please!

    I got a admin section where I can add categories. And it allows you to browse the pc and pick the image and it is supposed to store it. And when you edit the category it is supposed to push the image to /misc/ and then it should display anytime you are editing and on the main category page on my site. And when you check what is happening. Nothing at all changes in the SQL database. And it adds a really small binary file with no .ext , And then the default image on my categories disapears and no image gets displayed. If I name an image for example cat3.jpg and upload it to the /misc/ folder it then becomes visible on the main category page but not on the edit category page.

    Here is the edit category.php clipping.
    <? if($_POST) {
    $_POST = mysql_real_escape_array($_POST);
    mysql_query("UPDATE niches SET name = '$_POST[name]', ad0 = '$_POST[ad0]', ad1 = '$_POST[ad1]', ad2 = '$_POST[ad2]', ad3 = '$_POST[ad3]', ad4 = '$_POST[ad4]', ad5 = '$_POST[ad5]', ad6 = '$_POST[ad6]', ad7 = '$_POST[ad7]', ad8 = '$_POST[ad8]', ad9 = '$_POST[ad9]', enabled = '$_POST[enabled]' WHERE record_num = '$_POST[id]'");
    $insertid = $_POST[id];
    if($_FILES[postroll][tmp_name]) {
    $name = 'cat'.$insertid;
    move_uploaded_file($_FILES[postroll][tmp_name], $misc_path.'/'.$name);
    } $success = true;
    $result = mysql_query("SELECT * FROM niches WHERE record_num = '$_GET[id]'");
    $row = mysql_fetch_array($result);
    td height="25" class="style4">Postroll JPEG</td>
    <td height="25" align="left" class="style4"><input type="file" name="postroll" id="postroll" /></td>
    <td height="25" class="style4">Enabled?</td>
    <td height="25" align="left" class="style4">
    <select name='enabled' id='enabled'>
    <option value='1' <? if($row[enabled] == 1) { echo 'selected'; } ?>>Yes</option>
    <option value='0' <? if($row[enabled] == 0) { echo 'selected'; } ?>>No</option>

    <td height="25" colspan="2" align="center" class="style4"><input type="submit" name="Submit2" value="Save" /></td>
    <p align='center'>
    <img src='<? echo $ad_url; ?>/<? echo $row[postroll]; ?>' />

    Here is the clipping from my category . php file -----------------

    $bad = array('?','!',' ','&','*','$','#','@');
    $good = array('','','-','','','','','');
    $link = "/channels/".$row[record_num]."/".strtolower(str_replace($bad,$good,$row[name]))."/page1.html";
    <div id="miniatura" style="height:150px;">
    <div id="img">
    <a href="<? echo $link; ?>" target="_self">
    <? if(file_exists($misc_path.'/cat'.$row[record_num])) { ?>
    <img src="<? echo $misc_url; ?>/cat<? echo $row[record_num]; ?>.jpg" alt="<? echo $row[name]; ?>" height="<? echo $thumbheight; ?>" width="<? echo $thumbwidth; ?>" border="0" /> <? } else { ?>
    <img src="<? echo $misc_url; ?>/catdefault.jpg" alt="<? echo $row[name]; ?>" height="<? echo $thumbheight; ?>" width="<? echo $thumbwidth; ?>" border="0" />
    <? } ?>

    <div id="tekst" style="margin-top:3px; margin-left:7px;">
    <a href='<? echo $link; ?>'><? echo $row[name]; ?></a>

    Any help will be greatly appreciated
    Last edited by r937; Mar 7, 2009 at 21:01.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts