Jump to content

TexasMd91

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

TexasMd91's Achievements

Member

Member (2/5)

0

Reputation

  1. Figured out what was doing, the spaces were not true spaces, if you entered them into php, it would output a true space in the browser, which is why when i printed the query and typed the query into PHPMyAdmin it would work. to solve I used preg_replace to remove all characters that weren't [a-zA-Z0-9 ] and replace with a space. $username = preg_replace("[\W]"," ",$username Thanks all those who helped
  2. Can't seem to find an edit button, guess its removed when the post is a certain amount of time old? I have reorganized how the array is to so that I tested the var_dump() and its 11 characters, which "Delia Smith" is.
  3. Thanks but I don't think that would work with the rest of my script. I need to associate user_id's with the usernames and activities within an array and insert those three things, and a timestamp into another table. Is there still a way to pair up these results with their respected array(username, activity)? and also, not sure if that was supposed to fix the problem i was having, but still having the issues. I am pretty much certain it has to do with spaces, what does phpmyadmin do to spaces that any query in php wouldn't do? Ive done a few google searches and still can't get a good query on google to get results. and to answer PFMaBiSmAd's question, here is the result of doing the var dump on the array array(5) { ["Delia Smith"]=> string(12) "A string" ["espinozagabe"]=> string(13) "A string" ["Jaunty1"]=> string(12) "A string" ["Xtr3m3Legend"]=> string(13) "A string" ["xxx jester x"]=> string(12) "A string" } (different names because different people are online now, but its definitely dealing with the space because "xxx jester x"'s query doesn't work either.) EDIT: I also edited the actual value of the array, can't show em here. I am getting these values from a XML file.
  4. Server version: 5.1.53-log I have the following queries SELECT user_id FROM phpbb_profile_fields_data WHERE pf_rsname = "Atroxide" LIMIT 1 SELECT user_id FROM phpbb_profile_fields_data WHERE pf_rsname = "Delia Smith" LIMIT 1 SELECT user_id FROM phpbb_profile_fields_data WHERE pf_rsname = "espinozagabe" LIMIT 1 SELECT user_id FROM phpbb_profile_fields_data WHERE pf_rsname = "Jaunty1" LIMIT 1 SELECT user_id FROM phpbb_profile_fields_data WHERE pf_rsname = "lvoos" LIMIT 1 All 5 of these queries are executed at a different time (in a foreach loop). All 5 except for the one below returned a result. SELECT user_id FROM phpbb_profile_fields_data WHERE pf_rsname = "Delia Smith" LIMIT 1 I couldn't figure out why it wasn't working so I copy pasted it into PHPMyAdmin and it returned the result I was looking for. What could cause for PHPMyAdmin to work but not the exact same query in a php script to not? It didn't return an error using mysql_error() either. Pretty sure its irreverent but here is the php script. foreach ($online as $username => $activity) { $query = " SELECT user_id FROM phpbb_profile_fields_data WHERE pf_rsname = \"" . $username . "\" LIMIT 1 "; $result = $db->query($query); } The table is user_id mediumint( UNSIGNED No 0 pf_rsname varchar(255) utf8_bin Yes NULL
  5. I realized it right before you posted lol I appreciate the help though and I figured out the multidimensional array part already. In Help forums, they should give users the permission to close one's topics.
  6. alright thanks I guess, once I figure it out I will post both functions here.
  7. The only way I can think of doing it (and I usually do it the worst way possible, so maybe some one else's reply will be better) is to have a buffer-string and when you want to switch N with A and A with N, you can get the location (the index) of where the A's used to be from the buffer.
  8. I am trying to make an image that shows a random quote from my database. However I want the quote to do 2 things. 1. It needs to word wrap so that it stays on the image 2. It needs to be the biggest font which still makes it fit vertically. So I need to know how to word-wrap in GD and how to vertically check the size of that word-wrapped text. Everything else I can figure out but I can't seem to find the right functions to achieve those
  9. wait nvm, close this... Figured it out. http://www.phpfreaks.com/forums/index.php/topic,262402.0.html
  10. I am making a way for users to post news, however I am associating news articles with the user's id instead of their user name so people can change their user name easily. My tables are set up as news --id --user_id --rest of columns users --id --group_id --username groups --id --name What query would I send to get back rows like this news.id, users.username(where user.id = news.user_id), and groups.name (where group.id = user.group_id) I googled for awhile but didn't really understand their examples too well.
  11. I figured out how to do it. <?php function sanitizeInput($string) { return ereg_replace("[^0-9]", "", $string); } $x0 = sanitizeInput($_GET['x0']); $y0 = sanitizeInput($_GET['y0']); $x1 = sanitizeInput($_GET['x1']); $y1 = sanitizeInput($_GET['y1']); $extList = array();$extList['gif'] = 'image/gif';$extList['jpg'] = 'image/jpeg'; $extList['png'] = 'image/png'; $img = null; $fileList = array(); $handle = opendir('./'); while ( false !== ( $file = readdir($handle) ) ) { $file_info = pathinfo($file); if (isset($extList[strtolower($file_info['extension'])])) { $imgSize = getimagesize($file); if ((($x0 <= $imgSize[0]) || ($x0 == 0)) && (($y0 <= $imgSize[1]) || ($xy == 0)) && (($x1 >= $imgSize[0]) || ($x1 == 0)) && (($y1 >= $imgSize[1]) || ($y1 == 0))) { $fileList[] = $file; } } } closedir($handle); $imageNumber = time() % count($fileList); $img = './' . $fileList[$imageNumber]; if ($img!=null) { $imageInfo = pathinfo($img); $contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ]; header ($contentType); readfile($img); } ?> I actually knew about the function getimagesize, I just didn't know how to efficiently apply it to the code. The first time I did it I actually had it check the size of the image after it randomly selected it; if it wasn't correct it would just select a random one again. Problem is then some 1 could specify $_GETs that would make it false and there wasn't a way to stop the script until it reached the mass exe time. But then I figured out that I need to trim out the wrong sized ones when ever I make the array of images, that way there is no reason to randomize it a second time. Now I can provide error messages when necessary And for the people that want to see it working. http://dvclan.org/signature/0/0/0/0.png first two 0s are minimum, last 2 are maximum.
  12. I am using a script my friend made to randomly select an image from the directory and output it, I want to change it so that I can specify the minimum and maximum size (in pixel) that the image can be, so if a forum has rules on size I can still use the dynamic sig. I have changed the code a bit to bring in the size variable, but I am stumped on where to go from there ???. x0 = x min x1 = x max y0 = y min y1 = y max I need to have it so that if the value is set to 0, then it will disable. so if I have x0=0 and x1=250 it would be any graphic less then 250px wide. Or if I have x0=250 and x1=0 then it would be any graphic bigger then 250. <?php function sanitizeInput($string) { return ereg_replace("[^0-9]", "", $string); } $x0 = sanitizeInput($_GET['x0']); $y0 = sanitizeInput($_GET['y0']); $x1 = sanitizeInput($_GET['x1']); $y1 = sanitizeInput($_GET['y1']); $extList = array(); $extList['gif'] = 'image/gif'; $extList['jpg'] = 'image/jpeg'; $extList['png'] = 'image/png'; $img = null; $fileList = array(); $handle = opendir('./'); while ( false !== ( $file = readdir($handle) ) ) { $file_info = pathinfo($file); if (isset($extList[strtolower($file_info['extension'])])) { $fileList[] = $file; } } closedir($handle); $imageNumber = time() % count($fileList); $img = './' . $fileList[$imageNumber]; if ($img!=null) { $imageInfo = pathinfo($img); $contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ]; header ($contentType); readfile($img); } ?>
  13. The problem is, its not my HTML. I am using file_get_contents on a website to retrieve stats. Thanks neil.johnson, that worked
  14. I currently have a string like this. <p><span style="font-size:0.8em;">songs played:</span> 152</p> <p><span style="font-size:0.8em;">radio count:</span> 1</p> Now, I need to parse it and find out what is between radio count:</span> and </p> I thought about using the strpos to find where exactly the string is, and then using that to grab the data inbetween. However, it would find the </p> after the 152 instead of the </p> after the 1. Any suggestions on how to achieve this?
×
×
  • 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.