Jump to content

crazylegseddie

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

crazylegseddie's Achievements

Member

Member (2/5)

0

Reputation

  1. $_POST[$key] = trim(addslashes($value));
  2. My site was currently running on a PHP 4.0 but server forced me to upgrade to 5.0 suit another site. Now when I go to update my shopping cart I receive the following msg: Notice: Array to string conversion in /var/www/virtual/whitedisc.com/library/config.php on line 51 Unknown column 'A' in 'where clause' and below is the following script snippet. if (!get_magic_quotes_gpc()) { if (isset($_POST)) { foreach ($_POST as $key => $value) { $_POST[$key] = trim(addslashes($value)); } } I created this site a long time ago and havent used PHP since so am really lost with this one? Can someone help me please. Thank You
  3. When i try and upload an image on th eLIVE server i am presented by the following message: Warning: move_uploaded_file '(/var/www/virtual/whitedisc.com/images/product/431d1209ef24e28c7da9b2fd76c3d472.jpg): failed to open stream: Permission denied in /var/www/virtual/whitedisc.com/adminbackdoor/product/processProduct.php on line 82 Warning: move_uploaded_file(): Unable to move '/tmp/phpSnGidN' to '/var/www/virtual/whitedisc.com/images/product/431d1209ef24e28c7da9b2fd76c3d472.jpg' in /var/www/virtual/whitedisc.com/adminbackdoor/product/processProduct.php on line 82 Warning: Cannot modify header information - headers already sent by (output started at /var/www/virtual/whitedisc.com/adminbackdoor/product/processProduct.php:82) in /var/www/virtual/whitedisc.com/adminbackdoor/product/processProduct.php on line 149' is there any reason for these warnings? ANy info would be appreciated. thx
  4. Hi i currently created a site in php 5 and am using a php 4 server. Everything works fine except one thing. I have set a form in my script to delete an order. When i process this form I have set as action 'processOrder2.php' and the following script in this file: [code=php:0] <?php require_once '../../library/config.php';                         $orderId=$_POST['od_id'];         $sql2 = "delete from tbl_order where od_id='$orderId'";         $result = @mysql_query($sql2);         header('Location: ' . WEB_ROOT . 'adminbackdoor/order/index.php'); ?> [/code] On my server using php 5 this deletes the order and directs me back to the order page but on the server using php 4 this just opens as 'adminbackdoor/order/ProcessOrder2.php' and i receive a page cannot be found message. Is the header part not compatible with php4. Any advise on this will be cool.
  5. solved prob! it was as simple as adding [code] if (dbNumRows($result1) == 1 && dbNumRows($result2) == 1) { [/code] because previously if (dbNumRows($result1) == 2) { this means that id expect there to be 2 rows as a result of the UNION query. by separating the queries each should have at least 1 record.
  6. Hi I originally posted this is the database forum but I think its more a PHP problem now. I recently had to seperate my two queries as the server that I need to use does not support the UNION function. I have been told to combine them but not sure how to. Can anyone please assist. Thank You [code] $sql = "SELECT SUM(pd_price * od_qty)             FROM tbl_order_item oi, tbl_product p             WHERE oi.pd_id = p.pd_id and oi.od_id = $orderId";             $result1 = dbQuery($sql);                     $sql2 = "SELECT od_shipping_cost             FROM tbl_order             WHERE od_id = $orderId"; $result2 = dbQuery($sql2); if (dbNumRows($result1) == 2) { $row = dbFetchRow($result1); $totalPurchase = $row[0]; $row = dbFetchRow($result2); $shippingCost = $row[0]; $orderAmount = $totalPurchase + $shippingCost; } return $orderAmount; } [/code] Any help will be great. THX :)
  7. I tried: [code=php:0] $sql = "SELECT SUM(pd_price * od_qty)         FROM tbl_order_item oi, tbl_product p     WHERE oi.pd_id = p.pd_id and oi.od_id = $orderId"; $result = dbQuery($sql); $sql2 = "SELECT od_shipping_cost FROM tbl_order WHERE od_id = $orderId"; $result = dbQuery($sql2); [/code] but no matter what i add to my cart this gave me a total of 0 when I processed the ammount in paypal? Is this because Im not combining the two queries with PHP? If not how can I do that?  ???
  8. Hi everyone. I followed a tutorial script to complete a shopping basket site. Currently the script uses UNION to combine the queries but  I just realised the server I am using uses an older version of mySQL that does not support the UNION function, so can anyone help me out and tell me what I can use as a replacement?? Heres the script: [code=php:0] function getOrderAmount($orderId) { $orderAmount = 0; $sql = "SELECT SUM(pd_price * od_qty)         FROM tbl_order_item oi, tbl_product p     WHERE oi.pd_id = p.pd_id and oi.od_id = $orderId UNION SELECT od_shipping_cost FROM tbl_order WHERE od_id = $orderId"; $result = dbQuery($sql); if (dbNumRows($result) == 2) { $row = dbFetchRow($result); $totalPurchase = $row[0]; $row = dbFetchRow($result); $shippingCost = $row[0]; $orderAmount = $totalPurchase + $shippingCost; } return $orderAmount; } ?> [/code] any response will be greatly appreciated :)
  9. it was a bit of unused script that was causing the problem. I removed it and now everything runs fine :)
  10. I just tested my script on the real server and just realised they use a version of sql that does not support boolean mode searches  is it possible to edit the script below to not use boolean searches? If I remove the 'BOOLEAN MODE' from the script i receive the following message: 'Can't find FULLTEXT index matching the column list ' Any advise on this new problem will be great? [code] $searchwords = (isset($_GET['words']) ? htmlspecialchars(stripslashes($_REQUEST['words'])) : '');    echo '<div align="right">';    echo '<form method="get" action="'.$_SERVER['PHP_SELF'].'">';    echo '<input type="hidden" name="cmd" value="search" />';    echo '<input type="text" name="words" value="'.$searchwords.'" /> ';    echo '<input type="submit" value="Search" class="box" />';   echo '</form>';   echo '</div>'; } // Create the navigation switch $cmd = (isset($_GET['cmd']) ? $_GET['cmd'] : ''); switch($cmd) {   default:       searchForm();      break;      echo '<b>Search Results:<br><br>';           $searchstring = mysql_escape_string($_GET['words']);           $sql = "SELECT pd_id, pd_name, pd_more, pd_more2,                 MATCH(pd_name, pd_more, pd_more2)                 AGAINST ('$searchstring' IN BOOLEAN MODE) FROM tbl_product                WHERE MATCH(pd_name, pd_more, pd_more2)                 AGAINST ('$searchstring' IN BOOLEAN MODE) ORDER BY pd_name DESC";      }         $result = mysql_query($sql) or die (mysql_error()); $num_of_rows = mysql_num_rows($result); if ($num_of_rows > 0) {        while($row = mysql_fetch_assoc($result))     {       echo "<a href='categories.php?c=0&p=". $row['pd_id']. "'>".stripslashes(htmlspecialchars($row['pd_name'])).'</a><br />';       } } else { echo "<i>No results found, please try another search"; } ?> [/code]
  11. it is definately not the connection as I have the connection stored in a config file and is functional over the rest of my site. If I add 'die(mysql_error());' then I just receive 'Query was empty' and the rest of the page after the php script does not load. :(
  12. thx for reply but i inserted the following like this: [code]   $result = mysql_query($sql);  echo mysql_error(); [/code] and recieved both unwanted comments: 'Query was empty Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result'
  13. I have a search script that I have inputted at the home of my site and works correctly but with the following script: [code] $sql = "SELECT pd_id, pd_name, pd_more, pd_more2,                MATCH(pd_name, pd_more, pd_more2)                AGAINST ('$searchstring' IN BOOLEAN MODE) FROM tbl_product               WHERE MATCH(pd_name, pd_more, pd_more2)                AGAINST ('$searchstring' IN BOOLEAN MODE) ORDER BY pd_name DESC";     }        $result = mysql_query($sql) or die (mysql_error());     while($row = mysql_fetch_assoc($result))     {       echo "<a href='categories.php?c=0&p=". $row['pd_id']. "'>".stripslashes(htmlspecialchars($row['pd_name'])).'</a><br />';     } [/code] A message saying 'query is empy' is displayed and cancels the rest of my html page. But if i remove 'or die (mysql_error());' then i get the following warning. 'Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result' but the rest of the page now loads correctly. How do i overcome this problem im having? Any help will be cool.
  14. problem solved with: [code] while($row = mysql_fetch_assoc($result))     {       echo "<a href='categories.php?c=0p=". $row['pd_id']. "'>".stripslashes(htmlspecialchars($row->pd_name)).'</a><br />';       echo '<p>'.stripslashes(htmlspecialchars($row['pd_more'])).'</p>';          echo '<p>'.stripslashes(htmlspecialchars($row['pd_more2'])).'</p>'; [/code]
  15. I have also tried: [code] echo "<a href='categories.php?c=0p=". $row['pd_id']. "'>".stripslashes(htmlspecialchars($row->pd_name)).'</a><br />'; [/code] but still get the same error message?  ???
×
×
  • 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.