Jump to content

Yesideez

Members
  • Posts

    2,342
  • Joined

  • Last visited

Everything posted by Yesideez

  1. All sorted. Just realised I'm working on this site because I'm bored and the script will only update the frame that the script is called in so no worries :D
  2. I've downloaded a very nice menu script and when you select one of the options it calls one line that activates the following: window.location=url; Now in my window I have set 3 frames, a title bar called fmetitle, a menu called fmemenu and the main area called fmebody. If someone would be kind enough to tell me how to modify the above line of javascript to point to a specific frame (fmebody) and update it instead of breaking out of the frames I'd be most grateful. I don't want to go editing all my code and find my idea doesn't work which is this: window.fmebody.location=url; Am I right on that or is it not so obvious? Many thanks.
  3. I use Edit+ from www.editplus.com and wouldn't use anything else. The features speak volumes for the program.
  4. The poor lad is gonna be soooo confused... (ps stick with Andy's - he's a mod ;))
  5. Try this:[code]<a href="?p=register">Register Now</a> <?php $p=$_REQUEST['p']; if (empty($p)) {?>   blah blah blah <? } if ($p=="regtister") {?> blah blah blah <? } ?>[/code]Rather than test for "" when checking $p I've opted to use the empty() function. When pulling values off a URL I prefer to use $_REQUEST - just my choice as I prefer to use $_GET with using forms with method=get. You can change it to $_GET if you want.
  6. Immediately before the second SELECT query enter this:[code]echo "jc=$jc"; exit;[/code]I have a feeling that $jc doesn't actually contain anything when being passed to that function.
  7. SELECT * FROM table ORDER BY date ASC LIMIT 1 Let's break that down... "SELECT" is the command "*" means everything from the table "FROM table" says which table to use "ORDER BY date" says how we want the data ordered (this case by the field "date") "ASC" means in ascending order (ie. A, B, C) opposite is DESC "LIMIT 1" means only return one row of data If you use LIMIT 10 then that'd return 10 rows of data but you'd need to set up a loop to read all of the rows. If you want to only read the most recent 4 pieces of journal data then use something like this: SELECT * FROM table ORDER BY date DESC LIMIT 4 To make it clickable try something like this:[code]$query=mysql_query("SELECT * FROM table ORDER BY date DESC LIMIT 4"); while ($fetch=mysql_fetch_array($query)) {   echo '<a href="page'.$fetch['id'].'.php">Journal Page '.$fetch['id'].'</a>"; }[/code]That method will make actual links being those of page??.php (??=valud of "id" in the database) but if you want to pass the value to page.php replace the echo above with this:[code]  echo '<a href="page.php?p='.$fetch['id'].'">Journal Page '.$fetch['id'].'</a>";[/code]That will make something like this: page.php?=id (where "id" is the value) Make sense?
  8. I learnt HTML to start with not knowing what PHP was about. I knew it existed but didn't know anything about it. After learning HTML and making a few sites I got fed up having to change loads of HTML files to add or remove one menu item or change a header etc. and it was then I found out PHP would do what I wanted. While I taught myself PHP I also ended up learning MySQL due to the project I was working on at the time.
  9. Its not so much a bug with Firefox, more of the fact that Firefox is strict when it comes to rendering pages where IE is relaxed. IE will let you get away with a lot more than Firefox will. Make a small error in some HTML and it'll go unnoticed in IE.
  10. MONTH:[code]<?php   $months=array("January","February","March","April","May","June","July","August","September","October","November","December"); ?> <select name="month"><?php   for ($i=0;$i<12;$i++) {     echo '<option value='.$months[$i].'"';     if ($month==$months[$i]) {echo ' selected';}     echo '>'.$months[$i].'</option>';   } ?></select>[/code] DAY:[code]<select name="day"><?php   for ($i=1;$i<32;$i++) {     echo '<option value='.$i.'"';     if ($day==$i) {echo ' selected';}     echo '>'.$i.'</option>';   } ?></select>[/code] YEAR:[code]<select name="year"><?php   for ($i=1900;$i<2007;$i++) {     echo '<option value='.$i.'"';     if ($year==$i) {echo ' selected';}     echo '>'.$i.'</option>';   } ?></select>[/code]Thats the way I'd do it as $month would be the value obtained from the user earlier in the script. Can't guarantee it works as thats off the top of my head but it gives the general idea. The code above also makes all the data for all the drop-down boxes so there's no need to worry about making loads of HTML.
  11. There are two main ways of passing data from one page to another and that is decided in the followng code:[code]<form method="???">[/code]Where ??? is either "get" or "post". When using POST the data contained within the form is sent to the page in packets of data. If using GET the data is appended onto the end of the URL. For example, if you have the following form:[code]<form action="test.php" action="get"> <input type="text" name="name"> <input type="text" name="age"> <input type="submit" name="subsend"> </form>[/code]If you typed in "rupert" as the name and "34" as the age the URL would be something like this: test.php?name=rupert&age=34 Then you can use $_GET to retrieve the information from the URL. When using method="post" you'll need to use $_POST to retrieve the data. I always prefer to use the POST method because its all too easy for someone to edit the URL and send their own data but then again, its up to you to verify any data received before using it. The POST method does not affect the URL.
  12. I can't see what the problem is as everything seems to be right but if you want to validate your data before accepting it you could have a slight problem with using two files. You can merge everything into one file like this: [code]<?php   if ($_POST['subsend']) {     $quantity=$_POST['quantity'];     $item=$_POST['item'];   } ?> <html><body> <h4>Tizag Art Supply Order Form</h4> <?php if ($quantity&&$item) { ?> You ordered <?=$quantity?> <?=$item?><br /> Thank you for ordering from Tizag Art Supplies! <?php } else { ?> <form action="process.php" method="post"> <select name="item"> <option>Paint</option> <option>Brushes</option> <option>Erasers</option> </select> Quantity: <input name="quantity" type="text" /> <input type="submit" name="subsend" /> </form> <?php } ?> </body></html>[/code]Thats basically the idea - try that and see how it works.
  13. How different are all the tags that need closing? The only editor I use is Edit+ (www.editplus.com) which I also recommend as it allows you to record and play macros. Just record yourself changing one and then play it back until you get to the end of the file. As for any utilities to automatically close the tags, I've no idea of any out there, maybe someone else does?
  14. The most simplest way of doing this is to have each php file set up like this: [code]<?php //Any php stuff be done here ?> <html> <head>   <title>my page title</title> </head> <body>   blah blah blah   more html   and some more   <?php include("news.php"); ?> </body> </html>[/code] That way all your HTML can be written as normal. All you have to do is add one line (in above example, its near the bottom) to include into the script one file called "news.php"
  15. Please use the search function as this has already been answered recently - this is what I just told another user to do who has asked the same question.
  16. Try using the search facility as I remember this being answered recently.
  17. Its about having a secure script - there is a function within PHP called chmod() to do it within a script - try that and let us know how you get on.
  18. I'm not too hot on these myself but I do know that you can have chmod permissions set on a folder or a file. I suggest having the folder set to 755 at all times. When a user uploads set the folder to 777 and once uploaded, set the folder to 755 again and set the file to 755. There might be an easier way of doing it but as I said, I'm not too hot on this myself and this is how I'd give it a go...
  19. [a href=\"http://webmasterworkshop.com/guides/chmod_guide.shtml\" target=\"_blank\"]http://webmasterworkshop.com/guides/chmod_guide.shtml[/a] Hope this link explains it better than I can.
  20. By the way, the above two snippets of code would show thumbnails which can be clicked to take the user to the artist/album. A sample script (let's try viewalbums.php) could look something like this: [code]<?php   $albumid=intval($_REQUEST['id']); //Get albumid from URL   include("dbconnect.php"); //Connect to the database   $fetch=mysql_fetch_array(mysql_query("SELECT * FROM albums WHERE `albumid`='$albumid'"));   $albumid=$fetch[albumid];   $artistid=$fetch[artistid];   $albumtitle=$fetch[title];   $tracks=explode("|",$fetch[tracks]); //Split the track listing into an array   $trackshtml="";   for ($i=0;$i<count($tracks);$i++) {     $trackshtml.=$i.': '.$tracks[$i].'<br>';   }   $fetch=mysql_fetch_array(mysql_query("SELECT name FROM artists WHERE `artistid`='$artistid'"));   $artistname=$fetch[name]; ?> <html> <head>   <title><?=$albumtitle?> by <?=$artistname?></title> </head> <body>   Cover:<br>   <img src="gfx/albums/lg<?=$albumid?>.jpg" border="0"><br>   Tracks:<br>   <?=$trackshtml?> </body> </html>[/code]
  21. Its an easy misunderstanding. I've been in conversations at work with IT colleagues and have been asked what I program in. I start my answer with "I know about 8 or 9 languages" and before I can get any further they interrupt with "No, I mean what do you use to write programs" For some reason languages seems to trigger spoken languages instead of programming languages...
  22. When I said which language I meant which language to display to the user - English or Spanish, not which scripting language :) Glad yo fixed it :)
  23. Just read this topic with interest and would like to add a little if I may. Storing the data in a database is the best idea and I would like to suggest a similar way of storing the data by using two tables. First you have the main table that stores information about the artists. Let's call the table "artists": [code]CREATE TABLE `artists` ( `artistid` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT , `name` VARCHAR( 50 ) NOT NULL , `genre` VARCHAR( 20 ) NOT NULL , `comment` TEXT NOT NULL , PRIMARY KEY ( `artistid` ) ) TYPE = MYISAM;[/code] This would be used to store information about the artist. Of course you could have a lot more fields than I've used. Then you'd have another tables containing information about each album, let's call it "albums": [code]CREATE TABLE `albums` ( `albumid` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT , `artistid` MEDIUMINT UNSIGNED NOT NULL , `title` VARCHAR( 80 ) NOT NULL , `tracks` TEXT NOT NULL , PRIMARY KEY ( `albumid` ) ) TYPE = MYISAM;[/code] Every time you add an album you will have to add the artist first, therefore generating a unique artistid from the table "artists" which would then be added into the artistid field in the table "albums". As for the track listings you'd store them in the TEXT fields separated by either a carriage return or a character not used like the "|" symbol - use explode() to split them up for easy displaying. When it comes to linking to the images of the album covers you'd use the unique id fields. These will be numbers. Store these covers on the server something like this: [code]images/sm1.jpg images/lg1.jpg images/sm2.jpg images/lg2.jpg[/code] ...and so-on. The "sm" file would be the thumbnail and the "lg" would be the full-sized image. This way each artist could have a unique picture and each album can as well. That's the way I'd be tempted to do it. Additional post: To show an image of the artist use something like this: [code]$searchstr="Queen"; $fetch=mysql_fetch_array(mysql_query("SELECT * FROM artists WHERE `name`='$searchstr'")); $artistid=$fetch[artistid]; echo '<a href="viewartist.php?id='.$artistid.'"><img src="gfx/artists/sm'.$artistid.'.jpg"></a>';[/code] To display all of the albums by an artist you'd use something like this: [code]$query=mysql_query("SELECT * FROM albums WHERE `artistid`='$artistid'"); while ($fetch=mysql_fetch_array($query)) {   $albumid=$fetch[albumid];   echo '<a href="viewalbum.php?id='.$albumid.'"><img src="gfx/albums/sm'.$albumid.'.jpg"></a>'; }[/code] That's pretty much all I can think of for the moment. I'll keep an eye on this topic and help where I can.
  24. How are you deciding which language to use? Can you show some code please?
  25. I know its a bit naughty but not all of my sites are W3C compliant but the ones that are, all pages can be checked regardless of whether they're created using PHP or plain HTML. I've found that the W3C validator will still check and validate code best when its online and not uploaded. That way if the site is written using PHP the result will be HTML and thats whats checked. If your site has a command line that has to be parsed via the URL then online validators will still parse this and generate the HTML depending on the URL contents. Plese forgive me for wording this badly if its difficult to read but its extremely hot here at work and I can't open the doors and windows more than they already are :(
×
×
  • 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.