Jump to content

funkfact

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

funkfact's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi Everyone, In redesigning my new web site, with the skills I am learning in PHP I struck upon a thought which I would like to ask: Is it possible to switch my heading banner from a daytime scene to a night time scene using the time of the local server. Basically I have two links in my database to two separate SWF files. Is there a script available anywhere that would do this? Thanks!
  2. Litebearer! You are a Star It works perfectly! Thank you very very much. Rest well my friend... FF
  3. Hi BlueSkyIS, Added your code to Try what you suggested but still can't make no sense of it?? Here is the result I got (if it helps you diagnose it better): Query: SELECT `join_date`, `name`, `location`, `link` FROM `members` WHERE `name` = Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1_GET['name']: Jayne Casey name: query: SELECT `join_date`, `name`, `location`, `link` FROM `members` WHERE `name` = Cheers, FF
  4. Hi Paddyfields, The first field, primary auto increment, in my database table is already ID. I tried changing the query but it made no difference. My problem is that my code (above) doesn't work and yields no results? I was hoping somebody could look at the code and tell me what I am doing wrong? FF
  5. Ok. So I tried the options above but the linked page opens with this error: "Query: SELECT `join_date`, `name`, `location`, `link` FROM `members` WHERE `name` = Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1" Here is my code for the first and second pages, maybe someone can tell me where I'm going wrong?: ----------------------------------- (results.php - this page works just fine) <?php include("dbinfo.php"); $conn = mysql_connect($host,$username,$password); if(!$conn) die("Failed to connect to database!"); $status = mysql_select_db($db, $conn); if(!$status) die("Failed to select database!"); $getMembers = mysql_query('SELECT name FROM members ORDER BY id') or die(mysql_error()); $numMembers = mysql_num_rows($getMembers); echo '<ul> '; for($count = 1; $count <= $numMembers; $count++) { $row = mysql_fetch_array($getMembers); echo '<li><a href="member_details.php?name=' . $row['name'] . '">' . $row['name'] . '</a></li> '; } echo '</ul> '; mysql_close(); ?> ----------------------------------- (member_details.php) <?php include("dbinfo.php"); $conn = mysql_connect($host,$username,$password); if(!$conn) die("Failed to connect to database!"); $status = mysql_select_db($db, $conn); if(!$status) die("Failed to select database!"); if( isset($_GET['name']) && ctype_digit($_GET['name']) ) { $name = (int) $_GET['name']; } $query = ("SELECT `join_date`, `name`, `location`, `link` FROM `members` WHERE `name` = $name"); if( $result = mysql_query($query) ) { $array = mysql_fetch_assoc($result); } else { echo "Query: $query<br>Error: " . mysql_error(); } ?> Hope my code is not a mess!! As I said I'm just starting out with this... FF
  6. Wow, you guys reply fast! You are so kind, thanks very much! I wasn't using the ID field in the previous list page, I was using the 'name' field in the list displayed: <? echo '<ul> '; for($count = 1; $count <= $numName; $count++) { $row = mysql_fetch_array($getName); echo '<li><a href="user_details.php?name=' . $row['name'] . '">' . $row['name'] . '</a></li> '; } echo '</ul> '; ?> This displays the names as links just fine, should I be using the ID number instead? I quickly tried your suggestions, as I have got to go to work in a minute :-(, but in the table where I expected the results to appear, ie: <? echo $name; ?> <a href="<? echo $link; ?>" target="_blank">Your Web Page</a> etc, nothing appears! Guess I'll have to wait until tomorrow when I can review my code more closely! Any suggestions on a good book to purchase? Until tomorrow.... thanks again :-) FF
  7. Hi, Firstly, I am a complete newcomer to PHP though I am enjoying my first tentative steps into learning the language! I have been searching Google for hours now to try and find a simple solution to a problem I just can't seem to figure out, though I thought would be easy to find? I have found a lot of very informative solutions to other questions on this forum so figured it was the best one to join? My question is: I have built and can interact with a simple database and now populate a page with usernames in a list. Each one is a link which, when clicked sends the username to another page. On this page I use the $_GET function and see the username displayed ok. What I can't figure out is how to then display other information about them from the fields in the database identified with that user? Any help would be greatly appreciated as this is driving me nuts! Also can anyone suggest a good book for learning PHP? There are lots out there but the reviews on Amazon seem to always talk about coding errors in print etc. so I really don't know which one to buy? FF
×
×
  • 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.