Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. $result = mysql_query("Select COUNT(gang_id) FROM `players` WHERE gang_id='" . $gang['id'] . "'"); $row = mysql_fetch_assoc($result); echo $row['COUNT(gang_id)'];
  2. And there's also a missing ' $sql = mysql_query("SELECT * FROM Bands WHERE bandname LIKE '{$search}%'");
  3. There isn't an error on that line: $msg .= (empty($other)) ? "" : 'ISSUE, COMMENT OR CONCERN: $other \n \n'; Besides the fact that if you use single quotes your variable $other won't be parsed:
  4. Probably because of the white space. Try this: preg_match_all("/<div class=\"vlc east coast\">((.|\s)*)<\/div>/i", $Page, $Content) This works: $str = '<div class="vlc east coast"> Visit Us:<br><img src=\'visit.jpg\' width=\'250\' height=\'250\' alt=\'Visit Us\' /> </div>'; $pattern = "/<div class=\"vlc east coast\">((.|\s)*)<\/div>/i"; if(preg_match_all($pattern, $str, $matches)) echo $matches[1][0];
  5. I think he meant merging an off-white image instead of a completely white one. Either way it's impossible for it to detect that it was transparent previously. It must be something else.
  6. What I gave you should work. Here's some examples: $str = 'test)'; $pattern = "/^[a-zA-Z0-9_'-]*$/"; if(preg_match($pattern, $str, $matches)) echo 'Validates'; else echo 'Does not validate'; Output: Does not validate $str = 'all_acceptable_characters'; $pattern = "/^[a-zA-Z0-9_'-]*$/"; if(preg_match($pattern, $str, $matches)) echo 'Validates'; else echo 'Does not validate'; Output: Validates Try it yourself.
  7. I'm not really sure what you need this for. So many explaining what it needs to do would be better. Aren't you trying to validate a whole string? Or what.
  8. Do you mean something like this?: if(preg_match("/^[a-zA-Z0-9_'-]*$/",$_POST['branch'] )) { //No unwanted characters. }
  9. Something like this?: $sep = explode('||', $str); echo 'Current Song:' . $sep[0] . '<br />'; echo 'Previous Song:' . $sep[1] . '<br />'; echo 'Last 20 Songs:<br />'; for($i = 2;$i < 20;$i++) { echo $sep[$i] . '<br />'; }
  10. Getting the values specifically would depend on the way the site is setup. Show the source from the area around where the values you wish to get out are, if you want help with that part. For the running it once daily you'll probably want to look into CRON jobs.
  11. Or try: while (($entry = $dir->read()) !== false)
  12. There's no need for all that. If you've confirmed that it's already a valid value (in array), there's no need to strip anything from it. $pages = array('home','scripts','media','archives','contact','about'); $page = (in_array($_GET['page'],$pages) ? $_GET['page'] : false; if($page) { require('./pagecontent/'.$page.'.php'); }
  13. Yea, my example was just a quick fix. I might edit it with a better example later. But the reason why it's like that is because on the first website as long as it's within the area of either image it flows down. On my example only if it's on the MySQL image does it move, so even if you place it on the Php image once it has moved, it will go down. The solution and reason behind this is simple. You must just apply this to a <div> that contains the images, instead of applying it to images.
  14. Oh, just FYI you can make it work with my idea. function postFix($number) { $number = ($number > 31) ? (substr($number, -1, 1)) : $number; if($number == 0) $number = 4; $faketime = ($number * 86400) + 1230768000; return date("S", $faketime); } for($num = 1;$num < 100;$num++) { echo $num . postFix($num) . '<br />'; } Accurate, as far as I know.
  15. Well, you could just hijack the date function function postFix($number) { $faketime = ($number * 86400) + 1230768000; return date("S", $faketime); } $num = 5; echo $num . postFix($num); Output: 5th Edit: Nevermind, this is stupid since it will only work for 1-31.
  16. I made a quick example for you. One method is having 2 images and making them overlap by giving one a negative margin. Then manipulating this margin using JavaScript. Here's my JavaScript: function moveImage(id, millisec) { var speed = Math.round(millisec / 100); var timer = 0; if(parseInt(document.getElementById(id).style.marginTop.substr(0, document.getElementById(id).style.marginTop.length-2)) < -58) { for(var i = 0;i <= 100;i++) { setTimeout("setMargin('" + id + "', 'dec')",(timer * speed)); timer++; } } } function restorePlacement(id, millisec) { var speed = Math.round(millisec / 100); var timer = 0; if(parseInt(document.getElementById(id).style.marginTop.substr(0, document.getElementById(id).style.marginTop.length-2)) < 0) { for(var i = 0;i <= 100;i++) { setTimeout("setMargin('" + id + "', 'inc')",(timer * speed)); timer++; } } } function setMargin(id, movement) { if(movement == 'dec') { document.getElementById(id).style.marginTop = parseInt(document.getElementById(id).style.marginTop.substr(0, document.getElementById(id).style.marginTop.length-2)) + 1 + 'px'; } else if(movement == 'inc') { document.getElementById(id).style.marginTop = parseInt(document.getElementById(id).style.marginTop.substr(0, document.getElementById(id).style.marginTop.length-2)) - 1 + 'px'; } } And here's the html: <img id="php" src="http://farm4.static.flickr.com/3195/3131799428_962aba66f1.jpg?v=0" alt="Php" /><br /> <img id="mysql" style="margin-top: -158;" src="http://www.adwh.com/images/logo-mysql.jpg" alt="MySQL" onmouseover="moveImage('mysql', 300)" onmouseout="restorePlacement('mysql', 300);" /> Here's the result: http://alexwd.us.to:1337/test/rollover.php
  17. However, like that the \n won't parse. The \n must be wrapped in double quotes to parse. Also, urlEncode is just going to change your space to +, which I don't think you want. That's used more for variables and such. So try this: $name = 'pfd/Order Number.pdf'; echo '<a href="admin/' . $name . '">' . $row['wantedname'] . '</a><br >' . "\n"; Output: <a href="admin/pfd/Order Number.pdf"></a><br >
  18. You can use what you were using by have to add an offset of -1. $slogans[(rand(0,count($slogans)-1)]; This is because arrays start at [0], and count returns the number of elements in the array. In your case 3. Sometimes it could come out with $slogans[3], when your array only includes $slogans[0]-[2]
  19. Show us your code. It sounds like a scope problem.
  20. I made an image reader, but as always it's extremely specific. The way that I did it is I found out that the numbers (in my case) were 4X8 pixels and were separated by 1 pixel. (And started at some x and y). So what I did is I created a loop that would loop through the pixels of each character and generate a string. The string consisted of 1's and 0's. 1 = text color (part of the character) = 0 not part of it, just the background. Then I created another function that would compare the string against an array of strings that had the actual maps (in 0's and 1's) of numbers/letters. Then if it matched you know it is that letter. In my case it was only necessary to loop through the first column of pixels in the image because the strings would've been unique at that point. Here's mine just in case it helps you figure out how to create yours: function check_number($number, $img) { $x_loc = (5 * ($number-1)) + (1 * ($number-1)); for($j = 0;$j < 8;$j++) { $color_index = imagecolorat($img, $x_loc + 90, $j + 48); $spec = imagecolorsforindex($img, $color_index); $colorMap .= ($spec['red'] == 220 && $spec['green'] == 220 && $spec['blue'] == 220) ? 1 : 0; } return find_number($colorMap); } function find_number($numberArr) { global $check; $numberMaps = array( '00111100', '00100001', '01000011', '01000010', '00011100', '11110010', '00111110', '10000000', '01101110', '01110001' ); for($i = 0;$i < count($numberMaps);$i++) { if($numberArr == $numberMaps[$i]) { return $i; } } $check = false; return false; } As I said it only loops through the first column. The first function takes the character you want to get (its position, eg, first(1), second(2), etc..) and the image. But mine is specific, as I said before. Just hope it helps.
  21. If I understand what you're doing correctly.. Put this inside the while loop you have: if(substr($values[$x], 0, 4) == 'Noob'){ ... }
  22. You should be setting the str_replace() equal to the variable that you're going to be using later on. So not 3 different variables. In your case you could just use an array. $findArr = array('_', '(', ')'); $fileName = str_replace($findArr, '', $upload['name']); You'd then continue to use $fileName (not $upload['name']) to do whatever you want to do with it.
  23. An array of arrays. eg: $myArray = array(array('John', 'Doe', '1960'), array('Jane', 'Doe', '1970')); echo $myArray[0][0]; // John If you're specifically using only 3 you could do a for() like.. for($i = 0;$i < count($array);$i+=3) { $firstName = $i; $lastName = ++$i; $year = $i+2; } Where the array would look something like yours..
  24. The query looks fine to me. Try this to debug it: mysql_query('update mastodon set name="' . $name . '", email="' . $email . '", bday_month="' . $bday_month . '", bday_day="' . $bday_day . '", ann_month="' . $ann_month . '", ann_day="' . $ann_day . '", address="' . $address . '", city="' . $city . '", state="' . $state . '", zip="' . $zip . '", favorite="' . $favorite . '", lunch="' . $lunch . '", reservations="' . $reservations . '", parties="' . $parties . '", new_menu="' . $new_menu .'", chef_specials="' . $chef_specials . '" where id="' . $id . '"') or die(mysql_error());
  25. There was a problem with my query. I forgot a '.' try it now.
×
×
  • 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.