Jump to content

Prank

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Everything posted by Prank

  1. Ahh crap, I didnt even pick up on that. Thanks heaps.
  2. Its happening in several places, each with re-written code. The code couldnt be more simple. Heres one example; [code]         $q = "SELECT * FROM cars"; $qr = mysql_query($q) or die(mysql_error()); $r = mysql_fetch_assoc($qr); echo '<strong>Select a link category</strong><br />'; while($r = mysql_fetch_assoc($qr)){ echo '<a href="links.php?do=listlinks&cat='.$r['name'].'">'.$r['name'].'</a><br />'; } // while[/code] Thanks.
  3. Hi Guys, I have a table with 5 records in it, when I select the records (even just using SELECT * FROM cars) it will sometimes retrieve 3 records and sometimes 4, never the whole amount. I have never seen this happen before. If I run the query in phpmyadmin it returns all records. I dont understand how this could happen, the Statement could not be more simple. Anyone know why this could be happening? Christian
  4. Sweet, I'll give that a go, thanks!! :)
  5. [quote author=Crayon Violent link=topic=99267.msg390886#msg390886 date=1151909295] do you want to select all the rows where the value = something? or do you want to select all the information in all of the rows and then be able to manipulate that info with php? [/quote] I dont need to be able to manipulate it as it should be fine in its current state. I just need to select all and then refer to it Thanks!
  6. Hi Guys, I am building a site which is going to utilise a 'settings' table in mysql which will effect the site depending on the value of certain fields.. does that make sense? So, I have a 3 field table (id, name & value). Then the rows would be (for example; 1, is_feature_turned_on, Y). So then a simple if statement will display or hide that feature. Now, what I want to know is, whats the best way to reference these names and values? I could be stupid and simple write a new query for each row that I want to reference (SELECT * FROM settings WHERE name = is_feature_turned_on) but thats silly. I dont know how else I can easily access these values, so I thought I must be able to put them into an array somehow and access them like so (name['is_feature_turned_on']) but I simply cannot get my head around how to do this. It might be really simple and something I have just not yet considered. Anyway, I would greatly appreciate any help at all on this. Thanks in advance, Christian
  7. hmmm, I have no idea. I dont see why it wouldn't be permitted, providing the editting that takes place doesn't make a change to the way the files are called.... but, thats really a guess.
  8. nm, i figured it out.. stupidly simple.
  9. You can write code that is kept in a cache, but thats outside of my knowledge. I know you can build cached templates using things like smarty (http://smarty.php.net)
  10. yep, precisely. Thats why its important to have well written code. Especially on big sites. C
  11. PHP isn't compiled code, so it doesn't need to check for updates. Files will run regardless of their last updates, the Processor doesn't care about updates. The update taking a few seconds could just be your cache loading the file. You should do a CTRL+Refresh when you update the files as it'll grab the latest copy of the file from the server. C
  12. So that would just add a 1 to the variable $count each time its run? Heres my actual code; [a href=\"http://pastebin.com/658997\" target=\"_blank\"]http://pastebin.com/658997[/a] I need to grab the total value of $total and $qty Thanks for your help.
  13. It looks that way. Create a new file called phpinfo.php and in it, put this; [a href=\"http://pastebin.com/658982\" target=\"_blank\"]http://pastebin.com/658982[/a] (click) Then upload that page and view it in a browser, if it just returns text then yeah, no php. But if it displays php information then its all good. Christian
  14. Hi Guys, I am a bit unsure of how to do this, I'd appreciate any help. What I am trying to do is add up a total number as reported by variables, but the problem is that its the same variable.. For eg; [code] while { $total = 3; } [/code] How would I add all the $total's for each instance that the 'while' was run? I hope this makes sense and I am assuming it is an easy answer.. Thanks in advance, Christian
  15. [!--quoteo(post=352072:date=Mar 7 2006, 01:18 AM:name=XenoPhage)--][div class=\'quotetop\']QUOTE(XenoPhage @ Mar 7 2006, 01:18 AM) [snapback]352072[/snapback][/div][div class=\'quotemain\'][!--quotec--] As an aside, there is some decent paginator code here : [a href=\"http://tkap.org/paginator/\" target=\"_blank\"]http://tkap.org/paginator/[/a] I've used this in several project and it comes in quite handy... [/quote] Nice, thanks for that.
  16. Thanks guys! I should have picked that up.. Christian
  17. couple of syntactical errors... Try this; [code] <?php $link = $_POST['link']; $name = $_POST['name']; $comm = $_POST['comments']; #mySQL connection $conn = mysql_connect( "localhost" , "ricfo0i1_ricfon" , "polionum" )               or die( "no mysql" ); # Database connection $rs = mysql_select_db( "gamelist" , $conn )         or die( "no DB" ); #Form query #$sql = "insert into list ( "name" , "comments" ) values ( "$a" , "$comm" ) "; $sql = 'INSERT INTO `list` (`id`, `name`, `comments`) VALUES (\'\', \'<a href="$link" target="_top">$name</a>\', \'$comm\')'; #run query $rs = mysql_query( $sql , $conn )     or die( "query error" ); echo( "putted succesfully" ); ?> [/code] If no go, report the error. Oh, and what AndyB said. Christian
  18. Hi All, You can see the script functioning [a href=\"http://www.skylinesaustralia.com/trader_convert.php\" target=\"_blank\"]here[/a] But, if you click through a few pages, you'll see that the first record is never displayed. Ie, record 1, record 51, record 101 etc... I have no idea why... Heres my code; [code] //snip db_connect(); //if (!isset($_POST['screen'])) { //    $screen = 0; //} else { $screen = $_REQUEST['screen']; $rows_per_page = 50; $start = $screen * $rows_per_page; $q = "SELECT * FROM user_rate_trade ORDER BY userrateid LIMIT $start , $rows_per_page"; $r = mysql_query($q)or die(mysql_error()); $row = mysql_fetch_assoc($r); while($row = mysql_fetch_assoc($r)) {     $id = $row['userrateid'];     $date = strtotime($row['userdate']);     $to_id = $row['ratedused'];     $userid = $row['userid'];         if ($row['userrating'] == -1) {         $rating = 2;         } else if ($row['userrating'] == 0) {         $rating = 3;         } else if ($row['userrating'] == 1) {         $rating = 1;         }     echo ''.$id.'. '.$row['userdate'].' = '.$date.' - Rating - '.$rating.'<br/>'; } $newscreen = $screen + 1; echo ''.$q.'<br /> <a href="trader_convert.php?screen='.$newscreen.'">Next</a> '; [/code] Thanks for any help, it has me stumped. Christian
  19. Love your work guys! Thanks very much! Christian
  20. Anyone? You can view the script's output and the problem I am experiencing [a href=\"http://www.skylinesaustralia.com/trader_convert.php\" target=\"_blank\"]here[/a] Thanks
  21. [!--quoteo(post=351264:date=Mar 3 2006, 06:19 PM:name=grim1208)--][div class=\'quotetop\']QUOTE(grim1208 @ Mar 3 2006, 06:19 PM) [snapback]351264[/snapback][/div][div class=\'quotemain\'][!--quotec--] you could use a link and do something like this instead of a form [code] <a href="trader_conver.php?screen=<?php $screen = $screen + 30; print $screen;?>"> [/code] [/quote] Oh, so I need to increase $screen by $rows_per_page ? increasing it by 1 wont matter?
  22. Hi Guys, I am trying to return 30 results per page with a simple 'next' link to the next 30... I have no idea why it wont work, I have passed the value of '$screen' through a form (and retrieved with $_POST) and have passed it in a link trader_convert.php?screen=$newscreen (and retrieved with $_REQUEST['screen]). It wont go to the next 30 results. Also, it seems to start at the 2nd record also, it will output id's from 2 - 30. Heres the code; [code] // Snip db_connect(); if (!isset($_POST['screen'])) {     $screen = 0; } else {     $screen = $_POST['screen']; } $start = $screen * $rows_per_page; $rows_per_page = 30; $q = "SELECT * FROM user_rate_trade LIMIT $start , $rows_per_page"; $r = mysql_query($q)or die(mysql_error()); $row = mysql_fetch_assoc($r); $total_records = mysql_num_rows($r); $pages = ceil($total_records / $rows_per_page); while($row = mysql_fetch_assoc($r)) {     $date = strtotime($row['userdate']);     echo ''.$row['userrateid'].'. '.$row['userdate'].' = '.$date.'<br/>'; } $newscreen = $screen + 1; echo ' <form method="post" action="trader_convert.php"> <input type="hidden" name="screen" value="'.$newscreen.'" /> <input type="submit" name="submit" /> </form> '; [/code] Thanks in advance! Christian
  23. [!--quoteo(post=346493:date=Feb 17 2006, 06:54 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Feb 17 2006, 06:54 AM) [snapback]346493[/snapback][/div][div class=\'quotemain\'][!--quotec--] You'd have to use JavaScript either way, unless you're going to go the IFRAME/XMLHttpRequest route. And since that's the case, it makes sense simply to output both tables to a JS array, and then have one drop-down update the other. There are many tutorials on how to accomplish this. From a MySQL standpoint, this is trivial, since you're getting back all the rows. [/quote] Awesome, thanks - I did end up using javascript but its so messy and I hate messy code. Anyhoo, thanks again.
  24. Hi Guys, I am having a brain fart and cant seem to work out how to do this.... My 2 tables; [code]phones_man +-------+--------------+------+-----+---------+----------------+ | Field   | Type           | Null | Key | Default | Extra            | +-------+--------------+------+-----+---------+----------------+ | id       | int(11)        |         | PRI | NULL    | auto_increment | | name  | varchar(100) |      |       |            |                     | +-------+--------------+------+-----+---------+----------------+ phones_mod +--------+--------------+------+-----+---------+----------------+ | Field    | Type          | Null   | Key | Default | Extra            | +--------+--------------+------+-----+---------+----------------+ | id        | int(11)        |         | PRI | NULL    | auto_increment | | name   | varchar(100) |      |       |            |                      | | man_id | int(100)     |         |       | 0         |                      | +--------+--------------+------+-----+---------+----------------+[/code] Ok, what I am trying to do is populate a drop down box using the results from phones_man and then populating the 2nd drop down box with the models that match the manufacturer selected in the first box. Does that make sense? The other alternative is to have 1 box list all the manufacturers and models like such; man1_mod1 man1_mod2 man1_mod3 man2_mod1 man2_mod2 etc... Either is fine, the first method would probably utilise a javascript auto form submit to populate the 2nd box i would think.. Either way, Advice needed. :) Thanks very much. Christian edit - damn whitespace is ignored... there goes that formatting :( mod edit: use [code] and your whitespaces are back :)
×
×
  • 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.