Jump to content

newb

Members
  • Posts

    454
  • Joined

  • Last visited

Everything posted by newb

  1. How can I make this output in descending order from greatest to least? Right now, it appears like: 1940 1941 1942 1943 1944 etc... i'd like it to be like 2012 2011 2010 2009 etc.. until it gets to 1940 any ideas? here is my code: <? $i = 1939; while ($i < 2012) { $i++; echo '<option value="'.$i.'">'.$i.'</option>'; } ?>
  2. afaik, image caching is done by most browsers automatically anyway so u dont have to worry about that. if ur talking about image preloading (for rollover effects or something), check out javascript/jquery
  3. How can i use return to output more than one row of information? i would like to merge the results from multiple SQL rows into one string somehow so that I can return them through a function. Any ideas how i can do this? here is my current code: $query = exec_mysql_query("SELECT * FROM av_genres WHERE id = $cid ORDER BY name DESC"); while ($row = mysql_fetch_assoc($query)) { return $row['name']; } if i use 'echo' it displays all results as i want it to but it doesnt output in the correct place for some reason. any ideas?
  4. i have a problem..my posts are showing up like this: July 6: post message July 6: post message July 6: post message im trying to get it like this: July 6: post message post message post message how do i group them like this in all in one post?
  5. this worked better: foreach ($maintypes as $type) { $wheretype .= "'$type'"; } $wheretype = str_replace("''", "', '", $wheretype); $typesetting = @mysql_query("SELECT batch, quantity FROM batches WHERE type NOT IN ($wheretype) ORDER BY batch");
  6. if you could post the snippets of code that you think are causing the problem then that would be nice. it would be much easier for me to view the code on a post than to download the file and open it in a program.
  7. How can i convert an array of results to a single comma separated string so that I can run it through an SQL query?
  8. How can i check if a string is URL encoded or not using PHP
  9. why doesnt this work? $query = exec_mysql_query("SELECT *,substring(en,1,1) as term FROM translations WHERE substring(en,1,1) RLIKE '[$letter]' ORDER by en asc"); $enterm = array(); $esterm = array(); $alt = array(); while ($row = mysql_fetch_assoc($query)) { $term = $row['term']; $enterm[] = trim($row['en']); $esterm[] = trim($row['es']); $altterm[] = trim($row['alt']); $first = ''; } foreach( $enterm as $en && $esterm as $es && $altterm as $alt) { if(strtoupper($en[0]) !== $first ) { $first = strtoupper($en[0]); echo "<br><b>$first</b><br>"; } echo "$en - $es - $alt<br>"; }
  10. I am trying to create a glossary, and I am not sure how to group the letters of the same words underneath each other. Right now, it is appearing as this: A apple A animal A amazing A attention A aero A axiom B butt B butter b brilliant but i need it to appear as this: A apple amazing attention aero axiom B butt butter brilliant here is my code: $query = exec_mysql_query("SELECT *,substring(en,1,1) as term FROM translations WHERE substring(en,1,1) RLIKE '[$letter]' ORDER by en asc"); while ($row = mysql_fetch_assoc($query)) { $term = $row['term']; $enterm = htmlentities($row['en']); $esterm = htmlspecialchars($row['es']); $alt = htmlentities($row['alt']); $notes = htmlentities($row['notes']); if ($term == substr($enterm,0,1)) { echo "<b>$term</b><br />"; echo "$enterm - $esterm - $alt - $notes<br />"; } } } any ideas how i can fix this?
  11. try the mb_convert_encoding function and post back let me know what happens
  12. nvmd fixed with another foreach statement..this can be closed
  13. also i seem to have ran into another issue.. the script only works for rows that have one source.. when it has 2 or more sources, i get this error. Query failed: INSERT INTO newtable (cat_id,id,format,source,host) VALUES (2,16455,'avi','94VXBJXA'),(2,16455,'mkv','XWZCEKQE',1) Error: Column count doesn't match value count at row 1 why?
  14. i have over 51,000 rows that need to be converted. is there any way i can split this script up so that it doesnt time out? btw, thanks for the code it works awesome if i didnt have so many rows lol.
  15. thanks for the info my code is preettty sloppy lol.
  16. is there any way i can convert my current data to the new table design quickly?
  17. wow i havent thought of it like that..guess ill have to do some recoding then.
  18. exec_mysql_query does the same as mysql_query. its just a function i made for it to count queries. i commented out everything in the code and i only have this now: $query = exec_mysql_query("SELECT * FROM sources WHERE cat_id = '$cid' AND id = '$id' LIMIT 1"); $row = mysql_fetch_assoc($query); foreach($row as $value => $key) { $$key = $value; } echo $avi_0 . "<br />"; echo $avi_0 gives out nothing, but i dont understand why thats the case because the field is not empty..
  19. bump..still trying to figure out a solution..
×
×
  • 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.