Jump to content

HuggieBear

Members
  • Posts

    1,899
  • Joined

  • Last visited

Everything posted by HuggieBear

  1. Did you copy this code from somewhere?  The comments are telling you exactly what to do... [quote author=xux link=topic=109406.msg440873#msg440873 date=1159191071]   //error suppressed,remove it to see what happens   @$success=mail($toAddress,$subject,$message); [/quote] Remove the @ from the front of the line and see if it helps. Regards Huggie
  2. Try removing the [b]To[/b] field from the headers... Hotmail doesn't like that. Regards Huggie
  3. I'm assuming that the current code you have is taking care of the pagination and cells ok, it's just the additonal cells you want filling? Regards Huggie
  4. Why not have a counter running, and just use a conditional statement to tell if the mp3's should be displayed or not. [code=php:0] $sql = "SELECT max, count FROM downloads"; $query = mysql_query($sql); $result = mysql_fetch_row($query); if ($result['count'] >= $result['max']){   echo "Sorry, reached maximum number of downloads this month\n"; } else {   //echo your page contents here } [/code] This is just thrown together, but should gie you an idea. Regards Huggie
  5. Doesn't % have special meaning in sprintf(). [size=8pt][b]Try this:[/b][/size] [code=php:0] $query_directory = sprintf("SELECT * FROM directory WHERE Name LIKE '\%".$_POST['name']."\%' ORDER BY id DESC", $colname_directory); [/code] Regards Huggie
  6. I've amended my previous post. Regards Huggie
  7. That's because you're not calling the array, you're calling the original values, they're unchanged. If you wanted to echo the banlive value, you'd need to do echo "$testArray[0]"; Now we know this isn't ideal, as you don't necessarily know what the numeric key is, this is why you should assign easy keys to the array. Try this: [code] <?php $testArray = array (   'banLive' =>  $banLive,   'banCapp' => $banCapp,   'banCat' => $banCat,   'postIntranet' => $postIntranet,   'eSent' => $eSent,   'archFiles' => $archFiles,   'progStatus' => $progStatus);       foreach( $testArray as $key => $temp )     {         if ( $temp == "" )         {           $testArray[$key] = "TEMP";         }         else         {             echo $testArray[$key] = "THIS";         }     } ?> [/code] Then when you want to echo the values, use this code: echo $testArray['banLive']; Regards Huggie
  8. Do you want to display the engine results on your page, or redirect them to the results page on either google or wikipedia? Regards Huggie
  9. You're almost there, I'd do it like this... [code] <?php $array = array ( $StringA, $StringB, $StringC ); foreach($array as $key => $temp) {     if ( $temp == "Joe" )     {           $array[$key] = "NEW NAME";     } } ?> [/code] Like I say, you were almost there.  All I've done differently is use both the key and value in the foreach, as opposed to just the value, as you need the key to assign the new name to. Regards Huggie
  10. I wouldn't be surprised if that was because your host was having issues. Regards Huggie
  11. I know Hotmail has an issue if you put the [b]To:[/b] field in the headers.  It moves it to the junk folder. By just having the [b]to:[/b] field as the first argument in the call to mail() and removing it from the 'headers' parameter, it went from putting them in the junk folder to putting them in the inbox. Regards Huggie
  12. I'd say on your page that displays the event, add two buttons to the right of it, one to update the data and one to delete it, these call editevent.php with the id field. Then you have your editevent.php check which button was pressed, if it's delete then it it sends DELETE sql to the database and deletes the record based on id, if it's edit then it sends SELECT sql to the database based on id and selects the information from that record into a form.  Once submitted, the form uses the UPDATE sql to change the record. As for the displaying your records by date, it's as simple as including ORDER BY date DESC in your display code. Regards Huggie
  13. HuggieBear

    Inbox %

    How are you storing the information in the database?  Are you storing each of the users messages in a row and then doing a count() or do you have a column in the user table that says how many messages they've sent? We're going to get MySQL to do the work for you before passing the data to the php. Regards Huggie
  14. Please accept my apologies, it was well past my bedtime when I posted that  :-[ Regards Huggie
  15. Do you know what the @ in front of the function calls is doing? @ supresses the error messages.  So if you're having issues with nothing getting into your database then I suggest you remove the @ and try again. Regards Huggie
  16. [quote author=stualk] I need to use the 'ordervalue' from 'product_types' for each product displayed when called in from 'products_table' where 'product_type_name' is equal to 'product_type'. [/quote] I'm assuming from this that the data in product_type column in the products_table is the same as the product_type_name in the product_types table? If it is then the above code should have worked, assuming you have the column names correct. Can you confirm that the above statement is correct and also, do you have phpMyAdmin installed? Regards Huggie
  17. Try changing the [color=red][b]£[/b][/color] at the beginning of the line for a [color=green][b]$[/b][/color] ;) Regards Huggie
  18. When using mysql_result(), don't use inline code, assign the result to a variable first... change this: [code=php:0]$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM links WHERE ((keywords LIKE '%".$sword."%') OR (url LIKE '%".$sword."%') OR (aciklama LIKE '%".$sword."%') OR (baslik LIKE '%".$sword."%')) AND (status ='1')"),0);[/code] to this: [code=php:0]$totalsql = "SELECT COUNT(*) as Num FROM links WHERE ((keywords LIKE '%".$sword."%') OR (url LIKE '%".$sword."%') OR (aciklama LIKE '%".$sword."%') OR (baslik LIKE '%".$sword."%')) AND (status ='1')"; $sqlresult = mysql_query($totalsql); $total_results = mysql_result($sqlresult, 0); [/code] Regards Huggie
  19. Give this code a try in place of what you've got. [code] <?php $Result = mysql_query("SELECT p.* t.ordervalue                       FROM products_table p, product_types t                       WHERE p.product_type = t.product_type_name                       AND p.brand_name = '$brand_name'                       AND p.visible = 'Yes'                       ORDER BY t.ordervalue, p.brand_name"); ?> [/code] Regards Huggie
  20. I tend to put that sort of information at the top of my page after the headers. Defines the variables for the rest of the page that way. So you'd have it look like this: [code] <?php // get parameters from the URL into the page and sanitise if (!empty($_GET['industry'])){   $ind_id = strip_tags(add_slashes($_GET['industry'])); } // call the file that has my DB connect code in it include('connect.php'); // setup the SQL statement with the variable from the url $sql = "SELECT * FROM tablename WHERE industry = $ind_id"; // execute the statement $result = mysql_query($sql); // Check it executed ok if (!$result){   die ('There was an error executing the SQL: ' . mysql_error()); } // Do something with the results while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){   echo "$row['columnname']<br>\n"; } ?> [/code] Regards Huggie
  21. OK, I'll give you a few pointers... 1. You need to add a cookie using [url=http://uk.php.net/manual/en/function.setcookie.php]setcookie()[/url] 2. You read it by just using it's name in the [url=http://uk.php.net/manual/en/language.variables.predefined.php]predefined variable[/url] $_COOKIE e.g. if ($_COOKIE['zipcode']){... Give it a go with this info then let us know how you get on. Regards Huggie
  22. It looks good to me Bob  ;D Regards Huggie
  23. Yeah, you provide LIMIT with two arguments [color=green][b]LIMIT 4, 20[/b][/color] The first is the offset you want and the second is the amount of rows to return. It returns rows based on the offset of your dataset, not the entire table.  So if you had the following data: ID, Name 1    Rich 2    Paul 3    Sam 4    Ryan 5    Dave [color=maroon]SELECT name FROM table ORDER BY id LIMIT 1, 1[/color] you'd get Paul, but if you had SELECT name FROM table WHERE name LIKE 'R%' ORDER BY name LIMIT 1, 1 then you'd get Ryan. I hope that makes sense Regards Huggie
  24. You should be able to request some proof/advice from them about the usage, maybe they'll tell you about the calculations they use. In the mean time, why not post your code with a title of 'suggestions for optimisation'. Regards Huggie
  25. [code=php:0]$limit = 50; $limit = mysql_real_escape_string($limit);[/code] There's no need to escape a hardcoded value like $limit if you know it contains no special characters. Regards Huggie
×
×
  • 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.