116 Posted Topics
Re: Hi there, I've got this code for creating thumbnails, i'm not sure if it's what you're looking for but here it is: [code=php] function createThumb($imageDirectory, $imageName, $thumbDirectory) { $ext = strtolower(substr($imageName, strrpos($imageName, '.'))); if (($ext == "jpg") || ($ext == "jpeg")) { if(function_exists('imagecreatefromjpeg')) { $srcImg = imagecreatefromjpeg("$imageDirectory/$imageName"); $originalWidth = imagesx($srcImg); … | |
Re: Hi there, I think that the problem may lie in your javascript, try changing the parameter of the eval() function to: [code] targ+".location='"+selObj.options[selObj.[B]options[/B].selectedIndex].value+"'" [/code] | |
Re: Hi there, Have you tried running your sql statement straight through your SQL command interface (like phpMyAdmin). If that returns no errors, try adding some error catching as follows and check the results: [code=php] $query = 'SELECT * FROM `security` LIMIT 0 , 30'; $result = mysql_query($query, $conn); if (mysql_numrows($result) … | |
Re: Hi there, If efficiency is what you are after, I don't think your above code is your best bet. I personally prefer to write the SQL statements myself, and execute them with a simple "query()" function on my Data Access Object (which figures out what type of db I'm working … | |
Re: Hi there, It depends what you want to do with the e-mail address, but your best (and easiest) option would just be to use strtr. for a full breakdown of the function go to [URL="http://us2.php.net/manual/en/function.strtr.php"]http://us2.php.net/manual/en/function.strtr.php[/URL]. But a basic algorithm would be: [code=php] $maskedAddress = strtr($originalAddress,"AEIOUSTVRP","##########"); [/code] | |
Re: Hi there, Nothing leaps out at me as being wrong with your code, except it being a little incomplete. Eg your php side AJAX file doesn't echo the output or give any of the option elements any values. You could try this: Instead of replacing the entire select element with … | |
Re: As far as I know its impossible, a query will always return a result set according to certain parameters passed. So all of your results must have something in common (or something they are commonly lacking). If you really had to do it in one statement i would recommend using … | |
Re: Hi there, I'm not quite sure what you're up to. Are you coding your own front-end for a database or are you using a proprietary tool like phpMyAdmin? If the latter then you are pretty much stuck with what they give you unless you actually want to dig through hundreds … | |
Re: Hi there, give this a go: [code=php] echo "<h2>Current Items and Quantities:</h2>\n"; echo "<table width=\"100%\" cellpadding=\"1\" border=\"1\">\n"; $query = "SELECT description, quantity from products"; $result = mysql_query($query); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $description = $row['description']; $quantity = $row['quantity']; echo "<tr><td>$description</td><td>$quantity</td></tr>\n"; } echo "</table>\n";[/code] This construct will loop through all … | |
Re: Write an algorithm in Javascript that can solve an np-complete problem in quadratic time. Thats always a good one, plus if you actually crack it you'll probably win a nobel prize. | |
Re: I'll just say exactly what one of my 2nd year lecturers said to me: "There is no ultimate language or method, each one is better for something and terrible at something else, and because of this, sticking to one language will be your biggest downfall." What I'm saying is that … ![]() | |
Re: I you are looking for a mail handling solution written in php then the guys at squirrelmail have already beaten you to it with their excellent solution. I you wanted to start your own online mail servise (like gmail, or webmail) then their solution will also scale to your needs, … | |
Re: [icode] $value = intval(rand(1, 100)); if ($value < 80) { $sales_code = 'VW'; } else if (($value > 79) && ($value <= 86)) { $sales_code = 'DF'; } else if (($value > 86) && ($value <= 93)) { $sales_code = 'RK'; } else if (($value > 93) && ($value <= … | |
Re: Hi there, Just to clarify, when you pull a date from the database and echo it, it appears in the format DD-MM-YYYY hh-mm-ss. If thats the case and you just want the date part of the string, you can simply use substr() to get the part you want eg: [icode] … ![]() | |
Re: Hi there, PHP's mail() function should work just fine for what you're doing as I've used it many times for the exact same thing with no problems. For alternatives, the only 2 I know of are PEAR's mail function which (obviously) requires the PEAR libraries on your web server. For … | |
Re: Hi there, Try instead of the check [icode]$phone == ''[/icode], use [icode]if (empty($phone) || !isset($phone))[/icode] |
The End.