Jump to content

crazylegseddie

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Everything posted by crazylegseddie

  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?  ???
  16. Hi thx for reply but i tried to add that code but received this error: Fatal error: Cannot use object of type stdClass as array in C:\Documents and Settings\ben\Desktop\Bens Briefcase\www\whitedisc\searchtemp\search.php on line 64 what I needed was to turn the title row (shown below) into a link from the search results if thats possible?? [code] echo '<strong>'.stripslashes(htmlspecialchars($row->pd_name)).'</strong><br />'; [/code]
  17. I used the php freaks search full text search facility tutorial to create my search function, which i have managed to link to my table and carry out correct searches. How do I edit the script to now turn the title of my search into a link to the product? all my products are linked like this: categories.php?c=0&p=70 ie 'p=70' being the product id. for those who hasnt seen the tutorial to display the results the code looks like. [code]       while($row = mysql_fetch_object($result))     {       echo '<strong>Title: '.stripslashes(htmlspecialchars($row->pd_name)).'</strong><br />';       echo '<p>'.stripslashes(htmlspecialchars($row->pd_more)).'</p>';        echo '<p>'.stripslashes(htmlspecialchars($row->pd_more2)).'</p>';       echo '<hr size="1" />';     } ?> [/code] I need the title ie. $row->pd_name to be the link. Any info regarding my query will be cool. THX
  18. Hi i have created a simple contact form thats works fine using my smtp set up in my php.ini file. I now need to put my work on a live server and have downloaded and setup phpmailer. My form currently works using the following code: [code] <?php //create short variable names $firstname=$_POST['firstname']; $lastname=$_POST['lastname']; $email=$_POST['email']; $feedback=$_POST['feedback']; $toaddress = 'hipbobbiter@hotmail.com'; $subject = 'Contact'; $mailcontent = 'Customer First Name: '.$firstname. "\n"   .'Customer Last Name: '.$lastname. "\n"   .'Customer Email: '.$email. "\n"   ."Customer Comments: \n".$feedback. "\n"; $fromaddress = 'From: admin@whitedisc.com'; mail($toaddress, $subject, $mailcontent, $fromaddress); ?> [/code] How can i integrate this into phpmailer? Ive looked at the tutorial using the site but still having problems. Any help will be cool :) THX
  19. The way my MySQL database is set up is that each product has 'pd_id' 'pd_name' 'pd_price' 'pd_quantity' 'pd_description' 'pd_more' 'pd_more2' The tracklist users both pd_more & pd_more2. So i would need the search to look at both these fields then display the results and show the user the 'pd_name' of all the products that meet the search criteria and display a link to the main product. the products link like categories.php?c=0&p=4 with 'p' being the pd_id. Hope that helps clarify my description thx
  20. Hi anyone, just a quick comment to see if anyone can advise me or give me a url to an appropriate search tutorial/script available on the web to suit the following: I need to perform a search of album tracklistings, which when a user types in an artist, title or label name within a search then it will display results of all the albums that have the appropriate search, which will link to the main product. If anyone knows of a type of appropriate search I can use it will be greatly appreciated. Thx :)
  21. Can anyone help me and tell me how to turn this $row into a url. [code] <?php   $result = mysql_query('SELECT top_disc FROM tbl_top20 WHERE top_id=1') or exit(mysql_error()); $row = mysql_fetch_assoc($result); echo $row['top_disc']; ?> [/code] I need the $row['top_disc]' to link to 'discs.php'. Any help will be cool thx
  22. Hi I have created a select box using the following script: [code] <form name="form1" method="post" action="">           <?php $query  = 'select pd_id, pd_name FROM tbl_product group by pd_name desc'; $result = @mysql_query($query) or die('<p>Sorry, no data to edit...</p>');           ?> <select name="pd_id" id="select4">             <?php while($row=mysql_fetch_assoc($result)) { echo "\t<option value=\"" . $row['pd_id'] . '">' . $row['pd_name'] . ' </option>'; } ?> [/code] what this script does is call the products name from the database and put it in the select box. What I need it to do now is when the user clicks on the select product it will automatically link to the product information. the url of the products are arranged like the following: product 1: categories.php?c=0&p=1 & product 2: categories.php?c=0&p=2 Any help will be really good as im really stuck on this one. thx
×
×
  • 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.