Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Indeed. You're going to get a very biased opinion here.
  2. Isn't the results of your 2nd test what you are after? It looks fine to me.
  3. You deal with the large amount of space, then i might take a look. Im afraid i dont have time to sift though hundreds of lines of whitespace.
  4. Having different tables for different genres was a bad idea. You might wish to consider altering your database design, perhaps after reading up on database normalization. The sticky in this forum would be a good place to start. That said, you could achieve this with two separate queries - the first to find the genre and the second to select everything from the relevant table. To the best of my knowledge, you can't achieve this in a single query.
  5. This is a job for javascript - not PHP. Basic idea would be to have this in the header section: <script type="text/javascript> function hide(){ document.getElementById('textfieldidhere').value = document.getElementById('textfieldidhere').value+'/hide'; } </script> You'll then have a button like: <input type="button" value="Hide" onClick="hide()" /> You may also wish to have the form automatically submitted with javascript. If you google, you'll find plenty of examples. An alterative would be to have javascript do this all in the background, with AJAX.
  6. Hmm. I think the problem is that you're saving the image. You dont want to be doing that - you want to output the image directly. After all, its going to change all the time. Try changing this line: imagejpeg($im, 'ver', 80); //create the image and shown if displayed somewhere on the server To: imagejpeg($im, NULL, 80); //create the image and shown if displayed somewhere on the server And see where that gets you.
  7. Only the questions should be inside the while loop, since those are the only things you wish to loop though. The form opening/closing tags and the submit button should be outside the loop. When you post your code, could you place it inside tags please. If you could also use full opening tags (<?php) it would be a great help - we'll then get syntax highlighting and it'll be much easier to read your code and help you.
  8. What do you mean by 'it just prints out the url'?
  9. The difference in results between the two tests is caused by the magic_quotes setting. It would seem that quiettech has it turned on, whilst you have it off. Surely your 2nd test is correct netpreak?
  10. What happens if you browse directly to img.php with the relevant query string attached?
  11. Found an easier way: RewriteEngine On RewriteRule ^ver.jpg$ img.php [QSA] Not sure why you're rewriting, but that should do it.
  12. Im no expert with mod rewriting, but that doesn't look right to me. Try: RewriteEngine On RewriteRule ^ver.jpg([A-Za-z0-9?]+)$ img.php$1
  13. You can stick them in a multidimensional array and use a user defined sort function. <?php $title = array('Hello!', 'Title #2', 'A title!'); $description = array('message', 'blah', 'text'); $array= array(); for($x=0;$x<count($title);$x++){ $array[$x]['title'] = $title[$x]; $array[$x]['description'] = $description[$x]; } function mysort($a,$b){ return strcmp($a['title'],$b['title']); } echo '<pre>'.print_r($array,1).'</pre>'; usort($array,'mysort'); echo '<pre>'.print_r($array,1).'</pre>'; ?> The returned array might not quite be what you were expecting, but it may actually be more useful. See: http://www.php.net/usort
  14. To and From are reserved words in mysql (see: http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html) Either rename your fields (better in the long run) or enclose them in backticks (`).
  15. So you have hundreds of rows that contain, say, fashion in the cat field and mens in the subcat field? If so, i recommend you read up on database normalization. It will be easier in the long run. See this topic here and the pages it links to: http://www.phpfreaks.com/forums/index.php/topic,126097.0.html
  16. Because both dropdowns have default values of country and sex respectively.
  17. Fraid not - there's county and country. As far as I can see, there's no reason why this shouldn't be working. It might sound daft, but are you sure you saved this after making changes?
  18. Im a bit confused..are you trying to set the value of the field to test"= ? If so, you can't use the same style quotes inside the value of an attribute as you use to enclose them. When the browser loads this, it just assumes the next double quote it comes to signifies the end of the value attribute. Either enclose it in single quotes: value='test"=' Or use the HTML character code: value="test"="
  19. If you're every considering a huge number of if statements, then dont. There's almost certainly a better way. What i would suggest is that you set up a couple of database tables: categories: id, name sub_categories: id, cat_id(the id of the categories this is a sub-category of), name You'll then want to pass the category id and sub-category id around in the URL. When your page loads, you'll grab these pieces of information and work out what is being displayed. You'll also display the relevant items. You can then add searching and sorting from there.
  20. Yup. Otherwise php litterally writes \n to the screen.
  21. You need to enclose special characters like new lines in double quotes.
  22. That's because the values are not persistant across different requests. When the page first loads, your variables are in the $_GET array. You then submit a form. When that request is made, the variables are not sent, hence why they do not get entered into the database. You can either add them to the form action URL or add hidden fields. I'd probably go with the first method: <form action="scores.php?diff=<?php echo $diff;?>&console=<?php echo $console;?>" method="post">
  23. 1.) You've not retrieved the variables from the $_POST array before you try to echo them. You need to do something like: <?php $name = $_POST['name']; echo $name; //Or just echo $_POST['name']; ?> 2.) You dont execute your query. Try: <?php $sql="INSERT INTO $tbl_name(name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password, usertype)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password' , 1)"; mysql_query($sql) or die(mysql_error().'<br /> Query was:'.$sql); ?>
  24. You need the concatenation operator (.). It joins strings together. <?php $a = 1; $b = 00; echo $a.$b; ?>
  25. It has been suggested - and we did actually have something similar a while back. Didn't work out, however. See: http://www.phpfreaks.com/forums/index.php/topic,99076.0.html for the background.
×
×
  • 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.