Web Design and Development Forums

[SOLVED] Basic database to call information

This is a discussion on "[SOLVED] Basic database to call information" within the PHP Forum section. This forum, and the thread "[SOLVED] Basic database to call information are both part of the Program Your Website category.


Go Back   Webforumz.com > Program Your Website > PHP Forum

Welcome to Webforumz.com.
Register Now Register now!

Reply
 
LinkBack Thread Tools Rate Thread
Old Apr 30th, 2008, 18:23   #21 (permalink)
Junior Member
 
Join Date: Apr 2008
Location: Surrey, UK
Posts: 16
Re: Basic database to call information

Thank you, I looked through but didnt see that one! Im still having problems with it, when I click search it now goes to a blank page. If i check source its blank.
hausjellp is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 30th, 2008, 19:19   #22 (permalink)
 
Join Date: Jun 2007
Location: uk
Posts: 459
Re: Basic database to call information

Are you certain you are saving the file as search.php, if not you will have to change the form action from

HTML: Select all
action="search.php?action=search"
to

HTML: Select all
action="yourfilename.php?action=search"
Pat
dab42pat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 30th, 2008, 19:37   #23 (permalink)
Junior Member
 
Join Date: Apr 2008
Location: Surrey, UK
Posts: 16
Re: Basic database to call information

I made sure the file was saved as search.php.

I have looked through the file for errors I have made when changing information but couldnt see any.
hausjellp is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 30th, 2008, 19:42   #24 (permalink)
 
Join Date: Jun 2007
Location: uk
Posts: 459
Re: Basic database to call information

Can you post your entire code again.

I dowloaded Bronic's code and it worked for me.

It's probably something very simple.

Are you using dreamweaver by the way
dab42pat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 30th, 2008, 19:47   #25 (permalink)
Junior Member
 
Join Date: Apr 2008
Location: Surrey, UK
Posts: 16
Re: Basic database to call information

Thanks for looking

Im using notepad.

Code: Select all
<?php
if($_GET['action'] == "search") {
  $var = $_POST['q'] ;
  $trimmed = trim($var);
    $host = "localhost";
    $db = "database";
    $usr = "user";
    $pss = "password";
$limit=1; 
if (!$trimmed)
  {
  echo "<p>Please enter the 10 digit Member ID</p>";
  exit;
  }

if (!isset($var))
  {
  echo "<p>You MUST enter the 10 digit Member ID</p>";
  exit;
  }

mysql_connect($host,$usr,$pss); 

mysql_select_db($db) or die("Unable to select database"); 

$query = "select * from users where fldID = '$trimmed' order by fldID"; 

 $numresults=mysql_query($query);
 $numrows=mysql_num_rows($numresults);


if ($numrows == 0)
  {
  echo "<h4>Search</h4>";
  echo "<p>Member ID: &quot;" . $trimmed . "&quot; is NOT valid</p>";

  if (empty($s)) {
  $s=0;
  }

  $query .= " limit $s,$limit";
  $result = mysql_query($query) or die("Couldn't execute query");

echo "<p>Member ID: &quot;" . $var . "&quot;</p>";

echo "Member Name";


  while ($row= mysql_fetch_array($result)) {
  $Name = $row["fldName"];
  $address = $row["fldAddress"];
  $Id = $row["fldExp"];
  $status = $row["fldStatus"];

  echo "$count:&nbsp;$Name<br>Id Number: $Id<br>Address: $address<br>Status: $status<br>" ;
  $count++ ;
  }

$currPage = (($s/$limit) + 1);

  echo "<br />";

  if ($s>=1) { // bypass PREV link if s is 0
  $prevs=($s-$limit);
  print "&nbsp;<a href=\"$PHP_SELF?s=$prevs&q=$var\">&lt;&lt; 
  Prev 10</a>&nbsp&nbsp;";
  }

  $pages=intval($numrows/$limit);


  if ($numrows%$limit) {
  $pages++;
  }

  if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {

  $news=$s+$limit;

  echo "&nbsp;<a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 &gt;&gt;</a>";
  }

$a = $s + ($limit) ;

  if ($a > $numrows) { $a = $numrows ; }

  $b = $s + 1 ;

  echo "<p>Showing results $b to $a of $numrows</p>";

  }

} 

?>
hausjellp is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 30th, 2008, 20:03   #26 (permalink)
 
Join Date: Jun 2007
Location: uk
Posts: 459
Re: Basic database to call information

Don't know what to suggest, just tested your code on my server and it seems to be working.

possibly check notepad is saving in ANSI.
dab42pat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 30th, 2008, 20:05   #27 (permalink)
Junior Member
 
Join Date: Apr 2007
Location: Kansas
Age: 18
Posts: 33
Send a message via AIM to BRONIC
Re: Basic database to call information

if you need to use aptana it acts like a debugger and shows you syntax errors in your php and it color codes it.

also could you post the link to the page on your site where it is uploaded so we can see it?


http://www.aptana.com

Last edited by BRONIC; Apr 30th, 2008 at 20:13.
BRONIC is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 30th, 2008, 20:38   #28 (permalink)
Junior Member
 
Join Date: Apr 2008
Location: Surrey, UK
Posts: 16
Re: Basic database to call information

I have made a few changes and now it seems to work, not sure what i was doing wrong,

Quote:
http://verify.ifja.org
testuser id: UK2008059J
hausjellp is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 30th, 2008, 20:39   #29 (permalink)
Junior Member
 
Join Date: Apr 2008
Location: Surrey, UK
Posts: 16
Re: Basic database to call information

Sorry, forgot to say - Thank you very much for your help. Is it possible to keep this thread open?
hausjellp is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 1st, 2008, 04:46   #30 (permalink)
Junior Member
 
Join Date: Apr 2007
Location: Kansas
Age: 18
Posts: 33
Send a message via AIM to BRONIC
Re: Basic database to call information

You are very welcome.

Im not sure if the moderators will keep it open but if you need anymore help you can pm or email me.
BRONIC is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 1st, 2008, 09:29   #31 (permalink)
Chief Moderator
 
aso186's Avatar
 
Join Date: Oct 2007
Location: UK
Posts: 701
Blog Entries: 2
Send a message via Skype™ to aso186
Re: Basic database to call information

Pretty much all threads are kept open - we may mark them as 'SOLVED', but users can always add to it
__________________

aso186 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[solved] Don't know what to call it acrikey Webforumz Cafe 3 Mar 24th, 2008 18:45
[SOLVED] preserve the state of checkboxes after an AJAX call pesho318i JavaScript Forum 4 Nov 7th, 2007 16:35
[SOLVED] AJAX call to a servlet pesho318i JavaScript Forum 9 Oct 28th, 2007 12:40
Query Pulling Wrong information from MySQL database :: Cactushop Andrew1986 ASP Forum 1 Oct 3rd, 2007 11:06
call php function in different database csun PHP Forum 1 Aug 8th, 2007 07:17



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 07:27.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59