Jump to content

rocket_roche

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male

rocket_roche's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for that rhodesa - to take it a little further - if for example there were two words seperated by a space in the p_name field, is there a similar command that would capitalise the first letter of each seperate word? Sorry - found that one - the ucwords() function. Again, thanks for your help.
  2. I'm trying to output table contents on a webpage and my query is working fine. However, I would like to make sure that the first word in some columns is capitalized when output. $result = @mysql_query("SELECT b.title, b.image, b.price, a.fname, p.p_name FROM books b JOIN author a JOIN publisher p WHERE b.fk_a_id = a.a_id and b.fk_p_id = p.p_id;" ); I'm outputting results to a table in HTML. echo("<tr><td> Title: " . $row["title"] . "</td></tr>"); echo("<tr><td> Author: " . $row["fname"] . "</td></tr>"); echo("<tr><td> Publisher: " . $row["p_name"] . "</td></tr>"); What I would like to do is ensure that the title, fname and p_name are displayed with the first letter as a capital. Should this be done at the query level or is there a HTML function to do this. Any help greatly appreciated. Regards, Tony
  3. Hi there, I've been taking a few small steps towards developing a database driven website with WAMP. I've been developing on my own PC at home but am returning to college this week. At college I will be required to work on several different PCs. I have a 4 gig memory stick, should I unpackage WAMP on this to allow me to move freely between PC's at college, without losing any records entered in my database? Will the underlying database records be kept on the memory stick? I don't think the database size will be a problem as the number of records wont be over a few hundred. Thaks for any ideas or advice given. Regards, Tony
  4. Thanks Gevans. Should the updated code to pass in the URL look like this? display the category names while($row = mysql_fetch_array($result)){ $cat_id = $row["c_id"]; echo("<li><a href='category.php?var=$cat_id'>" . $row["c_name"] . "</li>"); } //
  5. I wish to pass a variable to another page when a link has been clicked in my navigation bar. When I click on the link I want the category id (c_id) from the datbase to be passed to the category.php page. My thinking is that by using the c_id that the category.php page will generate info related to the category referenced by c_id. Is this the correct way to generate a PHP page based on a link? Existing code below: //get all the top level categories $result = @mysql_query("SELECT * FROM cat ORDER BY c_name"); if (!$result){ echo("<p>Error performing query: " . mysql_error() . "</p>"); exit(); } //display the category names while($row = mysql_fetch_array($result)){ echo("<li><a href='category.php'>" . $row["c_name"] . "</li>"); } Where i display the category names should I also define a variable for the c_id? How do I then pass that as part of the link? Could somebody please show me the extra code required. Any help greatly appreciated. Thanks, Tony
  6. Thanks guys, thats really helpful and has improved my understanding. The path I should be using is from the www folder. Please clarify: If I store just image names, it is possible to set up a path variable (as a function - or similar?) in a file, which I could include in all HTML pages? If I later move my image folder or rename it - I can simply change the centrally stored path variable??
  7. Hi, I'm doing a college project on setting up an online bookstore. I wish to display a book cover image on the browser. I believe that storing a path to the image in mySQL is good practice (doesn't impact on performance). My query is based on the path to store... I am using the default WAMP www folder with a folder called images. When storing the path to the images in mySQL table should I do this: insert into booktable values("booktitle","c:\wamp\www\images\imagename") or this insert into booktable values("booktitle","\images\imagename") Could someone please explain which path to store? Correct example? Secondly the single line of PHP to display the image. e.g. echo ("<img src = " . $row["bookcover"] . ">"); ("bookcover" = column name in the table that stores the image) Any help greatly appreciated... Regards, Tony
×
×
  • 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.